From 60a19113fe179ff0753bcbe509618f6886d3fa7f Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Thu, 18 Jul 2024 11:49:07 +0200 Subject: [PATCH] Rename OCI_IMAGE_REFERENCE_ATTRIBUTE -> OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE --- src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt | 4 ++-- .../gradle/oci/attributes/OciImageReferenceAttribute.kt | 4 ++-- .../oci/internal/dsl/ResolvableOciImageDependenciesImpl.kt | 4 ++-- .../oci/internal/resolution/OciImageSpecResolution.kt | 6 +++--- 4 files changed, 9 insertions(+), 9 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 27aa2d02..7effc1a8 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt @@ -1,7 +1,7 @@ package io.github.sgtsilvio.gradle.oci import io.github.sgtsilvio.gradle.oci.attributes.DISTRIBUTION_TYPE_ATTRIBUTE -import io.github.sgtsilvio.gradle.oci.attributes.OCI_IMAGE_REFERENCE_ATTRIBUTE +import io.github.sgtsilvio.gradle.oci.attributes.OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE import io.github.sgtsilvio.gradle.oci.attributes.PLATFORM_ATTRIBUTE import io.github.sgtsilvio.gradle.oci.attributes.PlatformAttributeCompatibilityRule import io.github.sgtsilvio.gradle.oci.dsl.OciExtension @@ -27,7 +27,7 @@ class OciPlugin : Plugin { attribute(DISTRIBUTION_TYPE_ATTRIBUTE) attribute(PLATFORM_ATTRIBUTE) getMatchingStrategy(PLATFORM_ATTRIBUTE).compatibilityRules.add(PlatformAttributeCompatibilityRule::class) - attribute(OCI_IMAGE_REFERENCE_ATTRIBUTE) + attribute(OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE) } val extension = project.extensions.create(OciExtension::class, EXTENSION_NAME, OciExtensionImpl::class) registerPushTasks(project, extension) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/attributes/OciImageReferenceAttribute.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/attributes/OciImageReferenceAttribute.kt index 0e2bd08a..5c96d6b1 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/attributes/OciImageReferenceAttribute.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/attributes/OciImageReferenceAttribute.kt @@ -2,5 +2,5 @@ package io.github.sgtsilvio.gradle.oci.attributes import org.gradle.api.attributes.Attribute -internal val OCI_IMAGE_REFERENCE_ATTRIBUTE: Attribute = - Attribute.of("io.github.sgtsilvio.gradle.oci.image.reference", String::class.java) +internal val OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE: Attribute = + Attribute.of("io.github.sgtsilvio.gradle.oci.image.reference.specs", String::class.java) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/ResolvableOciImageDependenciesImpl.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/ResolvableOciImageDependenciesImpl.kt index 50a3f1ee..d3bd7d6f 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/ResolvableOciImageDependenciesImpl.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/ResolvableOciImageDependenciesImpl.kt @@ -48,7 +48,7 @@ internal abstract class ResolvableOciImageDependenciesImpl @Inject constructor( final override fun DependencySet.addInternal(dependency: ModuleDependency): ReferenceSpecBuilder { val referenceSpecBuilder = ReferenceSpecBuilder(objectFactory) addLater(referenceSpecBuilder.attribute.map { attribute -> - dependency.attribute(OCI_IMAGE_REFERENCE_ATTRIBUTE, attribute) + dependency.attribute(OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE, attribute) }) return referenceSpecBuilder } @@ -56,7 +56,7 @@ internal abstract class ResolvableOciImageDependenciesImpl @Inject constructor( final override fun DependencySet.addInternal(dependencyProvider: Provider): ReferenceSpecBuilder { val referenceSpecBuilder = ReferenceSpecBuilder(objectFactory) addLater(dependencyProvider.zip(referenceSpecBuilder.attribute) { dependency, attribute -> - dependency.attribute(OCI_IMAGE_REFERENCE_ATTRIBUTE, attribute) + dependency.attribute(OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE, attribute) }) return referenceSpecBuilder } diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/resolution/OciImageSpecResolution.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/resolution/OciImageSpecResolution.kt index 8e1e848a..255e5d03 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/resolution/OciImageSpecResolution.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/resolution/OciImageSpecResolution.kt @@ -1,7 +1,7 @@ package io.github.sgtsilvio.gradle.oci.internal.resolution import io.github.sgtsilvio.gradle.oci.attributes.MULTI_PLATFORM_ATTRIBUTE_VALUE -import io.github.sgtsilvio.gradle.oci.attributes.OCI_IMAGE_REFERENCE_ATTRIBUTE +import io.github.sgtsilvio.gradle.oci.attributes.OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE import io.github.sgtsilvio.gradle.oci.attributes.PLATFORM_ATTRIBUTE import io.github.sgtsilvio.gradle.oci.attributes.UNIVERSAL_PLATFORM_ATTRIBUTE_VALUE import io.github.sgtsilvio.gradle.oci.metadata.DEFAULT_OCI_IMAGE_REFERENCE_SPEC @@ -37,11 +37,11 @@ private fun resolveOciVariantGraph( if ((dependencyResult !is ResolvedDependencyResult) || dependencyResult.isConstraint) { continue } - val referenceSpecs = dependencyResult.requested.attributes.getAttribute(OCI_IMAGE_REFERENCE_ATTRIBUTE) + val node = resolveOciVariantNode(dependencyResult.selected, dependencyResult.resolvedVariant, nodes) + val referenceSpecs = dependencyResult.requested.attributes.getAttribute(OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE) ?.split(',') ?.map { it.toOciImageReferenceSpec() } ?: listOf(DEFAULT_OCI_IMAGE_REFERENCE_SPEC) - val node = resolveOciVariantNode(dependencyResult.selected, dependencyResult.resolvedVariant, nodes) rootNodesToReferenceSpecs.getOrPut(node) { HashSet() }.addAll(referenceSpecs) } return rootNodesToReferenceSpecs