@@ -6,7 +6,6 @@ import org.jetbrains.kotlin.gradle.dsl.*
66import org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode
77import org.jetbrains.kotlin.gradle.targets.js.nodejs.*
88import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
9- import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
109import org.jetbrains.kotlin.gradle.targets.js.yarn.*
1110import tasks.BuildConfig
1211
@@ -27,33 +26,25 @@ val kotlinMultiplatform = extensions.getByType<KotlinMultiplatformExtension>()
2726
2827kotlinMultiplatform.apply {
2928 applyDefaultHierarchyTemplate()
30-
3129 jvmToolchain { configureJvmToolchain() }
3230
3331 targets.all {
34- // Configure all compilations of all targets
35- compilations.all { compilerOptions.configure { configureKotlinCommon() } }
32+ compilations.all {
33+ compileTaskProvider.configure { compilerOptions { configureKotlinCommon() } }
34+ }
3635 }
3736
3837 jvm {
3938 withJava()
4039 compilations.all {
4140 compileJavaTaskProvider?.configure { configureJavac() }
42- compilerOptions .configure { configureKotlinJvm() }
41+ compileTaskProvider .configure { compilerOptions { configureKotlinJvm() } }
4342 }
4443
44+ // ./gradlew jvmRun
45+ mainRun { mainClass = libs.versions.app.mainclass.get() }
4546 // val test by testRuns.existing
46- testRuns.configureEach { executionTask.configure { configureKotlinTest() } }
47- attributes.attribute(mppTargetAttr, " jvm" )
48- }
49-
50- jvm(" desktop" ) {
51- compilations.all {
52- compileJavaTaskProvider?.configure { configureJavac() }
53- compilerOptions.configure { configureKotlinJvm() }
54- }
55- testRuns.configureEach { executionTask.configure { configureKotlinTest() } }
56- attributes.attribute(mppTargetAttr, " desktop" )
47+ testRuns.configureEach { executionTask.configure { configureJavaTest() } }
5748 }
5849
5950 js(IR ) {
@@ -78,30 +69,6 @@ kotlinMultiplatform.apply {
7869 }
7970 }
8071
81- // Disable wasm by default as some of the common dependencies are not compatible with wasm.
82- if (project.hasProperty(" experimental" )) {
83-
84- wasmJs {
85- binaries.executable()
86- browser {
87- commonWebpackConfig(
88- Action {
89- devServer =
90- (devServer ? : KotlinWebpackConfig .DevServer ()).copy(
91- open = mapOf (" app" to mapOf (" name" to " google chrome" )))
92- })
93- }
94- }
95-
96- // Use custom allocator for native targets
97- macosX64(" native" ) {
98- binaries.executable()
99- compilations.configureEach {
100- compilerOptions.configure { freeCompilerArgs.add(" -Xallocator=custom" ) }
101- }
102- }
103- }
104-
10572 @Suppress(" UNUSED_VARIABLE" )
10673 this .sourceSets {
10774 all {
@@ -186,7 +153,6 @@ tasks {
186153 // Register buildConfig task only for common module
187154 val buildConfig by registering(BuildConfig ::class ) { classFqName = " BuildConfig" }
188155 kotlinMultiplatform.sourceSets.named(" commonMain" ) { kotlin.srcDirs(buildConfig) }
189- maybeRegister<Task >(" prepareKotlinIdeaImport" ) { dependsOn(buildConfig) }
190156 }
191157
192158 // configure jvm target for ksp
@@ -195,7 +161,7 @@ tasks {
195161 jvmTargetValidationMode = JvmTargetValidationMode .WARNING
196162 }
197163
198- withType<KotlinJsCompile >().configureEach { kotlinOptions { configureKotlinJs() } }
164+ withType<KotlinJsCompile >().configureEach { compilerOptions { configureKotlinJs() } }
199165
200166 withType<KotlinNpmInstallTask >().configureEach { configureKotlinNpm() }
201167
0 commit comments