11plugins {
2- kotlin(" multiplatform" ) version " 1.4.20 "
2+ kotlin(" multiplatform" ) version " 1.4.31 "
33}
44
5- val GROUP : String by project
6- val VERSION_NAME : String by project
5+ val GROUP : String by project
6+ val VERSION_NAME : String by project
77
88group = GROUP
99version = VERSION_NAME
1010
11- val ideaActive = System .getProperty(" idea.active" ) == " true"
12-
1311fun configInterop (target : org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget ) {
14- val main by target.compilations.getting
15- val sqlite3 by main.cinterops.creating {
16- includeDirs(" $projectDir /src/include" )
17- }
12+ val main by target.compilations.getting
13+ val sqlite3 by main.cinterops.creating {
14+ includeDirs(" $projectDir /src/include" )
15+ }
1816}
1917
2018val onWindows = org.jetbrains.kotlin.konan.target.HostManager .hostIsMingw
2119
2220kotlin {
23- val knTargets = if (ideaActive) {
24- listOf (
25- macosX64(" nativeCommon" ),
26- mingwX64(" mingw" )
27- )
28- } else {
29- listOf (
30- macosX64(),
31- iosX64(),
32- iosArm64(),
33- iosArm32(),
34- watchosArm32(),
35- watchosArm64(),
36- watchosX86(),
37- tvosArm64(),
38- tvosX64(),
39- mingwX64(" mingw" ) {
40- compilations.forEach {
41- it.kotlinOptions.freeCompilerArgs + = listOf (" -linker-options" , " -Lc:\\ msys64\\ mingw64\\ lib" )
42- }
43- }
44- )
45- }
21+ val knTargets = listOf (
22+ macosX64(),
23+ iosX64(),
24+ iosArm64(),
25+ iosArm32(),
26+ watchosArm32(),
27+ watchosArm64(),
28+ watchosX86(),
29+ tvosArm64(),
30+ tvosX64(),
31+ mingwX64(" mingw" ) {
32+ compilations.forEach {
33+ it.kotlinOptions.freeCompilerArgs + = listOf (" -linker-options" , " -Lc:\\ msys64\\ mingw64\\ lib" )
34+ }
35+ }
36+ )
37+
38+ knTargets.forEach { configInterop(it) }
4639
47- knTargets.forEach { configInterop(it) }
40+ knTargets.forEach { target ->
41+ val test by target.compilations.getting
42+ test.kotlinOptions.freeCompilerArgs + = listOf (" -linker-options" , " -lsqlite3" )
43+ }
4844
49- knTargets.forEach { target ->
50- val test by target.compilations.getting
51- test.kotlinOptions.freeCompilerArgs + = listOf (" -linker-options" , " -lsqlite3" )
52- }
45+ sourceSets {
46+ commonMain {
47+ dependencies {
48+ implementation(" org.jetbrains.kotlin:kotlin-stdlib-common" )
49+ }
50+ }
51+ commonTest {
52+ dependencies {
53+ implementation(" org.jetbrains.kotlin:kotlin-test-common" )
54+ implementation(" org.jetbrains.kotlin:kotlin-test-annotations-common" )
55+ }
56+ }
5357
54- sourceSets {
55- commonMain {
56- dependencies {
57- implementation(" org.jetbrains.kotlin:kotlin-stdlib-common" )
58- }
59- }
60- commonTest {
61- dependencies {
62- implementation(" org.jetbrains.kotlin:kotlin-test-common" )
63- implementation(" org.jetbrains.kotlin:kotlin-test-annotations-common" )
64- }
65- }
58+ val nativeCommonMain = sourceSets.maybeCreate(" nativeCommonMain" )
59+ val nativeCommonTest = sourceSets.maybeCreate(" nativeCommonTest" )
6660
67- val nativeCommonMain = sourceSets.maybeCreate(" nativeCommonMain" )
68- val nativeCommonTest = sourceSets.maybeCreate(" nativeCommonTest" )
61+ val appleMain = sourceSets.maybeCreate(" appleMain" ).apply {
62+ dependsOn(nativeCommonMain)
63+ }
6964
70- val appleMain = sourceSets.maybeCreate(" appleMain" ).apply {
71- dependsOn(nativeCommonMain)
72- }
65+ val mingwMain = sourceSets.maybeCreate(" mingwMain" ).apply {
66+ dependsOn(nativeCommonMain)
67+ }
68+ knTargets.forEach { target ->
69+ if (target.name.startsWith(" mingw" )) {
70+ target.compilations.getByName(" main" ).source(mingwMain)
71+ target.compilations.getByName(" test" ).source(nativeCommonTest)
72+ } else {
73+ target.compilations.getByName(" main" ).source(appleMain)
74+ target.compilations.getByName(" test" ).source(nativeCommonTest)
75+ }
76+ }
7377
74- if (! ideaActive) {
75- val mingwMain = sourceSets.maybeCreate(" mingwMain" ).apply {
76- dependsOn(nativeCommonMain)
77- }
78- knTargets.forEach { target ->
79- if (target.name.startsWith(" mingw" )) {
80- target.compilations.getByName(" main" ).source(mingwMain)
81- target.compilations.getByName(" test" ).source(nativeCommonTest)
82- } else {
83- target.compilations.getByName(" main" ).source(appleMain)
84- target.compilations.getByName(" test" ).source(nativeCommonTest)
85- }
86- }
87- }
88- }
78+ }
8979}
9080
9181apply (from = " ../gradle/gradle-mvn-mpp-push.gradle" )
0 commit comments