Skip to content

Commit

Permalink
Expose OciImageDefinition.configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed May 26, 2024
1 parent 683ebc6 commit f32583c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -19,6 +20,8 @@ interface OciImageDefinition : Named {
val imageTag: Property<String>
val capabilities: Capabilities
val indexAnnotations: MapProperty<String, String>

val configuration: Configuration
val component: Provider<OciComponent>
val dependency: Provider<ProjectDependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> =
objectFactory.property<String>().convention(providerFactory.provider {
defaultMappedImageNamespace(project.group.toString()) + project.name
Expand All @@ -58,7 +58,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor(
objectFactory.property<String>().convention(providerFactory.provider {
project.version.toString().concatKebabCase(name.mainToEmpty().kebabCase())
})
final override val capabilities = objectFactory.newInstance<Capabilities>(imageConfiguration.outgoing, name)
final override val capabilities = objectFactory.newInstance<Capabilities>(configuration.outgoing, name)
private val bundles = objectFactory.domainObjectSet(Bundle::class)
private var allPlatformBundleScope: BundleScope? = null
private var platformBundleScopes: HashMap<PlatformFilter, BundleScope>? = null
Expand Down Expand Up @@ -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<String, TaskProvider<OciLayerTask>>()
getBundleOrPlatformBundles().collectLayerTasks(layerTasks)
listOf(LazyPublishArtifact(objectFactory).apply {
Expand Down Expand Up @@ -200,7 +200,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor(
}
var bundle = platformBundles[platform]
if (bundle == null) {
bundle = objectFactory.newInstance<Bundle>(name, imageConfiguration, Optional.of(platform))
bundle = objectFactory.newInstance<Bundle>(name, configuration, Optional.of(platform))
bundles.add(bundle)
platformBundles[platform] = bundle
}
Expand All @@ -214,7 +214,7 @@ internal abstract class OciImageDefinitionImpl @Inject constructor(
}
var universalBundle = universalBundle
if (universalBundle == null) {
universalBundle = objectFactory.newInstance<Bundle>(name, imageConfiguration, Optional.empty<Platform>())
universalBundle = objectFactory.newInstance<Bundle>(name, configuration, Optional.empty<Platform>())
bundles.add(universalBundle)
this.universalBundle = universalBundle
}
Expand Down

0 comments on commit f32583c

Please sign in to comment.