diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/dsl/OciImageDefinition.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/dsl/OciImageDefinition.kt index d3438a2e..f3455628 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/dsl/OciImageDefinition.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/dsl/OciImageDefinition.kt @@ -8,6 +8,7 @@ import io.github.sgtsilvio.gradle.oci.platform.PlatformFilter import org.gradle.api.Action import org.gradle.api.Named import org.gradle.api.NamedDomainObjectList +import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.capabilities.Capability import org.gradle.api.provider.* @@ -19,6 +20,8 @@ interface OciImageDefinition : Named { val imageTag: Property val capabilities: Capabilities val indexAnnotations: MapProperty + + val configuration: Configuration val component: Provider val dependency: Provider 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 175227c9..2256524a 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 @@ -49,7 +49,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( private val project: Project, ) : OciImageDefinition { - private val imageConfiguration = createConfiguration(configurationContainer, name, objectFactory) + final override val configuration = createConfiguration(configurationContainer, name, objectFactory) final override val imageName: Property = objectFactory.property().convention(providerFactory.provider { defaultMappedImageNamespace(project.group.toString()) + project.name @@ -58,7 +58,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( objectFactory.property().convention(providerFactory.provider { project.version.toString().concatKebabCase(name.mainToEmpty().kebabCase()) }) - final override val capabilities = objectFactory.newInstance(imageConfiguration.outgoing, name) + final override val capabilities = objectFactory.newInstance(configuration.outgoing, name) private val bundles = objectFactory.domainObjectSet(Bundle::class) private var allPlatformBundleScope: BundleScope? = null private var platformBundleScopes: HashMap? = null @@ -130,7 +130,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( } private fun registerArtifacts(objectFactory: ObjectFactory, providerFactory: ProviderFactory) { - imageConfiguration.outgoing.addArtifacts(providerFactory.provider { + configuration.outgoing.addArtifacts(providerFactory.provider { val layerTasks = LinkedHashMap>() getBundleOrPlatformBundles().collectLayerTasks(layerTasks) listOf(LazyPublishArtifact(objectFactory).apply { @@ -200,7 +200,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( } var bundle = platformBundles[platform] if (bundle == null) { - bundle = objectFactory.newInstance(name, imageConfiguration, Optional.of(platform)) + bundle = objectFactory.newInstance(name, configuration, Optional.of(platform)) bundles.add(bundle) platformBundles[platform] = bundle } @@ -214,7 +214,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor( } var universalBundle = universalBundle if (universalBundle == null) { - universalBundle = objectFactory.newInstance(name, imageConfiguration, Optional.empty()) + universalBundle = objectFactory.newInstance(name, configuration, Optional.empty()) bundles.add(universalBundle) this.universalBundle = universalBundle }