Skip to content

Commit

Permalink
Only replace configuration-annotations for the linker configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
TadeasKriz committed Sep 13, 2024
1 parent e20d460 commit ea66ad0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
8 changes: 0 additions & 8 deletions SKIE/common/configuration/annotations/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ publishing {
}
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
freeCompilerArgs.addAll(
"-module-name", "configuration-annotations",
)
}
}

tasks.withType<KotlinNativeCompile>().configureEach {
compilerOptions {
freeCompilerArgs.addAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ import org.gradle.api.artifacts.component.ModuleComponentSelector

fun Project.configureSkieConfigurationAnnotationsDependencySubstitution() {
val configurationAnnotationsRegex = "${Regex.escape(BuildConfig.SKIE_CONFIGURATION_ANNOTATIONS_MODULE)}(?:-[0-9]+\\.[0-9]+\\.[0-9]+)?(-.+)?".toRegex()
configurations.configureEach {
if (state != Configuration.State.UNRESOLVED) {
return@configureEach
}
skieInternalExtension.targets.configureEach {
linkerConfiguration.apply {
if (state != Configuration.State.UNRESOLVED) {
return@configureEach
}

resolutionStrategy {
dependencySubstitution {
all {
val requestedModule = requested as? ModuleComponentSelector ?: return@all
val match = configurationAnnotationsRegex.matchEntire(requestedModule.moduleIdentifier.toString())
if (match != null) {
val suffix = match.groupValues[1]
resolutionStrategy {
dependencySubstitution {
all {
val requestedModule = requested as? ModuleComponentSelector ?: return@all
val match = configurationAnnotationsRegex.matchEntire(requestedModule.moduleIdentifier.toString())
if (match != null) {
val suffix = match.groupValues[1]

val updatedCoordinate = BuildConfig.SKIE_CONFIGURATION_ANNOTATIONS_MODULE + "-" + skieInternalExtension.kotlinVersion + suffix + ":" + BuildConfig.SKIE_VERSION
val updatedCoordinate = BuildConfig.SKIE_CONFIGURATION_ANNOTATIONS_MODULE + "-" + skieInternalExtension.kotlinVersion + suffix + ":" + BuildConfig.SKIE_VERSION

logger.debug("Replacing {} with {}", requested, updatedCoordinate)
useTarget(updatedCoordinate)
logger.debug("Replacing {} with {}", requested, updatedCoordinate)
useTarget(updatedCoordinate)
}
}
}
}
Expand Down

0 comments on commit ea66ad0

Please sign in to comment.