-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update MavenPublisher, remove jcenter, enable snapshots * Release v0.6.1 * Fix build issues
- Loading branch information
Showing
10 changed files
with
55 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,37 +13,29 @@ plugins { | |
id("io.deepmedia.tools.publisher") | ||
} | ||
|
||
fun KotlinMultiplatformExtension.newSourceSet(name: String, vararg parents: KotlinSourceSet): KotlinSourceSet { | ||
return sourceSets.maybeCreate(name).apply { | ||
parents.forEach { dependsOn(it) } | ||
} | ||
} | ||
|
||
// Ideally we'd have common -> androidNative -> androidNative32/64 -> androidNativeXXX, but the | ||
// commonizer currently only works on sets whose direct children are the final targets. | ||
// So we need to move androidNative closer to the final targets and create two chains instead: | ||
// 1. common -> androidNative -----------------------> androidNativeXXX | ||
// 2. \------> androidNative32/64 -------/ | ||
// https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html | ||
fun KotlinMultiplatformExtension.androidNative(name: String = "androidNative", configure: KotlinNativeTarget.() -> Unit) { | ||
val commonMain = sourceSets["commonMain"] | ||
val commonTest = sourceSets["commonTest"] | ||
val androidNativeMain = newSourceSet("${name}Main", commonMain) | ||
val androidNativeTest = newSourceSet("${name}Test", commonTest) | ||
val androidNative32BitMain = newSourceSet("${name}32BitMain", androidNativeMain) | ||
val androidNative64BitMain = newSourceSet("${name}64BitMain", androidNativeMain) | ||
val androidNative32BitTest = newSourceSet("${name}32BitTest", androidNativeTest) | ||
val androidNative64BitTest = newSourceSet("${name}64BitTest", androidNativeTest) | ||
|
||
val androidNativeMain = sourceSets.create("${name}Main") { dependsOn(commonMain) } | ||
val androidNativeTest = sourceSets.create("${name}Test") { dependsOn(commonTest) } | ||
|
||
val androidNative32BitMain = sourceSets.create("${name}32BitMain") { dependsOn(androidNativeMain) } | ||
val androidNative64BitMain = sourceSets.create("${name}64BitMain") { dependsOn(androidNativeMain) } | ||
val androidNative32BitTest = sourceSets.create("${name}32BitTest") { dependsOn(androidNativeTest) } | ||
val androidNative64BitTest = sourceSets.create("${name}64BitTest") { dependsOn(androidNativeTest) } | ||
|
||
val targets32 = listOf(androidNativeX86(), androidNativeArm32()) | ||
val targets64 = listOf(androidNativeX64(), androidNativeArm64()) | ||
targets32.forEach { | ||
newSourceSet(it.compilations["main"].defaultSourceSetName, androidNativeMain, androidNative32BitMain) | ||
newSourceSet(it.compilations["test"].defaultSourceSetName, androidNativeTest, androidNative32BitTest) | ||
it.compilations["main"].defaultSourceSet.dependsOn(androidNative32BitMain) | ||
it.compilations["test"].defaultSourceSet.dependsOn(androidNative32BitTest) | ||
it.configure() | ||
} | ||
targets64.forEach { | ||
newSourceSet(it.compilations["main"].defaultSourceSetName, androidNativeMain, androidNative64BitMain) | ||
newSourceSet(it.compilations["test"].defaultSourceSetName, androidNativeTest, androidNative64BitTest) | ||
it.compilations["main"].defaultSourceSet.dependsOn(androidNative64BitMain) | ||
it.compilations["test"].defaultSourceSet.dependsOn(androidNative64BitTest) | ||
it.configure() | ||
} | ||
} | ||
|
@@ -62,7 +54,7 @@ kotlin { | |
sourceSets { | ||
getByName("androidJvmMain") { | ||
dependencies { | ||
api("androidx.annotation:annotation:1.1.0") | ||
api("androidx.annotation:annotation:1.2.0") | ||
} | ||
} | ||
configureEach { | ||
|
@@ -82,7 +74,7 @@ android { | |
defaultConfig { | ||
setMinSdkVersion(property("androidMinSdkVersion") as Int) | ||
setTargetSdkVersion(property("androidTargetSdkVersion") as Int) | ||
versionName = "0.6.0" | ||
versionName = "0.6.1" | ||
} | ||
buildTypes["release"].consumerProguardFile("proguard-rules.pro") | ||
sourceSets["main"].java.srcDirs("src/androidJvmMain/kotlin") | ||
|
@@ -103,7 +95,6 @@ publisher { | |
project.scm = GithubScm("natario1", "Egloo") | ||
project.addLicense(License.MIT) | ||
project.addDeveloper("natario1", "[email protected]") | ||
release.docs = Release.DOCS_AUTO | ||
val dir = "../prebuilt" | ||
|
||
// Kotlin creates MavenPublication objects with a specific name. | ||
|
@@ -122,36 +113,38 @@ publisher { | |
multiplatformPublications.forEach { (mavenPublication, artifactId) -> | ||
deployLocally.dependsOn("publishToDirectory${mavenPublication.capitalize()}") | ||
directory(mavenPublication) { | ||
setPublication(mavenPublication, clone = true) | ||
directory = dir | ||
publication = mavenPublication | ||
project.name = artifactId | ||
project.artifact = artifactId | ||
release.docs = Release.DOCS_AUTO | ||
} | ||
|
||
deploySonatypeReleases.dependsOn("publishToSonatype${mavenPublication.capitalize()}") | ||
sonatype(mavenPublication) { | ||
setPublication(mavenPublication, clone = true) | ||
auth.user = "SONATYPE_USER" | ||
auth.password = "SONATYPE_PASSWORD" | ||
signing.key = "SIGNING_KEY" | ||
signing.password = "SIGNING_PASSWORD" | ||
publication = mavenPublication | ||
project.name = artifactId | ||
project.artifact = artifactId | ||
release.docs = Release.DOCS_AUTO | ||
} | ||
|
||
// TODO can't work, version overrides the other sonatype version! Need to fix this in publisher plugin | ||
/* deploySonatypeSnapshots.dependsOn("publishToSonatype${mavenPublication.capitalize()}Snapshot") | ||
deploySonatypeSnapshots.dependsOn("publishToSonatype${mavenPublication.capitalize()}Snapshot") | ||
sonatype(mavenPublication + "Snapshot") { | ||
setPublication(mavenPublication, clone = true) | ||
repository = Sonatype.OSSRH_SNAPSHOT_1 | ||
release.version = "latest-SNAPSHOT" | ||
auth.user = "SONATYPE_USER" | ||
auth.password = "SONATYPE_PASSWORD" | ||
signing.key = "SIGNING_KEY" | ||
signing.password = "SIGNING_PASSWORD" | ||
publication = mavenPublication | ||
project.name = artifactId | ||
project.artifact = artifactId | ||
} */ | ||
release.docs = Release.DOCS_AUTO | ||
} | ||
} | ||
|
||
// Legacy android release (:egloo) | ||
|
@@ -161,6 +154,7 @@ publisher { | |
component = "release" | ||
project.name = "Egloo" | ||
project.artifact = "egloo" | ||
release.docs = Release.DOCS_AUTO | ||
release.sources = Release.SOURCES_AUTO | ||
} | ||
|
||
|
@@ -173,16 +167,17 @@ publisher { | |
component = "release" | ||
project.name = "Egloo" | ||
project.artifact = "egloo" | ||
release.docs = Release.DOCS_AUTO | ||
release.sources = Release.SOURCES_AUTO | ||
} | ||
} | ||
|
||
/* afterEvaluate { | ||
afterEvaluate { | ||
val publishing = project.publishing | ||
publishing.publications.filterIsInstance<MavenPublication>().forEach { | ||
println("Analyzing publication ${it.name}...") | ||
it.artifacts.forEach { | ||
println(" - artifact ext=${it.extension} classifier=${it.classifier}") | ||
} | ||
} | ||
} */ | ||
} |