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 val commonMain by getting {
@@ -115,34 +74,6 @@ kotlin {
11574 }
11675 }
11776 }
118-
119- afterEvaluate {
120- fun Task.dependsOnTargetTests (targets : List <KotlinTarget >) {
121- targets.forEach {
122- if (it is KotlinTargetWithTests <* , * >) {
123- dependsOn(tasks.getByName(" ${it.name} Test" ))
124- }
125- }
126- }
127- tasks.register(" macOsAllTest" ) {
128- group = " verification"
129- description = " runs all tests for MacOS and IOS targets"
130- dependsOnTargetTests(macOsTargets)
131- }
132- tasks.register(" windowsAllTest" ) {
133- group = " verification"
134- description = " runs all tests for Windows targets"
135- dependsOnTargetTests(windowsTargets)
136- }
137- tasks.register(" linuxAllTest" ) {
138- group = " verification"
139- description = " runs all tests for Linux targets"
140- dependsOnTargetTests(linuxTargets)
141- dependsOn(tasks.getByName(" jvmTest" ))
142- dependsOn(tasks.getByName(" jsTest" ))
143- dependsOn(tasks.getByName(" wasmJsTest" ))
144- }
145- }
14677}
14778
14879ktlint {
@@ -152,12 +83,12 @@ ktlint {
15283 }
15384}
15485
155- afterEvaluate {
156- val detektAllTask by tasks.register(" detektAll" ) {
157- dependsOn(tasks.withType<Detekt >())
158- }
86+ val detektAllTask by tasks.register(" detektAll" )
15987
160- tasks.named(" check" ).configure {
161- dependsOn(detektAllTask)
162- }
88+ tasks.named(" check" ).configure {
89+ dependsOn(detektAllTask)
90+ }
91+
92+ tasks.withType<Detekt > {
93+ detektAllTask.dependsOn(this )
16394}
0 commit comments