Skip to content

Commit

Permalink
isRequiredBy overload accepting TaskProvider instead of Task Fixes #208
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Nov 18, 2019
1 parent 951286f commit f31fe91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ class ComposeSettings {
if (task instanceof JavaForkOptions) task.doFirst { exposeAsSystemProperties(task as JavaForkOptions) }
}

void isRequiredBy(TaskProvider<Task> taskProvider) {
taskProvider.configure { isRequiredBy(it) }
}

Map<String, ServiceInfo> getServicesInfos() {
upTask.get().servicesInfos
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ class DockerComposePluginTest extends Specification {
task.getFinalizedBy().getDependencies(task).any { it == project.tasks.composeDown }
}

def "isRequiredBy() adds dependencies when using TaskProvider"() {
def project = ProjectBuilder.builder().build()
project.plugins.apply 'docker-compose'
TaskProvider<Task> taskProvider = project.tasks.register('integrationTest')
when:
project.dockerCompose.isRequiredBy(taskProvider)
Task task = taskProvider.get()
then:
task.dependsOn.find { it instanceof TaskProvider && ((TaskProvider)it).get() == project.tasks.composeUp }
task.getFinalizedBy().getDependencies(task).any { it == project.tasks.composeDown }
}

def "isRequiredBy() adds dependencies for nested settings"() {
def project = ProjectBuilder.builder().build()
project.plugins.apply 'docker-compose'
Expand Down

0 comments on commit f31fe91

Please sign in to comment.