Slackbot
06/29/2022, 12:05 PMVampire
06/29/2022, 12:25 PMEndre Deak
06/29/2022, 12:58 PMTanguy Retail
06/29/2022, 1:05 PMNiels Doucet
06/29/2022, 2:15 PM./gradlew build?Endre Deak
06/29/2022, 2:18 PMsettings.gradle.kts which crawls for all the potential sub-projects (any folder with a build.gradle.kts file inside), and for them, apply this:
matchingFiles.forEach {
val relativePath = it.relativeTo(rootDir)
val projectName = ":${rootProject.name}-${relativePath.path.replace('/', '-')}"
include(projectName)
project(projectName).projectDir = it
}Tanguy Retail
06/29/2022, 2:18 PMEndre Deak
06/29/2022, 2:18 PMVampire
06/29/2022, 2:18 PMIsn’t that the default behaviour if you simply callYes and no. It invokes all?./gradlew build
build tasks of the main project.
Included builds are only built if used and only the parts that are used I think.
So for example only their jars are built, but no tests run and so on.Vampire
06/29/2022, 2:19 PMthis is what I use instead of manually adding all the modules manuallyWell, that has nothing to do with his question. And would also not consider sub-builds found instead of sub-projects found if that could be the case which it is in this case
Vampire
06/29/2022, 2:20 PMNot in case of a composite build @Niels Doucet, task build doesn’t exist at root.The question is why not? What does your main build do if it does not have a
build task?
Virtually any usual Gradle project has it.Vampire
06/29/2022, 2:21 PMTanguy Retail
06/29/2022, 2:24 PMtasks.register("build") { dependsOn(gradle.includedBuilds.map { it.task(":build") }) }
thing is you need all your includedBuilds to have a build task, which is not necessarily the caseTanguy Retail
06/29/2022, 3:00 PM./gradlew :api:tasks says that a build task exists (build - Assembles and tests this project.)
./gradlew :api:build says that task doesn’t exist (Task ‘build’ is ambiguous in project ‘:api’. Candidates are: ‘buildEnvironment’, ‘buildScanPublishPrevious’.)Tanguy Retail
06/29/2022, 3:06 PMVampire
06/29/2022, 3:12 PM./gradlew :api:tasks --all.
I guess there is build in some subproject.
And if you do tasks it also shows the tasks that would match by pattern (./gradlew build executes build in all projects of a multi-project build where it is found).
But I guess you will then not find a task build in the actual root project.
This is indeed misleading if it is the case and should maybe display differently when called on an included build.
If my assumption is correct I'd recommend you open an issue about it.Tanguy Retail
06/29/2022, 3:23 PM