@@ -13,37 +13,29 @@ plugins {
1313 id(" io.deepmedia.tools.publisher" )
1414}
1515
16- fun KotlinMultiplatformExtension.newSourceSet (name : String , vararg parents : KotlinSourceSet ): KotlinSourceSet {
17- return sourceSets.maybeCreate(name).apply {
18- parents.forEach { dependsOn(it) }
19- }
20- }
21-
22- // Ideally we'd have common -> androidNative -> androidNative32/64 -> androidNativeXXX, but the
23- // commonizer currently only works on sets whose direct children are the final targets.
24- // So we need to move androidNative closer to the final targets and create two chains instead:
25- // 1. common -> androidNative -----------------------> androidNativeXXX
26- // 2. \------> androidNative32/64 -------/
2716// https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html
2817fun KotlinMultiplatformExtension.androidNative (name : String = "androidNative", configure : KotlinNativeTarget .() -> Unit ) {
2918 val commonMain = sourceSets[" commonMain" ]
3019 val commonTest = sourceSets[" commonTest" ]
31- val androidNativeMain = newSourceSet(" ${name} Main" , commonMain)
32- val androidNativeTest = newSourceSet(" ${name} Test" , commonTest)
33- val androidNative32BitMain = newSourceSet(" ${name} 32BitMain" , androidNativeMain)
34- val androidNative64BitMain = newSourceSet(" ${name} 64BitMain" , androidNativeMain)
35- val androidNative32BitTest = newSourceSet(" ${name} 32BitTest" , androidNativeTest)
36- val androidNative64BitTest = newSourceSet(" ${name} 64BitTest" , androidNativeTest)
20+
21+ val androidNativeMain = sourceSets.create(" ${name} Main" ) { dependsOn(commonMain) }
22+ val androidNativeTest = sourceSets.create(" ${name} Test" ) { dependsOn(commonTest) }
23+
24+ val androidNative32BitMain = sourceSets.create(" ${name} 32BitMain" ) { dependsOn(androidNativeMain) }
25+ val androidNative64BitMain = sourceSets.create(" ${name} 64BitMain" ) { dependsOn(androidNativeMain) }
26+ val androidNative32BitTest = sourceSets.create(" ${name} 32BitTest" ) { dependsOn(androidNativeTest) }
27+ val androidNative64BitTest = sourceSets.create(" ${name} 64BitTest" ) { dependsOn(androidNativeTest) }
28+
3729 val targets32 = listOf (androidNativeX86(), androidNativeArm32())
3830 val targets64 = listOf (androidNativeX64(), androidNativeArm64())
3931 targets32.forEach {
40- newSourceSet( it.compilations[" main" ].defaultSourceSetName, androidNativeMain, androidNative32BitMain)
41- newSourceSet( it.compilations[" test" ].defaultSourceSetName, androidNativeTest, androidNative32BitTest)
32+ it.compilations[" main" ].defaultSourceSet.dependsOn( androidNative32BitMain)
33+ it.compilations[" test" ].defaultSourceSet.dependsOn( androidNative32BitTest)
4234 it.configure()
4335 }
4436 targets64.forEach {
45- newSourceSet( it.compilations[" main" ].defaultSourceSetName, androidNativeMain, androidNative64BitMain)
46- newSourceSet( it.compilations[" test" ].defaultSourceSetName, androidNativeTest, androidNative64BitTest)
37+ it.compilations[" main" ].defaultSourceSet.dependsOn( androidNative64BitMain)
38+ it.compilations[" test" ].defaultSourceSet.dependsOn( androidNative64BitTest)
4739 it.configure()
4840 }
4941}
@@ -62,7 +54,7 @@ kotlin {
6254 sourceSets {
6355 getByName(" androidJvmMain" ) {
6456 dependencies {
65- api(" androidx.annotation:annotation:1.1 .0" )
57+ api(" androidx.annotation:annotation:1.2 .0" )
6658 }
6759 }
6860 configureEach {
@@ -82,7 +74,7 @@ android {
8274 defaultConfig {
8375 setMinSdkVersion(property(" androidMinSdkVersion" ) as Int )
8476 setTargetSdkVersion(property(" androidTargetSdkVersion" ) as Int )
85- versionName = " 0.6.0 "
77+ versionName = " 0.6.1 "
8678 }
8779 buildTypes[" release" ].consumerProguardFile(" proguard-rules.pro" )
8880 sourceSets[" main" ].java.srcDirs(" src/androidJvmMain/kotlin" )
@@ -103,7 +95,6 @@ publisher {
10395 project.scm = GithubScm (" natario1" , " Egloo" )
10496 project.addLicense(License .MIT )
10597 project.addDeveloper(
" natario1" ,
" [email protected] " )
106- release.docs = Release .DOCS_AUTO
10798 val dir = " ../prebuilt"
10899
109100 // Kotlin creates MavenPublication objects with a specific name.
@@ -122,36 +113,38 @@ publisher {
122113 multiplatformPublications.forEach { (mavenPublication, artifactId) ->
123114 deployLocally.dependsOn(" publishToDirectory${mavenPublication.capitalize()} " )
124115 directory(mavenPublication) {
116+ setPublication(mavenPublication, clone = true )
125117 directory = dir
126- publication = mavenPublication
127118 project.name = artifactId
128119 project.artifact = artifactId
120+ release.docs = Release .DOCS_AUTO
129121 }
130122
131123 deploySonatypeReleases.dependsOn(" publishToSonatype${mavenPublication.capitalize()} " )
132124 sonatype(mavenPublication) {
125+ setPublication(mavenPublication, clone = true )
133126 auth.user = " SONATYPE_USER"
134127 auth.password = " SONATYPE_PASSWORD"
135128 signing.key = " SIGNING_KEY"
136129 signing.password = " SIGNING_PASSWORD"
137- publication = mavenPublication
138130 project.name = artifactId
139131 project.artifact = artifactId
132+ release.docs = Release .DOCS_AUTO
140133 }
141134
142- // TODO can't work, version overrides the other sonatype version! Need to fix this in publisher plugin
143- /* deploySonatypeSnapshots.dependsOn("publishToSonatype${mavenPublication.capitalize()}Snapshot")
135+ deploySonatypeSnapshots.dependsOn(" publishToSonatype${mavenPublication.capitalize()} Snapshot" )
144136 sonatype(mavenPublication + " Snapshot" ) {
137+ setPublication(mavenPublication, clone = true )
145138 repository = Sonatype .OSSRH_SNAPSHOT_1
146139 release.version = " latest-SNAPSHOT"
147140 auth.user = " SONATYPE_USER"
148141 auth.password = " SONATYPE_PASSWORD"
149142 signing.key = " SIGNING_KEY"
150143 signing.password = " SIGNING_PASSWORD"
151- publication = mavenPublication
152144 project.name = artifactId
153145 project.artifact = artifactId
154- } */
146+ release.docs = Release .DOCS_AUTO
147+ }
155148 }
156149
157150 // Legacy android release (:egloo)
@@ -161,6 +154,7 @@ publisher {
161154 component = " release"
162155 project.name = " Egloo"
163156 project.artifact = " egloo"
157+ release.docs = Release .DOCS_AUTO
164158 release.sources = Release .SOURCES_AUTO
165159 }
166160
@@ -173,16 +167,17 @@ publisher {
173167 component = " release"
174168 project.name = " Egloo"
175169 project.artifact = " egloo"
170+ release.docs = Release .DOCS_AUTO
176171 release.sources = Release .SOURCES_AUTO
177172 }
178173}
179174
180- /* afterEvaluate {
175+ afterEvaluate {
181176 val publishing = project.publishing
182177 publishing.publications.filterIsInstance<MavenPublication >().forEach {
183178 println (" Analyzing publication ${it.name} ..." )
184179 it.artifacts.forEach {
185180 println (" - artifact ext=${it.extension} classifier=${it.classifier} " )
186181 }
187182 }
188- } */
183+ }
0 commit comments