Skip to content

Commit

Permalink
Rename OCI_IMAGE_REFERENCE_ATTRIBUTE -> OCI_IMAGE_REFERENCE_SPECS_ATT…
Browse files Browse the repository at this point in the history
…RIBUTE
  • Loading branch information
SgtSilvio committed Jul 18, 2024
1 parent 6b88c72 commit 60a1911
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPlugin.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -27,7 +27,7 @@ class OciPlugin : Plugin<Project> {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package io.github.sgtsilvio.gradle.oci.attributes

import org.gradle.api.attributes.Attribute

internal val OCI_IMAGE_REFERENCE_ATTRIBUTE: Attribute<String> =
Attribute.of("io.github.sgtsilvio.gradle.oci.image.reference", String::class.java)
internal val OCI_IMAGE_REFERENCE_SPECS_ATTRIBUTE: Attribute<String> =
Attribute.of("io.github.sgtsilvio.gradle.oci.image.reference.specs", String::class.java)
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ 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
}

final override fun DependencySet.addInternal(dependencyProvider: Provider<out ModuleDependency>): 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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 60a1911

Please sign in to comment.