Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build services usage registered using Task.usesService() method #433

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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