The main goal is to run tests from a commandline by passing some variables inside. I want to run tests from each module and specific task separately. For example, to run tests from ‘sub1’ and with ‘task1’. Or from ‘sub1’ and with ‘task2’ and etc. Tasks should contain some specific logic to run with.
The problem is that I can not solve a problem of using task and module. Because, as I think, task should be in a root build.gradle. So, what logic should be stored in a module gradle config or it should be empty at all?
Can anyone help to solve it?
To run task1 from sub1 you would just run ./gradlew :sub1:task1, same for ./gradlew :sub1:task2.
Because, as I think, task should be in a root build.gradle.
Task should only bei in root build.gradle if it is for the root project.
You should not add tasks to subprojects from root build script.
That is called cross-project configuration and is highly discouraged bad practice
which introduces project coupling and and disturbs or disables more sophisticated Gradle features or optimizations.
So no, the subprojects build scripts should never be empty.