File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed
main/kotlin/dev/codebandits/container/gradle
testFeatures/kotlin/dev/codebandits/container/gradle Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414### Chore
1515
1616- Improve image input/output API.
17+ - Groovy syntax accesses image input/output features on container extension.
1718
1819## [ 0.2.1] - 2025-04-23
1920
Original file line number Diff line number Diff line change @@ -6,6 +6,24 @@ import org.gradle.api.provider.Provider
66import java.net.URLEncoder
77import java.nio.charset.StandardCharsets
88
9+ public abstract class ContainerTaskExtension (private val task : Task ) {
10+ public fun inputLocalImage (imageReference : String ) {
11+ task.inputLocalImage(imageReference)
12+ }
13+
14+ public fun outputLocalImage (imageReference : String ) {
15+ task.outputLocalImage(imageReference)
16+ }
17+
18+ public fun inputRegistryImage (imageReference : String , autoRefresh : Boolean = false) {
19+ task.inputRegistryImage(imageReference, autoRefresh)
20+ }
21+
22+ public fun outputRegistryImage (imageReference : String , autoRefresh : Boolean = false) {
23+ task.outputRegistryImage(imageReference, autoRefresh)
24+ }
25+ }
26+
927public fun Task.inputLocalImage (
1028 imageReference : String ,
1129) {
Original file line number Diff line number Diff line change 11package dev.codebandits.container.gradle.plugin
22
3+ import dev.codebandits.container.gradle.image.ContainerTaskExtension
34import org.gradle.api.Plugin
45import org.gradle.api.Project
56
67public class ContainerPlugin : Plugin <Project > {
7- override fun apply (target : Project ) {}
8+ override fun apply (target : Project ) {
9+ target.tasks.all { task ->
10+ task.extensions.create(" container" , ContainerTaskExtension ::class .java, task)
11+ }
12+ }
813}
Original file line number Diff line number Diff line change @@ -26,14 +26,13 @@ class GroovySyntaxTest : GradleProjectTest() {
2626 buildGradleFile.appendLine(
2727 """
2828 import dev.codebandits.container.gradle.tasks.ContainerTask
29- import dev.codebandits.container.gradle.image.outputLocalImage
3029
3130 plugins {
3231 id("dev.codebandits.container")
3332 }
3433
3534 tasks.register("buildImage", ContainerTask) {
36- outputLocalImage("$imageReference ")
35+ container. outputLocalImage("$imageReference ")
3736 dockerPull { it.image.set("docker:dind") }
3837 dockerRun {
3938 it.image.set("docker:dind")
You can’t perform that action at this time.
0 commit comments