From c1305b4fda6d875b0fa15d89e02ff6084aba28d6 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Wed, 18 Dec 2024 23:54:04 +0100 Subject: [PATCH] Split LoadOciImageTask from LoadOciImagesTask --- .../kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt | 4 ++-- .../sgtsilvio/gradle/oci/image/LoadOciImagesTask.kt | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt index 3e69ea0b..16bbb19e 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt @@ -3,7 +3,7 @@ package io.github.sgtsilvio.gradle.oci import io.github.sgtsilvio.gradle.oci.attributes.* import io.github.sgtsilvio.gradle.oci.dsl.OciExtension import io.github.sgtsilvio.gradle.oci.dsl.OciImageDefinition -import io.github.sgtsilvio.gradle.oci.image.LoadOciImagesTask +import io.github.sgtsilvio.gradle.oci.image.LoadOciImageTask import io.github.sgtsilvio.gradle.oci.image.PushOciImageTask import io.github.sgtsilvio.gradle.oci.internal.dsl.OciExtensionImpl import io.github.sgtsilvio.gradle.oci.internal.mainToEmpty @@ -54,7 +54,7 @@ class OciPlugin : Plugin { private fun registerLoadTask(imageDefinition: OciImageDefinition, project: Project, extension: OciExtension) { val loadName = "load".concatCamelCase(imageDefinition.name.mainToEmpty()) - project.tasks.register(loadName.concatCamelCase("ociImage")) { + project.tasks.register(loadName.concatCamelCase("ociImage")) { group = TASK_GROUP_NAME description = "Loads the '${imageDefinition.name}' OCI image to the Docker daemon." from(extension.imageDependencies.create(loadName).apply { diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/image/LoadOciImagesTask.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/image/LoadOciImagesTask.kt index a7563568..d79c4f23 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/image/LoadOciImagesTask.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/image/LoadOciImagesTask.kt @@ -19,7 +19,7 @@ import javax.inject.Inject /** * @author Silvio Giebl */ -@DisableCachingByDefault(because = "Pulling to a Docker daemon") +@DisableCachingByDefault(because = "Loading to an external Docker daemon") abstract class LoadOciImagesTask @Inject constructor(private val execOperations: ExecOperations) : OciImagesTask() { final override fun run( @@ -60,8 +60,12 @@ abstract class LoadOciImagesTask @Inject constructor(private val execOperations: } registryDataDirectory.toFile().deleteRecursively() } +} - // TODO Single task +@DisableCachingByDefault(because = "Loading to an external Docker daemon") +abstract class LoadOciImageTask @Inject constructor( + execOperations: ExecOperations +) : LoadOciImagesTask(execOperations) { @get:Internal @get:Option(