From e3cb1483dfd62754ef06d80918e823be30012fef Mon Sep 17 00:00:00 2001 From: mvicsokolova <82594708+mvicsokolova@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:49:12 +0100 Subject: [PATCH] Add all sources to the transformed directory (#394) * Add all sources to the transformed directories. Fixes #388 Co-authored-by: Yahor Berdnikau --- .../kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt | 5 +++-- integration-testing/examples/jvm-sample/build.gradle.kts | 5 +++++ .../examples/jvm-sample/src/main/java/JavaClass.java | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-) 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 eb4d858e..dcc74bef 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 @@ -337,8 +337,9 @@ private fun Project.configureTransformationForTarget(target: KotlinTarget) { it.destinationDirectory.value(originalDestinationDirectory) } } - val originalClassesDirs: FileCollection = - project.files(classesDirs.from.toTypedArray()).filter { it.exists() } + val originalClassesDirs: FileCollection = project.objects.fileCollection() + .from(compilationTask.flatMap { it.destinationDirectory }) + .from({ project.files(classesDirs.from).filter { it.exists() } }) originalDirsByCompilation[compilation] = originalClassesDirs val transformedClassesDir = project.layout.buildDirectory .dir("classes/atomicfu/${target.name}/${compilation.name}") diff --git a/integration-testing/examples/jvm-sample/build.gradle.kts b/integration-testing/examples/jvm-sample/build.gradle.kts index 2b3f2d5d..26cf262e 100644 --- a/integration-testing/examples/jvm-sample/build.gradle.kts +++ b/integration-testing/examples/jvm-sample/build.gradle.kts @@ -14,6 +14,7 @@ group = "kotlinx.atomicfu.examples" version = "DUMMY_VERSION" plugins { + application kotlin("jvm") version libs.versions.kotlinVersion.get() `maven-publish` } @@ -37,6 +38,10 @@ tasks.compileKotlin { } } +application { + mainClass.set("org.example.MainKt") +} + publishing { repositories { /** diff --git a/integration-testing/examples/jvm-sample/src/main/java/JavaClass.java b/integration-testing/examples/jvm-sample/src/main/java/JavaClass.java index 5c6c713d..a5ea52f9 100644 --- a/integration-testing/examples/jvm-sample/src/main/java/JavaClass.java +++ b/integration-testing/examples/jvm-sample/src/main/java/JavaClass.java @@ -1,5 +1,3 @@ -package org.example; - import java.util.concurrent.atomic.AtomicLongFieldUpdater; public class JavaClass {