From 432a53fef2517d92d39838b6ef1fbdcafd23a146 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Thu, 18 Jul 2024 09:42:16 +0200 Subject: [PATCH] Cleanup OciImageReferenceSpec.kt --- .../oci/internal/resolution/OciImageSpecResolution.kt | 6 +++--- .../sgtsilvio/gradle/oci/metadata/OciImageReferenceSpec.kt | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) 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 44d24b16..8c9065be 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 @@ -4,7 +4,7 @@ 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.PLATFORM_ATTRIBUTE import io.github.sgtsilvio.gradle.oci.attributes.UNIVERSAL_PLATFORM_ATTRIBUTE_VALUE -import io.github.sgtsilvio.gradle.oci.metadata.DEFAULT_OCI_REFERENCE_SPEC +import io.github.sgtsilvio.gradle.oci.metadata.DEFAULT_OCI_IMAGE_REFERENCE_SPEC import io.github.sgtsilvio.gradle.oci.metadata.OciImageReferenceSpec import io.github.sgtsilvio.gradle.oci.metadata.toOciImageReferenceSpec import io.github.sgtsilvio.gradle.oci.platform.Platform @@ -40,7 +40,7 @@ private fun resolveOciVariantGraph( val referenceSpecs = dependencyResult.requested.attributes.getAttribute(OCI_IMAGE_REFERENCE_ATTRIBUTE) ?.split(',') ?.map { it.toOciImageReferenceSpec() } - ?: listOf(DEFAULT_OCI_REFERENCE_SPEC) + ?: listOf(DEFAULT_OCI_IMAGE_REFERENCE_SPEC) val node = resolveOciVariantNode(dependencyResult.selected, dependencyResult.resolvedVariant, nodes) rootNodesToReferenceSpecs.getOrPut(node) { HashSet() }.addAll(referenceSpecs) } @@ -189,4 +189,4 @@ private fun OciVariantNode.collectVariantResultsForPlatform( } private fun Set.normalize(): Set = - if ((size == 1) && contains(DEFAULT_OCI_REFERENCE_SPEC)) emptySet() else this + if ((size == 1) && contains(DEFAULT_OCI_IMAGE_REFERENCE_SPEC)) emptySet() else this diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciImageReferenceSpec.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciImageReferenceSpec.kt index f27b76fb..42281bf8 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciImageReferenceSpec.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciImageReferenceSpec.kt @@ -9,8 +9,7 @@ data class OciImageReferenceSpec(val name: String?, val tag: String?) : Serializ override fun toString() = (name ?: "") + ":" + (tag ?: "") } -// TODO factory method for OciImageReferenceSpec that returns DEFAULT_OCI_REFERENCE_SPEC if both are null -internal val DEFAULT_OCI_REFERENCE_SPEC = OciImageReferenceSpec(null, null) +internal val DEFAULT_OCI_IMAGE_REFERENCE_SPEC = OciImageReferenceSpec(null, null) internal fun OciImageReferenceSpec.materialize(default: OciImageReference) = OciImageReference(name ?: default.name, tag ?: default.tag)