aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Ruban <stanislav.ruban@jetbrains.com>2023-09-03 01:22:22 +0300
committerVsevolod Tolstopyatov <qwwdfsad@gmail.com>2023-10-04 15:33:54 +0200
commit2b86fbf8f064e437cb0f9b17b21b0b73abf209c9 (patch)
tree5363613cdbe323f1ab92316c503773061edd56ba
parentc379beee4fe42488f1b51d9f1d98c73c0e007750 (diff)
downloadkotlinx.atomicfu-2b86fbf8f064e437cb0f9b17b21b0b73abf209c9.tar.gz
[infra] Remove outdated conditional removal of JS/Legacy-related buildscript parts
-rw-r--r--atomicfu-gradle-plugin/build.gradle7
-rw-r--r--atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JsProjectTest.kt52
-rw-r--r--atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/MppProjectTest.kt60
-rw-r--r--atomicfu-gradle-plugin/src/test/resources/projects/js-simple/gradle.properties_js_legacy1
-rw-r--r--atomicfu-gradle-plugin/src/test/resources/projects/js-simple/js-simple.gradle.kts38
-rw-r--r--atomicfu-gradle-plugin/src/test/resources/projects/js-simple/settings.gradle.kts1
-rw-r--r--atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/main/kotlin/IntArithmetic.kt16
-rw-r--r--atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/test/kotlin/ArithmeticTest.kt14
-rw-r--r--atomicfu/build.gradle75
9 files changed, 2 insertions, 262 deletions
diff --git a/atomicfu-gradle-plugin/build.gradle b/atomicfu-gradle-plugin/build.gradle
index 398d651..76ded09 100644
--- a/atomicfu-gradle-plugin/build.gradle
+++ b/atomicfu-gradle-plugin/build.gradle
@@ -83,10 +83,3 @@ task createClasspathManifest {
dependencies {
testRuntimeOnly files(createClasspathManifest)
}
-
-// Skip these tests if Kotlin version >= 1.9.0, as JS Legacy is no longer supported there
-if (isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 0)) {
- test {
- exclude "**/JsLegacyTransformationTest*", "**/MppLegacyTransformationTest*"
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JsProjectTest.kt b/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JsProjectTest.kt
deleted file mode 100644
index e1c4469..0000000
--- a/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JsProjectTest.kt
+++ /dev/null
@@ -1,52 +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 JS project:
- * - post-compilation js 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.
- */
-class JsLegacyTransformationTest : BaseKotlinGradleTest("js-simple") {
-
- override fun BaseKotlinScope.createProject() {
- buildGradleKts {
- resolve("projects/js-simple/js-simple.gradle.kts")
- }
- settingsGradleKts {
- resolve("projects/js-simple/settings.gradle.kts")
- }
- gradleProperties {
- resolve("projects/mpp-simple/gradle.properties_js_legacy")
- }
- dir("src/main/kotlin") {}
- kotlin("IntArithmetic.kt", "main") {
- resolve("projects/js-simple/src/main/kotlin/IntArithmetic.kt")
- }
- dir("src/test/kotlin") {}
- kotlin("ArithmeticTest.kt", "test") {
- resolve("projects/js-simple/src/test/kotlin/ArithmeticTest.kt")
- }
- }
-
- @Test
- fun testPluginApplication() =
- checkTaskOutcomes(
- executedTasks = listOf(
- ":compileKotlinJs",
- ":transformJsMainAtomicfu",
- ":compileTestKotlinJs",
- ":transformJsTestAtomicfu"
- ),
- excludedTasks = emptyList()
- )
-
- @Test
- fun testClasspath() {
- runner.build()
- checkJsCompilationClasspath()
- }
-}
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
index f06d868..3e1f608 100644
--- 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
@@ -4,66 +4,6 @@ import kotlinx.atomicfu.plugin.gradle.internal.*
import org.junit.*
/**
- * Test that ensures correctness of `atomicfu-gradle-plugin` application to the MPP 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 MppLegacyTransformationTest : 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_legacy")
- }
- 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",
- ":transformJvmMainAtomicfu",
- ":transformJvmTestAtomicfu",
- ":compileKotlinJs",
- ":transformJsMainAtomicfu"
- ),
- excludedTasks = emptyList()
- )
-
- @Test
- fun testClasspath() {
- runner.build()
- checkJvmCompilationClasspath(
- originalClassFile = "build/classes/atomicfu-orig/jvm/main/IntArithmetic.class",
- transformedClassFile = "build/classes/atomicfu/jvm/main/IntArithmetic.class"
- )
- checkJsCompilationClasspath()
- }
-
- @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,
* - JVM IR compiler plugin transformation (kotlinx.atomicfu.enableJvmIrTransformation=true)
* - no post-compilation bytecode transformation tasks are created
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/gradle.properties_js_legacy b/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/gradle.properties_js_legacy
deleted file mode 100644
index 31585e0..0000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/gradle.properties_js_legacy
+++ /dev/null
@@ -1 +0,0 @@
-kotlin.js.compiler=legacy
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/js-simple.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/js-simple.gradle.kts
deleted file mode 100644
index 52f597c..0000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/js-simple.gradle.kts
+++ /dev/null
@@ -1,38 +0,0 @@
-import kotlinx.atomicfu.plugin.gradle.*
-
-buildscript {
- dependencies {
- classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.0")
- }
-}
-
-plugins {
- kotlin("js")
-}
-
-apply(plugin = "kotlinx-atomicfu")
-
-repositories {
- mavenCentral()
- maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
-}
-
-dependencies {
- implementation(kotlin("stdlib-js"))
- implementation(kotlin("test-junit"))
- implementation("org.jetbrains.kotlin:kotlin-test-js")
-}
-
-kotlin {
- js {
- nodejs()
- }
-
- tasks.named("compileTestKotlinJs") {
- doLast {
- file("$buildDir/test_compile_js_classpath.txt").writeText(
- target.compilations["test"].compileDependencyFiles.joinToString("\n")
- )
- }
- }
-}
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/settings.gradle.kts b/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/settings.gradle.kts
deleted file mode 100644
index bd39e74..0000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/settings.gradle.kts
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = "js-simple" \ No newline at end of file
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/main/kotlin/IntArithmetic.kt b/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/main/kotlin/IntArithmetic.kt
deleted file mode 100644
index a26bebf..0000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/main/kotlin/IntArithmetic.kt
+++ /dev/null
@@ -1,16 +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)
- }
-}
-
diff --git a/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/test/kotlin/ArithmeticTest.kt b/atomicfu-gradle-plugin/src/test/resources/projects/js-simple/src/test/kotlin/ArithmeticTest.kt
deleted file mode 100644
index e75e8ea..0000000
--- a/atomicfu-gradle-plugin/src/test/resources/projects/js-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/build.gradle b/atomicfu/build.gradle
index a0f121b..20f01ef 100644
--- a/atomicfu/build.gradle
+++ b/atomicfu/build.gradle
@@ -20,9 +20,6 @@ ext {
}
}
-// TODO: this block should be removed when Kotlin version is updated to 1.9.0
-// Right now it implements a toggle between IR and BOTH JS compiler types for testing of Kotlin dev builds
-def isJsLegacyCompilerEnabled = !isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 0)
// TODO: this block should be removed when Kotlin version is updated to 1.9.20
// Right now it is used for conditional removal of native targets that will be removed in 1.9.20 (iosArm32, watchosX86)
// and is necessary for testing of Kotlin dev builds.
@@ -36,12 +33,9 @@ kotlin {
}
// JS -- always
- // TODO: JS compiler should be switched to IR-only when Kotlin version is updated to 1.9.0
- // (right now compiler type is chosen conditionally for testing of Kotlin dev builds)
- def jsCompiler = isJsLegacyCompilerEnabled ? BOTH : IR
- js(jsCompiler) {
+ js(IR) {
moduleName = "kotlinx-atomicfu"
- // TODO: Commented out because browser tests do not work on TeamCity
+ // TODO: commented out because browser tests do not work on TeamCity
// browser()
nodejs()
}
@@ -169,71 +163,6 @@ dependencies {
transformer project(":atomicfu-transformer")
}
-// TODO: This JS Legacy configuration should be removed when Kotlin version is updated to 1.9.0,
-// (right now configurations are removed conditionally for testing of Kotlin 1.9.0-dev builds)
-if (isJsLegacyCompilerEnabled) {
-
- // ==== CONFIGURE JS =====
-
- def compileJsLegacy = tasks.hasProperty("compileKotlinJsLegacy")
- ? compileKotlinJsLegacy.getClass()
- : compileKotlinJs.getClass()
-
- tasks.withType(compileJsLegacy).configureEach {
- kotlinOptions {
- moduleKind = "umd"
- sourceMap = true
- metaInfo = true
- }
- }
-
- apply from: file("$rootProject.projectDir/gradle/node-js.gradle")
- apply from: file("$rootProject.projectDir/gradle/publish-npm-js.gradle")
-
- // Workaround the problem with Node downloading
- repositories.whenObjectAdded {
- if (it instanceof IvyArtifactRepository) {
- metadataSources {
- artifact()
- }
- }
- }
-
- def compileTestJsLegacy = tasks.hasProperty("compileTestKotlinJsLegacy")
- ? compileTestKotlinJsLegacy
- : compileTestKotlinJs
-
- def transformedJsFile = compileTestJsLegacy.kotlinOptions.outputFile
- compileTestJsLegacy.configure {
- kotlinOptions {
- // NOTE: Module base-name must be equal to the package name declared in package.json
- def baseName = "kotlinx-atomicfu"
- outputFile = new File(new File(outputFile).parent, baseName + ".js")
- }
- }
- def originalJsFile = compileTestJsLegacy.kotlinOptions.outputFile
-
- task transformJS(type: JavaExec, dependsOn: [compileTestJsLegacy]) {
- main = "kotlinx.atomicfu.transformer.AtomicFUTransformerJSKt"
- args = [originalJsFile, transformedJsFile]
- classpath = configurations.transformer
- inputs.file(originalJsFile)
- outputs.file(transformedJsFile)
- }
-
- if (project.tasks.findByName('jsLegacyNodeTest')) {
- jsLegacyNodeTest.dependsOn transformJS
- jsLegacyNodeTest.configure {
- inputFileProperty.set(new File(transformedJsFile))
- }
- } else {
- jsNodeTest.dependsOn transformJS
- jsNodeTest.configure {
- inputFileProperty.set(new File(transformedJsFile))
- }
- }
-}
-
// ==== CONFIGURE JVM =====
def classesPreAtomicFuDir = file("$buildDir/classes/kotlin/jvm/test")