Skip to content

Commit de0f75e

Browse files
committed
Inject repositoryPort instead of OciRegistriesImpl
1 parent 04a2b8e commit de0f75e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl/OciRegistriesImpl.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ internal abstract class OciRegistriesImpl @Inject constructor(
8383
private inline fun getOrCreateRegistry(name: String, init: OciRegistry.() -> Unit = {}): OciRegistry {
8484
var registry = list.findByName(name)
8585
if (registry == null) {
86-
registry = objectFactory.newInstance<OciRegistryImpl>(name, this, repositoryHandler, providerFactory)
86+
registry =
87+
objectFactory.newInstance<OciRegistryImpl>(name, repositoryPort, repositoryHandler, providerFactory)
8788
registry.init()
8889
list += registry
8990
}
@@ -100,7 +101,7 @@ internal abstract class OciRegistriesImpl @Inject constructor(
100101

101102
internal abstract class OciRegistryImpl @Inject constructor(
102103
private val name: String,
103-
registries: OciRegistriesImpl,
104+
repositoryPort: Provider<Int>,
104105
repositoryHandler: RepositoryHandler,
105106
objectFactory: ObjectFactory,
106107
private val providerFactory: ProviderFactory,
@@ -112,7 +113,7 @@ internal abstract class OciRegistryImpl @Inject constructor(
112113
final override val credentials = objectFactory.property<PasswordCredentials>()
113114
final override val repository = repositoryHandler.ivy {
114115
name = this@OciRegistryImpl.name + "OciRegistry"
115-
setUrl(finalUrl.zip(registries.repositoryPort) { url, repositoryPort ->
116+
setUrl(finalUrl.zip(repositoryPort) { url, repositoryPort ->
116117
val escapedUrl = url.toString().escapePathSegment()
117118
URI("http://localhost:$repositoryPort/$OCI_REPOSITORY_VERSION/$escapedUrl")
118119
})

0 commit comments

Comments
 (0)