Skip to content

Commit

Permalink
feat: build services usage registered using Task.usesService() method
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Dec 21, 2023
1 parent d411339 commit 1695cb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ You could easily ensure that `docker compose up` is called before your tests but
# Usage
The plugin must be applied on project that contains `docker-compose.yml` file. It supposes that [Docker Engine](https://docs.docker.com/engine/) and [Docker Compose](https://docs.docker.com/compose/) are installed and available in `PATH`.

> Starting from plugin version _0.17.6_, Gradle 6.1 is required, because _Task.usesService()_ is used.
> Starting from plugin version _0.17.0_, _useDockerComposeV2_ property defaults to _true_, so the new `docker compose` (instead of deprecated `docker-compose` is used).
> Starting from plugin version _0.10.0_, Gradle 4.9 or newer is required (because it uses [Task Configuration Avoidance API](https://docs.gradle.org/current/userguide/task_configuration_avoidance.html)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ class TasksConfigurator {
})
task.dockerExecutor = composeSettings.dockerExecutor
task.finalizedBy(downForcedOnFailureTask)
task.usesService(composeExecutor)
task.usesService(serviceInfoCache)
}
this.buildTask = project.tasks.register(name ? "${name}ComposeBuild".toString() : 'composeBuild', ComposeBuild) {task ->
task.buildAdditionalArgs.set(composeSettings.buildAdditionalArgs)
task.startedServices.set(composeSettings.startedServices)
task.composeExecutor.set(composeExecutor)
task.usesService(composeExecutor)
}
this.pullTask = project.tasks.register(name ? "${name}ComposePull".toString() : 'composePull', ComposePull) {task ->
task.ignorePullFailure.set(composeSettings.ignorePullFailure)
Expand All @@ -81,15 +84,18 @@ class TasksConfigurator {
task.dependsOn(composeSettings.buildBeforePull.map { buildBeforePull ->
buildBeforePull ? [buildTask] : []
})
task.usesService(composeExecutor)
}
this.logsTask = project.tasks.register(name ? "${name}ComposeLogs".toString() : 'composeLogs', ComposeLogs) {task ->
task.containerLogToDir.set(composeSettings.containerLogToDir)
task.composeExecutor.set(composeExecutor)
task.usesService(composeExecutor)
}
this.pushTask = project.tasks.register(name ? "${name}ComposePush".toString() : 'composePush', ComposePush) {task ->
task.ignorePushFailure.set(composeSettings.ignorePushFailure)
task.pushServices.set(composeSettings.pushServices)
task.composeExecutor.set(composeExecutor)
task.usesService(composeExecutor)
}
}

Expand All @@ -108,6 +114,8 @@ class TasksConfigurator {
task.nestedName.set(composeSettings.nestedName)
task.composeExecutor.set(composeExecutor)
task.serviceInfoCache.set(serviceInfoCache)
task.usesService(composeExecutor)
task.usesService(serviceInfoCache)
}

@PackageScope
Expand Down

0 comments on commit 1695cb7

Please sign in to comment.