Skip to content

Commit 09a4de8

Browse files
fix(variant-artifacts): disambiguate Publisher and Resolver keys.
1 parent 625e29c commit 09a4de8

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

variant-artifacts/src/main/kotlin/com/autonomousapps/artifacts/Publisher.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ public class Publisher<T : Named>(
5454
artifactDescription: ArtifactDescription<*>,
5555
): Publisher<out Named> {
5656
val artifactName = artifactDescription.name.camelCase()
57-
return if (project.extensions.extraProperties.has(artifactName)) {
57+
val key = "$artifactName-publisher"
58+
return if (project.extensions.extraProperties.has(key)) {
5859
@Suppress("UNCHECKED_CAST")
59-
project.extensions.extraProperties[artifactName] as Publisher<Named>
60+
project.extensions.extraProperties[key] as Publisher<Named>
6061
} else {
6162
// Register new attribute with attribute schema
6263
val strategy = project.dependencies.attributesSchema.attribute(artifactDescription.attribute)
@@ -69,7 +70,7 @@ public class Publisher<T : Named>(
6970
attributeMatchingStrategy = strategy,
7071
).also {
7172
// memoize the value
72-
project.extensions.extraProperties[artifactName] = it
73+
project.extensions.extraProperties[key] = it
7374
}
7475
}
7576
}

variant-artifacts/src/main/kotlin/com/autonomousapps/artifacts/Resolver.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ public class Resolver<T : Named>(
5454
artifactDescription: ArtifactDescription<*>,
5555
): Resolver<out Named> {
5656
val artifactName = artifactDescription.name.camelCase()
57-
return if (project.extensions.extraProperties.has(artifactName)) {
57+
val key = "$artifactName-resolver"
58+
return if (project.extensions.extraProperties.has(key)) {
5859
@Suppress("UNCHECKED_CAST")
59-
project.extensions.extraProperties[artifactName] as Resolver<Named>
60+
project.extensions.extraProperties[key] as Resolver<Named>
6061
} else {
6162
// Register new attribute with attribute schema
6263
val strategy = project.dependencies.attributesSchema.attribute(artifactDescription.attribute)
@@ -69,7 +70,7 @@ public class Resolver<T : Named>(
6970
attributeMatchingStrategy = strategy,
7071
).also {
7172
// memoize the value
72-
project.extensions.extraProperties[artifactName] = it
73+
project.extensions.extraProperties[key] = it
7374
}
7475
}
7576
}

0 commit comments

Comments
 (0)