Skip to content

Commit c4a7e8e

Browse files
authored
feat: isRequiredBy changed in order not to break configuration avoidance (#356)
1 parent a3a9e1d commit c4a7e8e

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/groovy/com/avast/gradle/dockercompose/TasksConfigurator.groovy

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,11 @@ class TasksConfigurator {
114114
void isRequiredByCore(Task task, boolean fromConfigure) {
115115
task.dependsOn upTask
116116
task.finalizedBy downTask
117-
project.tasks.findAll { Task.class.isAssignableFrom(it.class) && ((Task) it).name.toLowerCase().contains('classes') }
118-
.each { classesTask ->
119-
if (fromConfigure) {
120-
upTask.get().shouldRunAfter classesTask
121-
} else {
122-
upTask.configure { it.shouldRunAfter classesTask }
123-
}
124-
}
117+
if (fromConfigure) {
118+
upTask.get().shouldRunAfter task.taskDependencies
119+
} else {
120+
upTask.configure { it.shouldRunAfter task.taskDependencies }
121+
}
125122
if (task instanceof ProcessForkOptions) task.doFirst { composeSettings.exposeAsEnvironment(task as ProcessForkOptions) }
126123
if (task instanceof JavaForkOptions) task.doFirst { composeSettings.exposeAsSystemProperties(task as JavaForkOptions) }
127124
}

src/test/groovy/com/avast/gradle/dockercompose/DockerComposePluginTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class DockerComposePluginTest extends Specification {
198198
when:
199199
project.dockerCompose.isRequiredBy(project.tasks.test)
200200
then:
201-
project.tasks.composeUp.shouldRunAfter.mutableValues.any { it == project.tasks.testClasses }
201+
project.tasks.composeUp.shouldRunAfter.getDependencies(null).any { it == project.tasks.testClasses }
202202
noExceptionThrown()
203203
}
204204

0 commit comments

Comments
 (0)