From 7b18d279bfd82d26f75f6992c090959578372756 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Thu, 21 May 2026 16:48:10 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E5=90=84=20SDK=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E7=89=88=E6=9C=AC=EF=BC=8Cpublish.gradle=20?= =?UTF-8?q?=E6=94=B9=E7=94=A8=20project.version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 每个模块通过 SDK__VERSION 属性指定自己的版本, 未设置时回退到全局 PUBLISH_VERSION,保持向后兼容。 发布单个模块示例: ./gradlew :sdk-license:publish -PSDK_LICENSE_VERSION=1.0.3 -PPUBLISH_VERSION=1.0.2 Co-Authored-By: Claude Sonnet 4.6 --- build.gradle.kts | 3 +++ gradle/publish.gradle | 2 +- sdk-core/build.gradle.kts | 4 ++++ sdk-im/build.gradle.kts | 4 ++++ sdk-license/build.gradle.kts | 4 ++++ sdk-push/build.gradle.kts | 4 ++++ sdk-update/build.gradle.kts | 4 ++++ sdk-webview/build.gradle.kts | 4 ++++ 8 files changed, 28 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 00e35e3..f0ab9bb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,9 @@ plugins { } group = "com.xuqm" +// Global fallback — individual modules override via their own SDK__VERSION property. +// Publish all at once: ./gradlew publish -PPUBLISH_VERSION=1.0.2 +// Publish one module: ./gradlew :sdk-license:publish -PSDK_LICENSE_VERSION=1.0.3 -PPUBLISH_VERSION=1.0.2 version = providers.gradleProperty("PUBLISH_VERSION").getOrElse("0.1.0-SNAPSHOT") ext["nexusUrl"] = "https://nexus.xuqinmin.com/repository/android-hosted/" diff --git a/gradle/publish.gradle b/gradle/publish.gradle index c51ed6d..1219de9 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -7,7 +7,7 @@ afterEvaluate { from components.release groupId rootProject.group artifactId project.name - version rootProject.version + version project.version } } repositories { diff --git a/sdk-core/build.gradle.kts b/sdk-core/build.gradle.kts index df4b86d..2c1e7b4 100644 --- a/sdk-core/build.gradle.kts +++ b/sdk-core/build.gradle.kts @@ -6,6 +6,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_CORE_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.core" compileSdk = libs.versions.compileSdk.get().toInt() diff --git a/sdk-im/build.gradle.kts b/sdk-im/build.gradle.kts index 5055b3a..d3f702a 100644 --- a/sdk-im/build.gradle.kts +++ b/sdk-im/build.gradle.kts @@ -4,6 +4,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_IM_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.im" compileSdk = libs.versions.compileSdk.get().toInt() diff --git a/sdk-license/build.gradle.kts b/sdk-license/build.gradle.kts index 585a467..879d964 100644 --- a/sdk-license/build.gradle.kts +++ b/sdk-license/build.gradle.kts @@ -5,6 +5,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_LICENSE_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.license" compileSdk = libs.versions.compileSdk.get().toInt() diff --git a/sdk-push/build.gradle.kts b/sdk-push/build.gradle.kts index 94faa68..a304074 100644 --- a/sdk-push/build.gradle.kts +++ b/sdk-push/build.gradle.kts @@ -4,6 +4,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_PUSH_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.push" compileSdk = libs.versions.compileSdk.get().toInt() diff --git a/sdk-update/build.gradle.kts b/sdk-update/build.gradle.kts index fb10a33..a86e1ee 100644 --- a/sdk-update/build.gradle.kts +++ b/sdk-update/build.gradle.kts @@ -4,6 +4,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_UPDATE_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.update" compileSdk = libs.versions.compileSdk.get().toInt() diff --git a/sdk-webview/build.gradle.kts b/sdk-webview/build.gradle.kts index e569f44..247d35a 100644 --- a/sdk-webview/build.gradle.kts +++ b/sdk-webview/build.gradle.kts @@ -5,6 +5,10 @@ plugins { apply(from = rootProject.file("gradle/publish.gradle")) +version = providers.gradleProperty("SDK_WEBVIEW_VERSION") + .orElse(providers.gradleProperty("PUBLISH_VERSION")) + .getOrElse("0.1.0-SNAPSHOT") + android { namespace = "com.xuqm.sdk.webview" compileSdk = libs.versions.compileSdk.get().toInt()