Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,119 +3,6 @@ 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:
* - 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/kotlin/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
* - 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)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.