minwoox
(minux)
May 31, 2021, 12:16pm
1
Hello, I have a build.gradle
that builds several Git submodules. It’s like:
task buildUpstream(type: GradleBuild) {
buildFile = "somewhere/build.gradle"
tasks = [':dist:distDir']
startParameter.excludedTaskNames = [':dist:copyClientBinaries']
}
It executes :dist:distDir
task that depends on other tasks.
You can find it here:
task distDir(group: 'Build',
description: "Builds a distribution directory (${project.ext.relativeDistDir})",
dependsOn: [tasks.copyLicenses, tasks.copyLib, tasks.copyClientBinaries])
As you might notice, buildUpstream
task excludes copyClientBinaries
.
task copyClientBinaries(group: 'Build',
description: "Copies client binaries into ${project.ext.relativeDistDir}/lib",
dependsOn: project(':cli').tasks.assemble,
type: Copy) {
from project(':cli').ext.clientBinDir
into "${project.ext.distDir}/bin/native"
}
task distDir(group: 'Build',
description: "Builds a distribution directory (${project.ext.relativeDistDir})",
dependsOn: [tasks.copyLicenses, tasks.copyLib, tasks.copyClientBinaries])
// Create the tasks that copy each directory under src/ into dist/
['bin', 'conf'].each { dirName ->
def taskName = "copy${CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, dirName)}"
tasks.distDir.dependsOn(tasks.create(taskName, Copy) {
group = 'Build'
description = "Copies src/$dirName into ${project.ext.relativeDistDir}/$dirName"
from "${project.projectDir}/src/$dirName"
into "${project.ext.distDir}/$dirName"
})
It was working without any problem before I upgraded.
However, after upgrading it seems like the copyClientBinaries
is not excluded.
Do you guys have any clue?
1 Like
I was able to reproduce your issue but was unable to narrow down exactly what’s causing this regression. To help narrow things down I also checked Gradle 6.7.1, the issue does not appear.
This has been reported in test task cannot be excluded with setExcludedTaskNames · Issue #16756 · gradle/gradle · GitHub
I suspect it may be related to these PRs:
gradle:master
← gradle:donat/run-included-task
opened 03:44PM - 16 Oct 20 UTC
The latest version of Gradle doesn't provide any way to reference tasks from the… included build. Gradle recommends using included builds for more and more use-cases, which makes the missing feature more and more painful.
This pull request modifies the task lookup so that now tasks from composite builds can be directly addressed. A couple of implementation details:
- It only works on the command-line. Tooling API is out-of-scope for now.
- Task selectors are available. If there are `:included:mytask` and `:included:sub:mytask` tasks available and the user executes `included:mytask` then only `:included:mytask` will be executed.
I'll implement task exclusion and update the user guide in a different PR.
gradle:master
← gradle:donat/included-build-task-exclusion-2
opened 06:51PM - 12 Nov 20 UTC
This PR allows users to exclude tasks from the included builds.
The implement… ation forwards the filters from the start parameters to all included builds and creates the filter objects on their respective task graphs.
Excluding tasks from included builds has some drawbacks: it's easier to mess up existing builds. For example, if the user executes `gradle checkDeps -x jar` then the jar task will be excluded from all task graphs, with ultimately breaks the build.
@donat , given your work in this area perhaps you can pinpoint an issue faster than I.
1 Like
minwoox
(minux)
June 1, 2021, 7:04am
3
Thanks for checking it!
It happens when I upgrade from 6.7.1 to 6.8
I did some more digging and left my additional thoughts in the github issue .
1 Like