File tree 1 file changed +17
-2
lines changed
src/main/groovy/com/avast/gradle/dockercompose
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -123,14 +123,29 @@ class TasksConfigurator {
123
123
task. dependsOn upTask
124
124
task. finalizedBy downTask
125
125
if (fromConfigure) {
126
- upTask. get(). shouldRunAfter task. taskDependencies
126
+ upTask. get(). shouldRunAfter getTaskDependencies( task)
127
127
} else {
128
- upTask. configure { it. shouldRunAfter task. taskDependencies }
128
+ upTask. configure { it. shouldRunAfter getTaskDependencies( task) }
129
129
}
130
130
if (task instanceof ProcessForkOptions ) task. doFirst { composeSettings. exposeAsEnvironment(task as ProcessForkOptions ) }
131
131
if (task instanceof JavaForkOptions ) task. doFirst { composeSettings. exposeAsSystemProperties(task as JavaForkOptions ) }
132
132
}
133
133
134
+ private Object getTaskDependencies (Task task ) {
135
+ def includedBuilds = task. project. gradle. includedBuilds
136
+ if (includedBuilds. isEmpty()) {
137
+ return task. taskDependencies
138
+ } else {
139
+ // Ignore any task dependencies from a composite/included build to avoid the
140
+ // "Cannot use shouldRunAfter to reference tasks from another build" error introduced in Gradle 8
141
+ def includedBuildProjectNames = includedBuilds. collect { it. name }. toSet()
142
+ return task. taskDependencies. getDependencies(null ). findAll { dependency ->
143
+ // use rootProject.name in case the task is from a multi-module composite build
144
+ ! includedBuildProjectNames. contains(dependency. project. rootProject. name)
145
+ }
146
+ }
147
+ }
148
+
134
149
@PackageScope
135
150
Map<String , ServiceInfo > getServicesInfos () {
136
151
upTask. get(). servicesInfos
You can’t perform that action at this time.
0 commit comments