Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit 0a3be3f

Browse files
author
DaRacci
committed
fix(paperweight-mpp): No need to configure immediately.
Better and less risk of an exception if we just wait.
1 parent ea8b5fc commit 0a3be3f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

paperweight-mpp/src/main/kotlin/dev/racci/paperweight/mpp/PaperweightMppPlugin.kt

+12-8
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ import org.gradle.kotlin.dsl.registerIfAbsent
4040
import org.gradle.kotlin.dsl.repositories
4141
import org.gradle.util.internal.NameMatcher
4242
import org.gradle.workers.WorkerExecutor
43+
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
4344
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
4445
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation
46+
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
4547
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
4648
import org.slf4j.LoggerFactory
4749
import javax.inject.Inject
@@ -65,15 +67,17 @@ public abstract class PaperweightMppPlugin : Plugin<Project> {
6567

6668
createRootTasks(project)
6769

68-
project.kotlinMPP().targets.all {
69-
if (this !is KotlinJvmTarget) {
70-
logger.info("Skipping non-JVM target $name")
71-
return@all
72-
} else {
73-
logger.info("Configuring target $name for PaperweightMPP")
74-
}
70+
project.afterEvaluate {
71+
kotlinExtension.targets.forEach { target ->
72+
if (target !is KotlinJvmTarget) {
73+
logger.info("Skipping non-JVM target $name")
74+
return@forEach
75+
} else {
76+
logger.info("Configuring target ${target.name} for PaperweightMPP")
77+
}
7578

76-
configureTasks()
79+
target.configureTasks()
80+
}
7781
}
7882
}
7983

0 commit comments

Comments
 (0)