Skip to content

Commit

Permalink
Add atomicfu-gradle-plugin to classpath and fix application
Browse files Browse the repository at this point in the history
Revert the name of the kotlinx-runtime-module in the resolution config
WA for broken atomicfu compiler plugin dependency in kotlin 1.7.0
(See: Kotlin/kotlinx-atomicfu#232)
  • Loading branch information
mvicsokolova authored and woainikk committed Nov 12, 2023
1 parent 262708b commit 487768c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
23 changes: 22 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ buildscript {
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}

dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${rootProject.properties["atomicfu_version"]}")
}
}

val releaseVersion: String? by extra
Expand Down Expand Up @@ -92,7 +96,6 @@ apply(from = "gradle/compatibility.gradle")
plugins {
id("org.jetbrains.dokka") version "1.9.10" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
id("kotlinx-atomicfu") version "0.22.0" apply false
id("com.osacky.doctor") version "0.9.0"
}

Expand Down Expand Up @@ -142,6 +145,24 @@ allprojects {
}
}

configurations.all {
if (name == "metadataCompileClasspath") return@all
resolutionStrategy.dependencySubstitution.all {
if (name == "metadataCompileClasspath") return@all
val requestedComponent = requested
if (requestedComponent is ModuleComponentSelector &&
requestedComponent.group == "org.jetbrains.kotlin" &&
requestedComponent.module == "atomicfu"
) {
if (name == "metadataCompileClasspath") return@all
useTarget(
"${requestedComponent.group}:kotlinx-atomicfu-runtime:$kotlinVersion",
"Using proper kotlinx-atomicfu-runtime instead of Gradle plugin"
)
}
}
}

kotlin {
if (!disabledExplicitApiModeProjects.contains(project.name)) explicitApi()

Expand Down
11 changes: 8 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoole
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")

maven("https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev")
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
maven("https://plugins.gradle.org/m2")
mavenLocal()
if (buildSnapshotTrain) {
mavenLocal()
}
Expand All @@ -28,7 +30,10 @@ configurations.configureEach {
if (isCanBeResolved) {
attributes {
@Suppress("UnstableApiUsage")
attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, project.objects.named(GradleVersion.current().version))
attribute(
GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE,
project.objects.named(GradleVersion.current().version)
)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pluginManagement {
repositories {
maven("https://plugins.gradle.org/m2")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
mavenCentral()
if (build_snapshot_train?.toBoolean() == true) {
mavenLocal()
}
Expand Down
7 changes: 0 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ pluginManagement {
google()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "kotlinx-atomicfu") {
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
}
}
}
}

plugins {
Expand Down

0 comments on commit 487768c

Please sign in to comment.