File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
atomicfu-gradle-plugin/src
main/kotlin/kotlinx/atomicfu/plugin/gradle
test/kotlin/kotlinx/atomicfu/plugin/gradle/test Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,10 @@ private fun Project.needsJsIrTransformation(target: KotlinTarget): Boolean =
159159 (rootProject.getBooleanProperty(ENABLE_JS_IR_TRANSFORMATION ) || rootProject.getBooleanProperty(ENABLE_JS_IR_TRANSFORMATION_LEGACY ))
160160 && target.isJsIrTarget()
161161
162+ private fun Project.needsJvmIrTransformation (target : KotlinTarget ): Boolean =
163+ rootProject.getBooleanProperty(ENABLE_JVM_IR_TRANSFORMATION ) &&
164+ (target.platformType == KotlinPlatformType .jvm || target.platformType == KotlinPlatformType .androidJvm)
165+
162166private fun KotlinTarget.isJsIrTarget () = (this is KotlinJsTarget && this .irTarget != null ) || this is KotlinJsIrTarget
163167
164168private fun Project.addCompilerPluginDependency () {
@@ -263,6 +267,8 @@ private fun Project.configureTransformationForTarget(target: KotlinTarget) {
263267 val originalDirsByCompilation = hashMapOf<KotlinCompilation <* >, FileCollection > ()
264268 val config = config
265269 target.compilations.all compilations@{ compilation ->
270+ // do not modify directories if compiler plugin is applied
271+ if (needsJvmIrTransformation(target) || needsJsIrTransformation(target)) return @compilations
266272 val compilationType = compilation.name.compilationNameToType()
267273 ? : return @compilations // skip unknown compilations
268274 val classesDirs = compilation.output.classesDirs
Original file line number Diff line number Diff line change @@ -103,6 +103,6 @@ class JvmIrTransformationTest : BaseKotlinGradleTest("jvm-simple") {
103103 @Test
104104 fun testAtomicfuReferences () {
105105 runner.build()
106- checkBytecode(" build/classes/atomicfu-orig /main/IntArithmetic.class" )
106+ checkBytecode(" build/classes/kotlin /main/IntArithmetic.class" )
107107 }
108108}
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class MppJvmIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
112112 @Test
113113 fun testAtomicfuReferences () {
114114 runner.build()
115- checkBytecode(" build/classes/atomicfu-orig /jvm/main/IntArithmetic.class" )
115+ checkBytecode(" build/classes/kotlin /jvm/main/IntArithmetic.class" )
116116 }
117117}
118118
@@ -217,6 +217,6 @@ class MppBothIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
217217 @Test
218218 fun testAtomicfuReferences () {
219219 runner.build()
220- checkBytecode(" build/classes/atomicfu-orig /jvm/main/IntArithmetic.class" )
220+ checkBytecode(" build/classes/kotlin /jvm/main/IntArithmetic.class" )
221221 }
222222}
You can’t perform that action at this time.
0 commit comments