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 =
159
159
(rootProject.getBooleanProperty(ENABLE_JS_IR_TRANSFORMATION ) || rootProject.getBooleanProperty(ENABLE_JS_IR_TRANSFORMATION_LEGACY ))
160
160
&& target.isJsIrTarget()
161
161
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
+
162
166
private fun KotlinTarget.isJsIrTarget () = (this is KotlinJsTarget && this .irTarget != null ) || this is KotlinJsIrTarget
163
167
164
168
private fun Project.addCompilerPluginDependency () {
@@ -263,6 +267,8 @@ private fun Project.configureTransformationForTarget(target: KotlinTarget) {
263
267
val originalDirsByCompilation = hashMapOf<KotlinCompilation <* >, FileCollection > ()
264
268
val config = config
265
269
target.compilations.all compilations@{ compilation ->
270
+ // do not modify directories if compiler plugin is applied
271
+ if (needsJvmIrTransformation(target) || needsJsIrTransformation(target)) return @compilations
266
272
val compilationType = compilation.name.compilationNameToType()
267
273
? : return @compilations // skip unknown compilations
268
274
val classesDirs = compilation.output.classesDirs
Original file line number Diff line number Diff line change @@ -103,6 +103,6 @@ class JvmIrTransformationTest : BaseKotlinGradleTest("jvm-simple") {
103
103
@Test
104
104
fun testAtomicfuReferences () {
105
105
runner.build()
106
- checkBytecode(" build/classes/atomicfu-orig /main/IntArithmetic.class" )
106
+ checkBytecode(" build/classes/kotlin /main/IntArithmetic.class" )
107
107
}
108
108
}
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class MppJvmIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
112
112
@Test
113
113
fun testAtomicfuReferences () {
114
114
runner.build()
115
- checkBytecode(" build/classes/atomicfu-orig /jvm/main/IntArithmetic.class" )
115
+ checkBytecode(" build/classes/kotlin /jvm/main/IntArithmetic.class" )
116
116
}
117
117
}
118
118
@@ -217,6 +217,6 @@ class MppBothIrTransformationTest : BaseKotlinGradleTest("mpp-simple") {
217
217
@Test
218
218
fun testAtomicfuReferences () {
219
219
runner.build()
220
- checkBytecode(" build/classes/atomicfu-orig /jvm/main/IntArithmetic.class" )
220
+ checkBytecode(" build/classes/kotlin /jvm/main/IntArithmetic.class" )
221
221
}
222
222
}
You can’t perform that action at this time.
0 commit comments