diff --git a/README.md b/README.md
index 104c60cf..4feccca7 100644
--- a/README.md
+++ b/README.md
@@ -107,10 +107,15 @@ operations. They can be also atomically modified via `+=` and `-=` operators.
Gradle configuration is supported for all platforms, minimal version is Gradle 6.8.
-In top-level build file:
+To apply kotlinx-atomicfu plugin, you need to add 2 dependencies to the project classpath:
+1. `atomicfu-gradle-plugin`: it provides the necessary library dependencies and manages transformation modes.
+2. `atomicfu` compiler plugin: the compiler plugin is used to perform IR transformations (see [Atomicfu compiler plugin](#atomicfu-compiler-plugin) section).
+
+> Note: kotlinx-atomicfu gradle plugin does not have an id and is not currently published to the Gradle Plugin Portal.
+> Therefore, the only available method for application is through the buildscript specification.
-Kotlin
+Kotlin DSL
```kotlin
buildscript {
@@ -120,6 +125,9 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.23.1")
+ // Please note that the Kotlin version specified for the atomicfu compiler plugin
+ // should match the Kotlin version used in your project.
+ classpath("org.jetbrains.kotlin:atomicfu:$kotlin_version")
}
}
@@ -128,7 +136,7 @@ apply(plugin = "kotlinx-atomicfu")
-Groovy
+Groovy DSL
```groovy
buildscript {
@@ -137,6 +145,9 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.23.1'
+ // Please note that the Kotlin version specified for the atomicfu compiler plugin
+ // should match the Kotlin version used in your project.
+ classpath 'org.jetbrains.kotlin:atomicfu:$kotlin_version'
}
}
diff --git a/atomicfu-gradle-plugin/build.gradle b/atomicfu-gradle-plugin/build.gradle
index 4c43f934..1313f499 100644
--- a/atomicfu-gradle-plugin/build.gradle
+++ b/atomicfu-gradle-plugin/build.gradle
@@ -23,7 +23,7 @@ dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Atomicfu compiler plugin dependency will be loaded to kotlinCompilerPluginClasspath
// Atomicfu plugin will only be applied if the flag is set kotlinx.atomicfu.enableJsIrTransformation=true
- implementation "org.jetbrains.kotlin:atomicfu:$kotlin_version"
+ compileOnly "org.jetbrains.kotlin:atomicfu:$kotlin_version"
testImplementation gradleTestKit()
testImplementation 'org.jetbrains.kotlin:kotlin-test'
diff --git a/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt b/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
index 3d2b933c..a9fd6b3c 100644
--- a/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
+++ b/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
@@ -45,12 +45,42 @@ open class AtomicFUGradlePlugin : Plugin {
val pluginVersion = rootProject.buildscript.configurations.findByName("classpath")
?.allDependencies?.find { it.name == "atomicfu-gradle-plugin" }?.version
extensions.add(EXTENSION_NAME, AtomicFUPluginExtension(pluginVersion))
+ checkClasspathForAtomicfuCompilerPlugin(pluginVersion)
applyAtomicfuCompilerPlugin()
configureDependencies()
configureTasks()
}
}
+private fun Project.checkClasspathForAtomicfuCompilerPlugin(pluginVersion: String?) {
+ val kotlinVersion = getKotlinPluginVersion()
+ rootProject.buildscript.configurations.findByName("classpath")
+ ?.allDependencies?.find { it.group == "org.jetbrains.kotlin" && it.name == "atomicfu" }?.let {
+ require(it.version == kotlinVersion) {
+ "Please ensure that the Kotlin version specified for the atomicfu compiler plugin matches the Kotlin version used in your project. \n" +
+ "You should use this dependency in your classpath: classpath(\"org.jetbrains.kotlin:atomicfu:$kotlinVersion\")\n\n" +
+ "For details about plugin application, please refer to the README section at: https://github.com/Kotlin/kotlinx-atomicfu/blob/master/README.md#apply-plugin"
+ }
+ }
+ ?: error("Please add a dependency to the atomicfu compiler plugin in the buildscript classpath configuration, " +
+ "in addition to the atomicfu-gradle-plugin dependency:\n" +
+ "```\n" +
+ "buildscript {\n" +
+ " repositories {\n" +
+ " mavenCentral() \n" +
+ " }\n" +
+ "\n" +
+ " dependencies {\n" +
+ " classpath(\"org.jetbrains.kotlinx:atomicfu-gradle-plugin:$pluginVersion\")\n" +
+ " classpath(\"org.jetbrains.kotlin:atomicfu:$kotlinVersion\")\n" +
+ " }\n" +
+ "}\n\n" +
+ "apply(plugin = \"kotlinx-atomicfu\")\n" +
+ "```\n\n" +
+ "For details about plugin application, please refer to the README section at: https://github.com/Kotlin/kotlinx-atomicfu/blob/master/README.md#apply-plugin"
+ )
+}
+
private fun Project.checkCompatibility() {
val currentGradleVersion = GradleVersion.current()
val kotlinVersion = getKotlinVersion()
@@ -204,8 +234,6 @@ private fun Project.addJsCompilerPluginRuntimeDependency() {
if (getKotlinVersion().atLeast(1, 7, 10)) {
// since Kotlin 1.7.10 `kotlinx-atomicfu-runtime` is published and should be added directly
implementation("org.jetbrains.kotlin:kotlinx-atomicfu-runtime:${getKotlinPluginVersion()}")
- } else {
- implementation("org.jetbrains.kotlin:atomicfu:${getKotlinPluginVersion()}")
}
}
}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/Assert.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/Assert.kt
deleted file mode 100644
index 191dbac0..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/Assert.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2016-2022 JetBrains s.r.o.
- * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
- */
-
-package kotlinx.atomicfu.plugin.gradle.internal
-
-import org.gradle.testkit.runner.BuildResult
-import org.gradle.testkit.runner.TaskOutcome
-import kotlin.test.assertEquals
-
-/**
- * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.SUCCESS]
- */
-internal fun BuildResult.assertTaskSuccess(task: String) {
- assertTaskOutcome(TaskOutcome.SUCCESS, task)
-}
-
-/**
- * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.FAILED]
- */
-internal fun BuildResult.assertTaskFailure(task: String) {
- assertTaskOutcome(TaskOutcome.FAILED, task)
-}
-
-internal fun BuildResult.assertTaskUpToDate(task: String) {
- assertTaskOutcome(TaskOutcome.UP_TO_DATE, task)
-}
-
-private fun BuildResult.assertTaskOutcome(taskOutcome: TaskOutcome, taskName: String) {
- assertEquals(
- taskOutcome,
- task(taskName)?.outcome,
- "Task $taskName does not have ${taskOutcome.name} outcome"
- )
-}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/TestDsl.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/TestDsl.kt
deleted file mode 100644
index ed11b10e..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/TestDsl.kt
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 2016-2022 JetBrains s.r.o.
- * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
- */
-
-package kotlinx.atomicfu.plugin.gradle.internal
-
-import kotlinx.atomicfu.plugin.gradle.test.*
-import org.gradle.testkit.runner.*
-import java.io.*
-
-internal fun BaseKotlinGradleTest.test(fn: BaseKotlinScope.() -> Unit): GradleRunner {
- val baseKotlinScope = BaseKotlinScope()
- fn(baseKotlinScope)
-
- baseKotlinScope.files.forEach { scope ->
- val fileWriteTo = rootProjectDir.resolve(scope.filePath)
- .apply {
- parentFile.mkdirs()
- createNewFile()
- }
-
- scope.files.forEach {
- val fileContent = readFileList(it)
- fileWriteTo.appendText(fileContent)
- }
- }
-
- return GradleRunner.create()
- .withProjectDir(rootProjectDir)
- .withArguments(baseKotlinScope.runner.arguments)
- .withPluginClasspath()
- .addPluginTestRuntimeClasspath()
-}
-
-/**
- * same as [file][FileContainer.file], but prepends "src/${sourceSet}/kotlin" before given `classFileName`
- */
-internal fun FileContainer.kotlin(classFileName: String, sourceSet: String = "main", fn: AppendableScope.() -> Unit) {
- require(classFileName.endsWith(".kt")) {
- "ClassFileName must end with '.kt'"
- }
-
- val fileName = "src/${sourceSet}/kotlin/$classFileName"
- file(fileName, fn)
-}
-
-/**
- * Shortcut for creating a `build.gradle.kts` by using [file][FileContainer.file]
- */
-internal fun FileContainer.buildGradleKts(fn: AppendableScope.() -> Unit) {
- val fileName = "build.gradle.kts"
- file(fileName, fn)
-}
-
-/**
- * Shortcut for creating a `settings.gradle.kts` by using [file][FileContainer.file]
- */
-internal fun FileContainer.settingsGradleKts(fn: AppendableScope.() -> Unit) {
- val fileName = "settings.gradle.kts"
- file(fileName, fn)
-}
-
-/**
- * Shortcut for creating a `gradle.properties` by using [file][FileContainer.file]
- */
-internal fun FileContainer.gradleProperties(fn: AppendableScope.() -> Unit) {
- val fileName = "gradle.properties"
- file(fileName, fn)
-}
-
-/**
- * Declares a directory with the given [dirName] inside the current container.
- * All calls creating files within this scope will create the files nested in this directory.
- *
- * Note that it is valid to call this method multiple times at the same level with the same [dirName].
- * Files declared within 2 independent calls to [dir] will be added to the same directory.
- */
-internal fun FileContainer.dir(dirName: String, fn: DirectoryScope.() -> Unit) {
- DirectoryScope(dirName, this).fn()
-}
-
-internal fun BaseKotlinScope.runner(fn: Runner.() -> Unit) {
- val runner = Runner()
- fn(runner)
-
- this.runner = runner
-}
-
-internal fun AppendableScope.resolve(fileName: String) {
- this.files.add(fileName)
-}
-
-internal interface FileContainer {
- fun file(fileName: String, fn: AppendableScope.() -> Unit)
-}
-
-internal class BaseKotlinScope : FileContainer {
- var files: MutableList = mutableListOf()
- var runner: Runner = Runner()
-
- override fun file(fileName: String, fn: AppendableScope.() -> Unit) {
- val appendableScope = AppendableScope(fileName)
- fn(appendableScope)
- files.add(appendableScope)
- }
-}
-
-internal class DirectoryScope(
- val dirPath: String,
- val parent: FileContainer
-): FileContainer {
-
- override fun file(fileName: String, fn: AppendableScope.() -> Unit) {
- parent.file("$dirPath/$fileName", fn)
- }
-}
-
-internal class AppendableScope(val filePath: String) {
- val files: MutableList = mutableListOf()
-}
-
-internal class Runner {
- val arguments: MutableList = mutableListOf()
-}
-
-internal fun readFileList(fileName: String): String =
- getFile(fileName).readText()
-
-internal fun getFileOrNull(fileName: String): File? {
- return BaseKotlinGradleTest::class.java.classLoader.getResource(fileName)?.let {
- resource -> File(resource.toURI())
- }
-}
-
-internal fun getFile(fileName: String): File {
- val resource = BaseKotlinGradleTest::class.java.classLoader.getResource(fileName)
- ?: throw IllegalStateException("Could not find resource '$fileName'")
- return File(resource.toURI())
-}
-
-internal fun GradleRunner.addPluginTestRuntimeClasspath() = apply {
- val pluginClasspath = getFile("plugin-classpath.txt").readLines().map { File(it) }
- withPluginClasspath(pluginClasspath)
-}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/utils.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/utils.kt
deleted file mode 100644
index 49856f2f..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/internal/utils.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package kotlinx.atomicfu.plugin.gradle.internal
-
-import java.io.*
-import kotlin.test.*
-
-fun File.checkExists() {
- assertTrue(exists(), "File does not exist: $canonicalPath")
-}
-
-fun File.filesFrom(relative: String) = resolve(relative)
- .readLines().asSequence().flatMap { listFiles(it) }.toHashSet()
-
-fun listFiles(dir: String): Sequence = File(dir).walk().filter { it.isFile }
\ No newline at end of file
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/BaseKotlinGradleTest.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/BaseKotlinGradleTest.kt
deleted file mode 100644
index 7ae5bdc8..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/BaseKotlinGradleTest.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package kotlinx.atomicfu.plugin.gradle.test
-
-import kotlinx.atomicfu.plugin.gradle.internal.*
-import org.objectweb.asm.*
-import java.io.File
-import kotlin.test.*
-
-abstract class BaseKotlinGradleTest(private val projectName: String) {
- internal val rootProjectDir: File
- private val ATOMIC_FU_REF = "Lkotlinx/atomicfu/".toByteArray()
- private val KOTLIN_METADATA_DESC = "Lkotlin/Metadata;"
-
- init {
- rootProjectDir = File("build${File.separator}test-$projectName").absoluteFile
- rootProjectDir.deleteRecursively()
- rootProjectDir.mkdirs()
- }
-
- internal abstract fun BaseKotlinScope.createProject()
-
- val runner = test {
- createProject()
- runner {
- arguments.add(":build")
- getFileOrNull("kotlin-repo-url.txt")?.let { kotlinRepoURLResource ->
- arguments.add("-Pkotlin_repo_url=${kotlinRepoURLResource.readText()}")
- }
- }
- }
-
- fun checkTaskOutcomes(executedTasks: List, excludedTasks: List) {
- runner.build().apply {
- val tasks = tasks.map { it.path }
- excludedTasks.forEach {
- check(it !in tasks) { "Post-compilation transformation task $it was added in the compiler plugin mode" }
- }
- executedTasks.forEach {
- assertTaskSuccess(it)
- }
- }
- // check that task outcomes are cached for the second build
- runner.build().apply {
- executedTasks.forEach {
- assertTaskUpToDate(it)
- }
- }
- }
-
- fun checkJvmCompilationClasspath(originalClassFile: String, transformedClassFile: String) {
- // check that test compile and runtime classpath does not contain original non-transformed classes
- val testCompileClasspathFiles = rootProjectDir.filesFrom("build/test_compile_jvm_classpath.txt")
- val testRuntimeClasspathFiles = rootProjectDir.filesFrom("build/test_runtime_jvm_classpath.txt")
-
- rootProjectDir.resolve(transformedClassFile).let {
- it.checkExists()
- check(it in testCompileClasspathFiles) { "Transformed '$it' is missing from test compile classpath" }
- check(it in testRuntimeClasspathFiles) { "Transformed '$it' is missing from test runtime classpath" }
- }
-
- rootProjectDir.resolve(originalClassFile).let {
- it.checkExists()
- check(it !in testCompileClasspathFiles) { "Original '$it' is present in test compile classpath" }
- check(it !in testRuntimeClasspathFiles) { "Original '$it' is present in test runtime classpath" }
- }
- }
-
- fun checkJsCompilationClasspath() {
- // check that test compilation depends on transformed main sources
- val testCompileClasspathFiles = rootProjectDir.filesFrom("build/test_compile_js_classpath.txt")
-
- rootProjectDir.resolve("build/classes/atomicfu/js/main/$projectName.js").let {
- it.checkExists()
- check(it in testCompileClasspathFiles) { "Transformed '$it' is missing from test compile classpath" }
- }
- }
-
- fun checkBytecode(classFilePath: String) {
- rootProjectDir.resolve(classFilePath).let {
- it.checkExists()
- assertFalse(it.readBytes().findAtomicfuRef(), "Found 'Lkotlinx/atomicfu/' reference in $it" )
- }
- }
-
- private fun ByteArray.findAtomicfuRef(): Boolean {
- val bytes = this.eraseMetadata()
- loop@for (i in 0 until bytes.size - ATOMIC_FU_REF.size) {
- for (j in 0 until ATOMIC_FU_REF.size) {
- if (bytes[i + j] != ATOMIC_FU_REF[j]) continue@loop
- }
- return true
- }
- return false
- }
-
- // The atomicfu compiler plugin does not remove atomic properties from metadata,
- // so for now we check that there are no ATOMIC_FU_REF left in the class bytecode excluding metadata.
- // This may be reverted after the fix in the compiler plugin transformer (See #254).
- private fun ByteArray.eraseMetadata(): ByteArray {
- val cw = ClassWriter(ClassWriter.COMPUTE_MAXS or ClassWriter.COMPUTE_FRAMES)
- ClassReader(this).accept(object : ClassVisitor(Opcodes.ASM9, cw) {
- override fun visitAnnotation(descriptor: String?, visible: Boolean): AnnotationVisitor? {
- return if (descriptor == KOTLIN_METADATA_DESC) null else super.visitAnnotation(descriptor, visible)
- }
- }, ClassReader.SKIP_FRAMES)
- return cw.toByteArray()
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JvmProjectTest.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JvmProjectTest.kt
deleted file mode 100644
index 282df802..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JvmProjectTest.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-package kotlinx.atomicfu.plugin.gradle.test
-
-import kotlinx.atomicfu.plugin.gradle.internal.*
-import kotlinx.atomicfu.plugin.gradle.internal.BaseKotlinScope
-import org.junit.Test
-
-/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the JVM project:
- * - post-compilation bytecode transformation tasks are created
- * (legacy transformation is tested here, compiler plugin is not applied).
- * - original non-transformed classes are not left in compile/runtime classpath.
- * - no `kotlinx/atomicfu` references are left in the transformed bytecode.
- */
-class JvmLegacyTransformationTest : BaseKotlinGradleTest("jvm-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/jvm-simple/jvm-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/jvm-simple/settings.gradle.kts")
- }
- dir("src/main/kotlin") {}
- kotlin("IntArithmetic.kt", "main") {
- resolve("projects/jvm-simple/src/main/kotlin/IntArithmetic.kt")
- }
- dir("src/test/kotlin") {}
- kotlin("ArithmeticTest.kt", "test") {
- resolve("projects/jvm-simple/src/test/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlin",
- ":transformMainAtomicfu",
- ":compileTestKotlin",
- ":transformTestAtomicfu"
- ),
- excludedTasks = emptyList()
- )
-
- @Test
- fun testClasspath() {
- runner.build()
- checkJvmCompilationClasspath(
- originalClassFile = "build/classes/atomicfu-orig/main/IntArithmetic.class",
- transformedClassFile = "build/classes/atomicfu/main/IntArithmetic.class"
- )
- }
-
- @Test
- fun testAtomicfuReferences() {
- runner.build()
- checkBytecode("build/classes/atomicfu/main/IntArithmetic.class")
- }
-}
-
-/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the JVM project,
- * - JVM IR compiler plugin transformation (kotlinx.atomicfu.enableJvmIrTransformation=true)
- * - no post-compilation bytecode transforming tasks created
- * - no `kotlinx/atomicfu` references are left in the resulting bytecode after IR transformation.
- */
-class JvmIrTransformationTest : BaseKotlinGradleTest("jvm-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/jvm-simple/jvm-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/jvm-simple/settings.gradle.kts")
- }
- // set kotlinx.atomicfu.enableJvmIrTransformation=true to apply compiler plugin
- gradleProperties {
- resolve("projects/jvm-simple/gradle.properties")
- }
- dir("src/main/kotlin") {}
- kotlin("IntArithmetic.kt", "main") {
- resolve("projects/jvm-simple/src/main/kotlin/IntArithmetic.kt")
- }
- dir("src/test/kotlin") {}
- kotlin("ArithmeticTest.kt", "test") {
- resolve("projects/jvm-simple/src/test/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlin",
- ":compileTestKotlin"
- ),
- excludedTasks = listOf(
- ":transformAtomicfu",
- ":transformTestAtomicfu"
- )
- )
-
- @Test
- fun testAtomicfuReferences() {
- runner.build()
- checkBytecode("build/classes/kotlin/main/IntArithmetic.class")
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/MppProjectTest.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/MppProjectTest.kt
deleted file mode 100644
index 3e1f6085..00000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/MppProjectTest.kt
+++ /dev/null
@@ -1,162 +0,0 @@
-package kotlinx.atomicfu.plugin.gradle.test
-
-import kotlinx.atomicfu.plugin.gradle.internal.*
-import org.junit.*
-
-/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the MPP project,
- * - JVM IR compiler plugin transformation (kotlinx.atomicfu.enableJvmIrTransformation=true)
- * - no post-compilation bytecode transformation tasks are created
- * - post-compilation js file transformation task created (as only JVM IR transformation applied, js is transformed in legacy mode)
- * - no `kotlinx/atomicfu` references are left in the transformed bytecode.
- */
-class MppJvmIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/mpp-simple/mpp-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/mpp-simple/settings.gradle.kts")
- }
- gradleProperties {
- resolve("projects/mpp-simple/gradle.properties_jvm")
- }
- dir("src/commonMain/kotlin") {}
- kotlin("IntArithmetic.kt", "commonMain") {
- resolve("projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt")
- }
- dir("src/commonTest/kotlin") {}
- kotlin("ArithmeticTest.kt", "commonTest") {
- resolve("projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlinJvm",
- ":compileTestKotlinJvm",
- ":compileKotlinJs",
- // legacy JS transformation
- ":transformJsMainAtomicfu",
- ":transformJsTestAtomicfu"
- ),
- excludedTasks = listOf(
- ":transformJvmMainAtomicfu",
- ":transformJvmTestAtomicfu"
- )
- )
-
- @Test
- fun testAtomicfuReferences() {
- runner.build()
- checkBytecode("build/classes/kotlin/jvm/main/IntArithmetic.class")
- }
-}
-
-/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the MPP project,
- * - JS IR compiler plugin transformation (kotlinx.atomicfu.enableJsIrTransformation=true)
- * - post-compilation bytecode transformation tasks are created (only JS IR transformation is applied, jvm is transformed in legacy mode)
- * - no post-compilation js file transformation tasks are created
- * - no `kotlinx/atomicfu` references are left in the transformed bytecode.
- */
-class MppJsIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/mpp-simple/mpp-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/mpp-simple/settings.gradle.kts")
- }
- gradleProperties {
- resolve("projects/mpp-simple/gradle.properties_js")
- }
- dir("src/commonMain/kotlin") {}
- kotlin("IntArithmetic.kt", "commonMain") {
- resolve("projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt")
- }
- dir("src/commonTest/kotlin") {}
- kotlin("ArithmeticTest.kt", "commonTest") {
- resolve("projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlinJvm",
- ":compileTestKotlinJvm",
- ":compileKotlinJs",
- // legacy JVM transformation
- ":transformJvmMainAtomicfu",
- ":transformJvmTestAtomicfu"
- ),
- excludedTasks = listOf(
- ":transformJsMainAtomicfu",
- ":transformJsTestAtomicfu"
- )
- )
-
- @Test
- fun testAtomicfuReferences() {
- runner.build()
- checkBytecode("build/classes/atomicfu/jvm/main/IntArithmetic.class")
- }
-}
-
-/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the MPP project,
- * - JS IR and JVM IR compiler plugin transformation
- * - no post-compilation bytecode transformation tasks are created (only JS IR transformation is applied, jvm is transformed in legacy mode)
- * - no post-compilation js file transformation tasks are created
- * - no `kotlinx/atomicfu` references are left in the transformed bytecode.
- */
-class MppBothIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/mpp-simple/mpp-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/mpp-simple/settings.gradle.kts")
- }
- gradleProperties {
- resolve("projects/mpp-simple/gradle.properties_both")
- }
- dir("src/commonMain/kotlin") {}
- kotlin("IntArithmetic.kt", "commonMain") {
- resolve("projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt")
- }
- dir("src/commonTest/kotlin") {}
- kotlin("ArithmeticTest.kt", "commonTest") {
- resolve("projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlinJvm",
- ":compileTestKotlinJvm",
- ":compileKotlinJs"
- ),
- excludedTasks = listOf(
- ":transformJvmMainAtomicfu",
- ":transformJvmTestAtomicfu",
- ":transformJsMainAtomicfu",
- ":transformJsTestAtomicfu"
- )
- )
-
- @Test
- fun testAtomicfuReferences() {
- runner.build()
- checkBytecode("build/classes/kotlin/jvm/main/IntArithmetic.class")
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/gradle.properties b/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/gradle.properties
deleted file mode 100644
index fa37a2cd..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/gradle.properties
+++ /dev/null
@@ -1 +0,0 @@
-kotlinx.atomicfu.enableJvmIrTransformation=true
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/jvm-simple.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/jvm-simple.gradle.kts
deleted file mode 100644
index 4a6b008b..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/jvm-simple.gradle.kts
+++ /dev/null
@@ -1,47 +0,0 @@
-import org.gradle.api.tasks.compile.*
-import org.jetbrains.kotlin.gradle.plugin.*
-
-buildscript {
- dependencies {
- classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.0")
- }
-}
-
-plugins {
- kotlin("jvm")
-}
-
-apply(plugin = "kotlinx-atomicfu")
-
-repositories {
- mavenCentral()
- (properties["kotlin_repo_url"] as? String)?.let { maven(it) }
-}
-
-dependencies {
- implementation(kotlin("stdlib"))
- implementation(kotlin("test-junit"))
-}
-
-kotlin {
- java {
- targetCompatibility = JavaVersion.VERSION_1_8
- sourceCompatibility = JavaVersion.VERSION_1_8
- }
-
- tasks.compileTestKotlin {
- doLast {
- file("$buildDir/test_compile_jvm_classpath.txt").writeText(
- target.compilations["test"].compileDependencyFiles.joinToString("\n")
- )
- }
- }
-
- tasks.test {
- doLast {
- file("$buildDir/test_runtime_jvm_classpath.txt").writeText(
- (target.compilations["test"] as KotlinCompilationToRunnableFiles<*>).runtimeDependencyFiles.joinToString("\n")
- )
- }
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/settings.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/settings.gradle.kts
deleted file mode 100644
index 2f5327fa..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/settings.gradle.kts
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "jvm-simple"
\ No newline at end of file
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/main/kotlin/IntArithmetic.kt b/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/main/kotlin/IntArithmetic.kt
deleted file mode 100644
index 51408253..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/main/kotlin/IntArithmetic.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-import kotlinx.atomicfu.*
-
-class IntArithmetic {
- private val _x = atomic(0)
- val x get() = _x.value
-
- fun doWork() {
- _x.getAndSet(3)
- _x.compareAndSet(3, 8)
- }
-}
-
-// minimal example that forces ASM to call AtomicFUTransformer.CW.getCommonSuperClass
-private fun checkTransformerFindCommonSuperClass() {
- val (a, b) = 0 to 1
- if (a == 0) {
- val c = listOf(a, b)
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/test/kotlin/ArithmeticTest.kt b/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/test/kotlin/ArithmeticTest.kt
deleted file mode 100644
index e75e8ea2..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/jvm-simple/src/test/kotlin/ArithmeticTest.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-import kotlin.test.*
-
-class ArithmeticTest {
- @Test
- fun testInt() {
- val a = IntArithmetic()
- a.doWork()
- check(a.x == 8)
- }
-}
\ No newline at end of file
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_both b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_both
deleted file mode 100644
index 5d28ccda..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_both
+++ /dev/null
@@ -1,3 +0,0 @@
-kotlin.js.compiler=ir
-kotlinx.atomicfu.enableJvmIrTransformation=true
-kotlinx.atomicfu.enableJsIrTransformation=true
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js
deleted file mode 100644
index b57875b7..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js
+++ /dev/null
@@ -1,2 +0,0 @@
-kotlin.js.compiler=ir
-kotlinx.atomicfu.enableJsIrTransformation=true
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js_legacy b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js_legacy
deleted file mode 100644
index 31585e0e..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_js_legacy
+++ /dev/null
@@ -1 +0,0 @@
-kotlin.js.compiler=legacy
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_jvm b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_jvm
deleted file mode 100644
index 399d39c6..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/gradle.properties_jvm
+++ /dev/null
@@ -1,2 +0,0 @@
-kotlinx.atomicfu.enableJvmIrTransformation=true
-kotlin.js.compiler=ir
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/mpp-simple.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/mpp-simple.gradle.kts
deleted file mode 100644
index 64aff01f..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/mpp-simple.gradle.kts
+++ /dev/null
@@ -1,91 +0,0 @@
-import org.jetbrains.kotlin.gradle.plugin.*
-
-buildscript {
- dependencies {
- classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.0")
- }
-}
-
-plugins {
- kotlin("multiplatform")
-}
-
-apply(plugin = "kotlinx-atomicfu")
-
-repositories {
- mavenCentral()
- (properties["kotlin_repo_url"] as? String)?.let { maven(it) }
-}
-
-kotlin {
- targets {
- jvm {
- compilations.all {
- kotlinOptions.jvmTarget = "1.8"
- }
- testRuns["test"].executionTask.configure {
- useJUnit()
- }
- }
- js {
- nodejs()
- }
- }
- sourceSets {
- val commonMain by getting {
- dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
- }
- }
- val commonTest by getting {
- dependencies {
- implementation(kotlin("test-common"))
- implementation(kotlin("test-annotations-common"))
- }
- }
- val jvmMain by getting {
- dependencies {
- implementation(kotlin("stdlib"))
- }
- }
- val jvmTest by getting {
- dependencies {
- implementation(kotlin("test-junit"))
- }
- }
- val jsMain by getting {
- dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
- }
- }
- val jsTest by getting {
- dependencies {
- implementation("org.jetbrains.kotlin:kotlin-test-js")
- }
- }
- }
-
- tasks.named("compileTestKotlinJvm") {
- doLast {
- file("$buildDir/test_compile_jvm_classpath.txt").writeText(
- targets["jvm"].compilations["test"].compileDependencyFiles.joinToString("\n")
- )
- }
- }
-
- tasks.named("jvmTest") {
- doLast {
- file("$buildDir/test_runtime_jvm_classpath.txt").writeText(
- (targets["jvm"].compilations["test"] as KotlinCompilationToRunnableFiles).runtimeDependencyFiles.joinToString("\n")
- )
- }
- }
-
- tasks.named("compileTestKotlinJs") {
- doLast {
- file("$buildDir/test_compile_js_classpath.txt").writeText(
- targets["js"].compilations["test"].compileDependencyFiles.joinToString("\n")
- )
- }
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/settings.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/settings.gradle.kts
deleted file mode 100644
index 5a4e5abf..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/settings.gradle.kts
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "mpp-simple"
\ No newline at end of file
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt
deleted file mode 100644
index 51408253..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonMain/kotlin/IntArithmetic.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-import kotlinx.atomicfu.*
-
-class IntArithmetic {
- private val _x = atomic(0)
- val x get() = _x.value
-
- fun doWork() {
- _x.getAndSet(3)
- _x.compareAndSet(3, 8)
- }
-}
-
-// minimal example that forces ASM to call AtomicFUTransformer.CW.getCommonSuperClass
-private fun checkTransformerFindCommonSuperClass() {
- val (a, b) = 0 to 1
- if (a == 0) {
- val c = listOf(a, b)
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt b/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt
deleted file mode 100644
index e75e8ea2..00000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/mpp-simple/src/commonTest/kotlin/ArithmeticTest.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-import kotlin.test.*
-
-class ArithmeticTest {
- @Test
- fun testInt() {
- val a = IntArithmetic()
- a.doWork()
- check(a.x == 8)
- }
-}
\ No newline at end of file
diff --git a/atomicfu-maven-plugin/build.gradle b/atomicfu-maven-plugin/build.gradle
index 5756df9c..9769b9b6 100644
--- a/atomicfu-maven-plugin/build.gradle
+++ b/atomicfu-maven-plugin/build.gradle
@@ -10,7 +10,7 @@ apply from: rootProject.file('gradle/compile-options.gradle')
ext.configureKotlin()
dependencies {
- api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api project(":atomicfu-transformer")
api "org.apache.maven:maven-core:$maven_version"
api "org.apache.maven:maven-plugin-api:$maven_version"
diff --git a/atomicfu-transformer/build.gradle b/atomicfu-transformer/build.gradle
index be540524..6ef1a41c 100644
--- a/atomicfu-transformer/build.gradle
+++ b/atomicfu-transformer/build.gradle
@@ -9,7 +9,7 @@ apply from: rootProject.file('gradle/compile-options.gradle')
ext.configureKotlin()
dependencies {
- api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "org.ow2.asm:asm:$asm_version"
api "org.ow2.asm:asm-commons:$asm_version"
api "org.ow2.asm:asm-tree:$asm_version"
diff --git a/atomicfu/build.gradle b/atomicfu/build.gradle
index d20bb341..ee40e0d1 100644
--- a/atomicfu/build.gradle
+++ b/atomicfu/build.gradle
@@ -50,7 +50,7 @@ kotlin {
sourceSets {
commonMain {
dependencies {
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
+ compileOnly 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
commonTest {
@@ -67,7 +67,8 @@ kotlin {
jsMain {
dependsOn(sourceSets.jsAndWasmSharedMain)
dependencies {
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
+ compileOnly 'org.jetbrains.kotlin:kotlin-stdlib-js'
+ compileOnly 'org.jetbrains.kotlin:kotlin-dom-api-compat'
}
}
jsTest {
@@ -79,7 +80,7 @@ kotlin {
wasmJsMain {
dependsOn(sourceSets.jsAndWasmSharedMain)
dependencies {
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-wasm-js'
+ compileOnly 'org.jetbrains.kotlin:kotlin-stdlib-wasm-js'
}
}
@@ -92,7 +93,7 @@ kotlin {
wasmWasiMain {
dependsOn(sourceSets.jsAndWasmSharedMain)
dependencies {
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-wasm-wasi'
+ compileOnly 'org.jetbrains.kotlin:kotlin-stdlib-wasm-wasi'
}
}
wasmWasiTest {
@@ -103,7 +104,7 @@ kotlin {
jvmMain {
dependencies {
- implementation 'org.jetbrains.kotlin:kotlin-stdlib'
+ compileOnly 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
jvmTest {
diff --git a/gradle/publish-mpp-root-module-in-platform.gradle b/gradle/publish-mpp-root-module-in-platform.gradle
index 94920bd6..3e0a105d 100644
--- a/gradle/publish-mpp-root-module-in-platform.gradle
+++ b/gradle/publish-mpp-root-module-in-platform.gradle
@@ -25,13 +25,16 @@ project.ext.publishPlatformArtifactsInRootModule = { MavenPublication platformPu
root.appendNode("packaging", "pom")
// Remove the original platform dependencies and add a single dependency on the platform module:
- Node dependencies = (root.get("dependencies") as NodeList).get(0) as Node
- dependencies.children().toList().each { dependencies.remove(it as Node) }
- Node singleDependency = dependencies.appendNode("dependency")
- singleDependency.appendNode("groupId", platformPublication.groupId)
- singleDependency.appendNode("artifactId", platformPublication.artifactId)
- singleDependency.appendNode("version", platformPublication.version)
- singleDependency.appendNode("scope", "compile")
+ def allDependencies = (root.get("dependencies") as NodeList)
+ if (!allDependencies.isEmpty()) {
+ Node dependencies = allDependencies.get(0) as Node
+ dependencies.children().toList().each { dependencies.remove(it as Node) }
+ Node singleDependency = dependencies.appendNode("dependency")
+ singleDependency.appendNode("groupId", platformPublication.groupId)
+ singleDependency.appendNode("artifactId", platformPublication.artifactId)
+ singleDependency.appendNode("version", platformPublication.version)
+ singleDependency.appendNode("scope", "compile")
+ }
}
}
@@ -39,4 +42,4 @@ project.ext.publishPlatformArtifactsInRootModule = { MavenPublication platformPu
dependsOn(tasks["generatePomFileFor${platformPublication.name.capitalize()}Publication"])
}
}
-}
\ No newline at end of file
+}
diff --git a/integration-testing/build.gradle.kts b/integration-testing/build.gradle.kts
index 0a4392f3..efb26b15 100644
--- a/integration-testing/build.gradle.kts
+++ b/integration-testing/build.gradle.kts
@@ -63,8 +63,7 @@ val mavenTest by tasks.registering(Test::class) {
val functionalTest by tasks.registering(Test::class) {
testClassesDirs = sourceSets["functionalTest"].output.classesDirs
classpath = sourceSets["functionalTest"].runtimeClasspath
-
- systemProperties["kotlinVersion"] = kotlin_version
+
systemProperties["atomicfuVersion"] = atomicfu_snapshot_version
dependsOn(":atomicfu-gradle-plugin:publishToMavenLocal")
diff --git a/integration-testing/examples/jvm-sample/build.gradle.kts b/integration-testing/examples/jvm-sample/build.gradle.kts
index 29bdde6a..b7be8561 100644
--- a/integration-testing/examples/jvm-sample/build.gradle.kts
+++ b/integration-testing/examples/jvm-sample/build.gradle.kts
@@ -1,10 +1,14 @@
buildscript {
repositories {
mavenLocal()
+ mavenCentral()
}
dependencies {
- classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${libs.versions.atomicfuVersion.get()}")
+ val atomicfuVersion = libs.versions.atomicfuVersion.get()
+ val kotlinVersion = libs.versions.kotlinVersion.get()
+ classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfuVersion")
+ classpath("org.jetbrains.kotlin:atomicfu:$kotlinVersion")
}
}
diff --git a/integration-testing/examples/jvm-sample/gradle.properties b/integration-testing/examples/jvm-sample/gradle.properties
index b75bc9ee..a5cb67ce 100644
--- a/integration-testing/examples/jvm-sample/gradle.properties
+++ b/integration-testing/examples/jvm-sample/gradle.properties
@@ -1,5 +1,5 @@
##
## Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
##
-kotlin_version=1.9.20
+kotlin_version=1.9.21
atomicfu_version=0.23.1-SNAPSHOT
diff --git a/integration-testing/examples/mpp-sample/build.gradle.kts b/integration-testing/examples/mpp-sample/build.gradle.kts
index f7bb99b8..2bb5cc2c 100644
--- a/integration-testing/examples/mpp-sample/build.gradle.kts
+++ b/integration-testing/examples/mpp-sample/build.gradle.kts
@@ -1,7 +1,6 @@
/*
* Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-
buildscript {
repositories {
mavenLocal()
@@ -9,7 +8,10 @@ buildscript {
}
dependencies {
- classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${libs.versions.atomicfuVersion.get()}")
+ val atomicfuVersion = libs.versions.atomicfuVersion.get()
+ val kotlinVersion = libs.versions.kotlinVersion.get()
+ classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfuVersion")
+ classpath("org.jetbrains.kotlin:atomicfu:$kotlinVersion")
}
}
diff --git a/integration-testing/examples/mpp-sample/gradle.properties b/integration-testing/examples/mpp-sample/gradle.properties
index b75bc9ee..a5cb67ce 100644
--- a/integration-testing/examples/mpp-sample/gradle.properties
+++ b/integration-testing/examples/mpp-sample/gradle.properties
@@ -1,5 +1,5 @@
##
## Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
##
-kotlin_version=1.9.20
+kotlin_version=1.9.21
atomicfu_version=0.23.1-SNAPSHOT
diff --git a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/cases/smoke/DependencyCheckerTest.kt b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/cases/smoke/DependencyCheckerTest.kt
index 929fb089..7fc0b48d 100644
--- a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/cases/smoke/DependencyCheckerTest.kt
+++ b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/cases/smoke/DependencyCheckerTest.kt
@@ -5,6 +5,7 @@
package kotlinx.atomicfu.gradle.plugin.test.cases.smoke
import kotlinx.atomicfu.gradle.plugin.test.framework.runner.BuildResult
+import kotlinx.atomicfu.gradle.plugin.test.framework.runner.atomicfuVersion
import java.io.File
import kotlin.test.*
@@ -17,7 +18,7 @@ class DependencyParserSmokeTest {
"Root project 'jvm-sample'\n" +
"------------------------------------------------------------\n" +
"compileClasspath - Compile classpath for null/main.\n" +
- "+--- org.jetbrains.kotlinx:atomicfu-jvm:0.23.1-SNAPSHOT\n" +
+ "+--- org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion\n" +
"+--- org.jetbrains.kotlin:kotlin-stdlib:1.9.0\n" +
"| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0\n" +
"| \\--- org.jetbrains:annotations:13.0\n" +
@@ -28,10 +29,10 @@ class DependencyParserSmokeTest {
" \\--- org.hamcrest:hamcrest-core:1.3\n" +
"\n" +
"compileOnly - Compile only dependencies for null/main. (n)\n" +
- "\\--- org.jetbrains.kotlinx:atomicfu-jvm:0.23.1-SNAPSHOT (n)\n" +
+ "\\--- org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion (n)\n" +
"\n" +
"compileOnlyDependenciesMetadata\n" +
- "\\--- org.jetbrains.kotlinx:atomicfu-jvm:0.23.1-SNAPSHOT\n" +
+ "\\--- org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion\n" +
"\n" +
"default - Configuration for default artifacts. (n)\n" +
"No dependencies\n" +
@@ -73,7 +74,7 @@ class DependencyParserSmokeTest {
)
assertEquals(
listOf(
- "org.jetbrains.kotlinx:atomicfu-jvm:0.23.1-SNAPSHOT",
+ "org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion",
"org.jetbrains.kotlin:kotlin-stdlib:1.9.0",
"org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0",
"org.jetbrains:annotations:13.0",
diff --git a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/BuildRunner.kt b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/BuildRunner.kt
index 4fada6e8..6daf7149 100644
--- a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/BuildRunner.kt
+++ b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/BuildRunner.kt
@@ -14,8 +14,6 @@ internal class GradleBuild(val projectName: String, val targetDir: File) {
private val properties
get() = buildList {
- add("-P$KOTLIN_VERSION=$kotlinVersion")
- add("-P${ATOMICFU_VERSION}=$atomicfuVersion")
add("-P$ENABLE_JVM_IR_TRANSFORMATION=$enableJvmIrTransformation")
add("-P$ENABLE_JS_IR_TRANSFORMATION=$enableJsIrTransformation")
add("-P$ENABLE_NATIVE_IR_TRANSFORMATION=$enableNativeIrTransformation")
diff --git a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/Environment.kt b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/Environment.kt
index 87bef24f..6e06fb7d 100644
--- a/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/Environment.kt
+++ b/integration-testing/src/functionalTest/kotlin/kotlinx.atomicfu.gradle.plugin.test/framework/runner/Environment.kt
@@ -14,7 +14,6 @@ internal const val ENABLE_NATIVE_IR_TRANSFORMATION = "kotlinx.atomicfu.enableNat
internal const val DUMMY_VERSION = "DUMMY_VERSION"
internal val atomicfuVersion = System.getProperty("atomicfuVersion")
-internal val kotlinVersion = System.getProperty("kotlinVersion")
internal val gradleWrapperDir = File("..")