33import io.gitlab.arturbosch.detekt.Detekt
44import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
55import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
6- import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
7- import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
86import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
97
108plugins {
11- alias(libs.plugins.kotlin.mutliplatform)
9+ convention.kotlin
10+ convention.`mutliplatform- lib`
11+ convention.`mutliplatform- tests`
1212 alias(libs.plugins.kotlin.serialization)
1313 alias(libs.plugins.kotest.multiplatform)
1414 alias(libs.plugins.kover)
@@ -18,51 +18,10 @@ plugins {
1818}
1919
2020kotlin {
21- explicitApi()
22-
2321 @OptIn(ExperimentalKotlinGradlePluginApi ::class )
2422 compilerOptions {
2523 freeCompilerArgs.add(" -opt-in=io.github.optimumcode.json.schema.ExperimentalApi" )
2624 }
27- jvmToolchain(11 )
28- jvm {
29- testRuns[" test" ].executionTask.configure {
30- useJUnitPlatform()
31- }
32- }
33- js(IR ) {
34- browser()
35- generateTypeScriptDefinitions()
36- nodejs()
37- }
38- wasmJs {
39- // The wasmJsBrowserTest prints all executed tests as one unformatted string
40- // Have not found a way to suppress printing all this into console
41- browser()
42- nodejs()
43- }
44-
45- applyDefaultHierarchyTemplate()
46-
47- val macOsTargets =
48- listOf<KotlinTarget >(
49- macosX64(),
50- macosArm64(),
51- iosX64(),
52- iosArm64(),
53- iosSimulatorArm64(),
54- )
55-
56- val linuxTargets =
57- listOf<KotlinTarget >(
58- linuxX64(),
59- linuxArm64(),
60- )
61-
62- val windowsTargets =
63- listOf<KotlinTarget >(
64- mingwX64(),
65- )
6625
6726 sourceSets {
6827 commonMain {
@@ -101,34 +60,6 @@ kotlin {
10160 }
10261 }
10362 }
104-
105- afterEvaluate {
106- fun Task.dependsOnTargetTests (targets : List <KotlinTarget >) {
107- targets.forEach {
108- if (it is KotlinTargetWithTests <* , * >) {
109- dependsOn(tasks.getByName(" ${it.name} Test" ))
110- }
111- }
112- }
113- tasks.register(" macOsAllTest" ) {
114- group = " verification"
115- description = " runs all tests for MacOS and IOS targets"
116- dependsOnTargetTests(macOsTargets)
117- }
118- tasks.register(" windowsAllTest" ) {
119- group = " verification"
120- description = " runs all tests for Windows targets"
121- dependsOnTargetTests(windowsTargets)
122- }
123- tasks.register(" linuxAllTest" ) {
124- group = " verification"
125- description = " runs all tests for Linux targets"
126- dependsOnTargetTests(linuxTargets)
127- dependsOn(tasks.getByName(" jvmTest" ))
128- dependsOn(tasks.getByName(" jsTest" ))
129- dependsOn(tasks.getByName(" wasmJsTest" ))
130- }
131- }
13263}
13364
13465ktlint {
@@ -138,12 +69,12 @@ ktlint {
13869 }
13970}
14071
141- afterEvaluate {
142- val detektAllTask by tasks.register(" detektAll" ) {
143- dependsOn(tasks.withType<Detekt >())
144- }
72+ val detektAllTask by tasks.register(" detektAll" )
14573
146- tasks.named(" check" ).configure {
147- dependsOn(detektAllTask)
148- }
74+ tasks.named(" check" ).configure {
75+ dependsOn(detektAllTask)
76+ }
77+
78+ tasks.withType<Detekt > {
79+ detektAllTask.dependsOn(this )
14980}
0 commit comments