Skip to content

Commit

Permalink
Renamed ths moudle name and add maven publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaoyuang committed Apr 20, 2022
1 parent 20a3cfc commit 11e62d1
Show file tree
Hide file tree
Showing 31 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MMKV-Kotlin Change Log

## v1.0.0/2022-03-07
## v1.0.0/2022-04-19

* Initial Release
* Based on `Kotlin 1.6.10`, `MMKV 1.2.12`
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pod::Spec.new do |spec|
spec.name = 'MMKV_Kotlin'
spec.name = 'mmkv_kotlin'
spec.version = '1.0.0'
spec.homepage = 'Link to the Shared Module homepage'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
Expand All @@ -16,13 +16,13 @@ Pod::Spec.new do |spec|
spec.dependency 'MMKV', '1.2.12'

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':MMKV-Kotlin',
'PRODUCT_MODULE_NAME' => 'MMKV_Kotlin',
'KOTLIN_PROJECT_PATH' => ':mmkv-kotlin',
'PRODUCT_MODULE_NAME' => 'mmkv_kotlin',
}

spec.script_phases = [
{
:name => 'Build MMKV_Kotlin',
:name => 'Build mmkv_kotlin',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
Expand Down
48 changes: 40 additions & 8 deletions MMKV-Kotlin/build.gradle.kts → mmkv-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ plugins {
id("com.android.library")
id("kotlin-parcelize")
id("maven-publish")
signing
}

version = "1.0.0"
group = "com.ctrip.flight.mmkv"

val NEXUS_USERNAME: String by project
val NEXUS_PASSWORD: String by project

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

kotlin {
android {
publishLibraryVariants("release")
Expand All @@ -24,20 +32,44 @@ kotlin {
}

publishing {
publications {
val publicationsFromMainHost = listOf(android()).map { it.name } + "kotlinMultiplatform"
matching { it.name in publicationsFromMainHost }.all {
val targetPublication = this@all
tasks.withType<AbstractPublishToMaven>()
.matching { it.publication == targetPublication }
.configureEach { onlyIf { findProperty("isMainHost") == "true" } }
publications.withType<MavenPublication> {
artifact(javadocJar)
with(pom) {
name.set("MMKV-Kotlin")
description.set("MMKV for Kotlin Multiplatform")
url.set("https://github.com/ctripcorp/mmkv-kotlin")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("qiaoyuang")
name.set("Yuang Qiao")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/ctripcorp/mmkv-kotlin")
connection.set("scm:git:https://github.com/ctripcorp/mmkv-kotlin.git")
developerConnection.set("scm:git:https://github.com/ctripcorp/mmkv-kotlin.git")
}
}
}
repositories {
maven {
// 审核通过后补充...
credentials {
username = NEXUS_USERNAME
password = NEXUS_PASSWORD
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
}
}
signing {
sign(publishing.publications)
}
}

cocoapods {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginManagement {
}

rootProject.name = "MMKV-Kotlin"
include(":MMKV-Kotlin")
include(":mmkv-kotlin")

plugins {
id("com.gradle.enterprise") version("3.7")
Expand Down

0 comments on commit 11e62d1

Please sign in to comment.