From 4bd6b5bf21216c0c4de047f94249965345ee029d Mon Sep 17 00:00:00 2001 From: Silvio Giebl <gieblsilvio@outlook.com> Date: Sat, 21 Dec 2024 17:07:25 +0100 Subject: [PATCH] Improve layer createdBy convention --- .../oci/internal/dsl/OciImageDefinitionImpl.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/OciImageDefinitionImpl.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/OciImageDefinitionImpl.kt index c4fa3d43..07390457 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/OciImageDefinitionImpl.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/OciImageDefinitionImpl.kt @@ -350,13 +350,26 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( private val imageDefName: String, platform: Optional<Platform>, objectFactory: ObjectFactory, + providerFactory: ProviderFactory, private val taskContainer: TaskContainer, private val projectLayout: ProjectLayout, + project: Project, ) : OciImageDefinition.Variant.Layer { private val platform: Platform? = platform.orElse(null) final override val metadata = objectFactory.newInstance<OciImageDefinition.Variant.Layer.Metadata>().apply { - createdBy.convention("gradle-oci: $name") + createdBy.convention(providerFactory.provider { + buildString { + append("${project.group}:${project.name}:${project.version}") + if (imageDefName != MAIN_NAME) { + append(" > $imageDefName image") + } + if (name != MAIN_NAME) { + append(" > $name") + } + append(" (gradle-oci)") + } + }) } private var task: TaskProvider<DefaultOciLayerTask>? = null