From bab01b53993c100f65e703cd38189c1153123de6 Mon Sep 17 00:00:00 2001 From: Clayton Walker Date: Mon, 22 Jan 2024 18:15:39 -0700 Subject: [PATCH] Leave setters as-is --- .../cloud/tools/jib/gradle/BuildDockerTask.java | 8 +++++++- .../google/cloud/tools/jib/gradle/BuildImageTask.java | 8 +++++++- .../google/cloud/tools/jib/gradle/BuildTarTask.java | 8 +++++++- .../com/google/cloud/tools/jib/gradle/JibTask.java | 11 ++++++++++- .../cloud/tools/jib/gradle/skaffold/FilesTaskV2.java | 7 ++++++- .../cloud/tools/jib/gradle/skaffold/InitTask.java | 7 ++++++- .../cloud/tools/jib/gradle/skaffold/SyncMapTask.java | 7 ++++++- 7 files changed, 49 insertions(+), 7 deletions(-) diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java index da33a401e42..a126984b650 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java @@ -52,7 +52,7 @@ public class BuildDockerTask extends DefaultTask implements JibTask { private static final String HELPFUL_SUGGESTIONS_PREFIX = "Build to Docker daemon failed"; - private final JibExtension jibExtension; + private JibExtension jibExtension; /** * This will call the property {@code "jib"} so that it is the same name as the extension. This @@ -193,4 +193,10 @@ public void buildDocker() projectProperties.waitForLoggingThread(); } } + + @Override + public BuildDockerTask setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } } diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java index 7dea81ed97c..b940970d8ec 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java @@ -51,7 +51,7 @@ public class BuildImageTask extends DefaultTask implements JibTask { private static final String HELPFUL_SUGGESTIONS_PREFIX = "Build image failed"; - private final JibExtension jibExtension; + private JibExtension jibExtension; /** * This will call the property {@code "jib"} so that it is the same name as the extension. This @@ -188,4 +188,10 @@ public void buildImage() projectProperties.waitForLoggingThread(); } } + + @Override + public BuildImageTask setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } } diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java index e1f6f0355d8..d1d6aac6b6a 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java @@ -56,7 +56,7 @@ public class BuildTarTask extends DefaultTask implements JibTask { private static final String HELPFUL_SUGGESTIONS_PREFIX = "Building image tarball failed"; - private final JibExtension jibExtension; + private JibExtension jibExtension; /** * This will call the property {@code "jib"} so that it is the same name as the extension. This @@ -210,4 +210,10 @@ public void buildTar() projectProperties.waitForLoggingThread(); } } + + @Override + public BuildTarTask setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } } diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibTask.java index bc1432625b4..68b55d32837 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibTask.java @@ -19,4 +19,13 @@ import org.gradle.api.Task; /** A task with a {@link JibExtension}. */ -public interface JibTask extends Task {} +public interface JibTask extends Task { + + /** + * Sets the task's {@link JibExtension}. + * + * @param jibExtension the {@link JibExtension} + * @return this + */ + Task setJibExtension(JibExtension jibExtension); +} diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java index f4adb1cd109..9df880ad909 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java @@ -51,13 +51,18 @@ public class FilesTaskV2 extends DefaultTask { private final SkaffoldFilesOutput skaffoldFilesOutput = new SkaffoldFilesOutput(); - private final JibExtension jibExtension; + private JibExtension jibExtension; @Inject public FilesTaskV2(JibExtension jibExtension) { this.jibExtension = jibExtension; } + public FilesTaskV2 setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } + /** * Task Action, print files. * diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/InitTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/InitTask.java index 31bd215a457..4a626f2b570 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/InitTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/InitTask.java @@ -31,13 +31,18 @@ */ public class InitTask extends DefaultTask { - private final JibExtension jibExtension; + private JibExtension jibExtension; @Inject public InitTask(JibExtension jibExtension) { this.jibExtension = jibExtension; } + public InitTask setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } + /** * Task Action, lists modules and targets. * diff --git a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SyncMapTask.java b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SyncMapTask.java index 185aa87c9aa..b64fd39c534 100644 --- a/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SyncMapTask.java +++ b/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SyncMapTask.java @@ -36,13 +36,18 @@ */ public class SyncMapTask extends DefaultTask { - private final JibExtension jibExtension; + private JibExtension jibExtension; @Inject public SyncMapTask(JibExtension jibExtension) { this.jibExtension = jibExtension; } + public SyncMapTask setJibExtension(JibExtension jibExtension) { + this.jibExtension = jibExtension; + return this; + } + /** Task Action, lists files and container targets. */ @TaskAction public void listFilesAndTargets() {