chore: migrate to version catalog, Gropify

This commit is contained in:
2025-11-12 19:05:06 +08:00
parent 86a66458a7
commit 17c8524ade
7 changed files with 141 additions and 190 deletions

View File

@@ -2,6 +2,7 @@
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -2,9 +2,9 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
autowire(libs.plugins.android.application) apply false
autowire(libs.plugins.kotlin.android) apply false
autowire(libs.plugins.kotlin.ksp) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.ksp) apply false
}
allprojects {

View File

@@ -1,29 +1,29 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace = property.project.demo.app.packageName
compileSdk = property.project.android.compileSdk
ndkVersion = property.project.android.ndk.version
namespace = gropify.project.demo.app.packageName
compileSdk = gropify.project.android.compileSdk
ndkVersion = gropify.project.android.ndk.version
signingConfigs {
create("universal") {
keyAlias = property.project.demo.app.signing.keyAlias
keyPassword = property.project.demo.app.signing.keyPassword
storeFile = rootProject.file(property.project.demo.app.signing.storeFilePath)
storePassword = property.project.demo.app.signing.storePassword
keyAlias = gropify.project.demo.app.signing.keyAlias
keyPassword = gropify.project.demo.app.signing.keyPassword
storeFile = rootProject.file(gropify.project.demo.app.signing.storeFilePath)
storePassword = gropify.project.demo.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.demo.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.demo.app.versionName
versionCode = property.project.demo.app.versionCode
applicationId = gropify.project.demo.app.packageName
minSdk = gropify.project.android.minSdk
targetSdk = gropify.project.android.targetSdk
versionName = gropify.project.demo.app.versionName
versionCode = gropify.project.demo.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -36,7 +36,7 @@ android {
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
version = property.project.android.cmake.version
version = gropify.project.android.cmake.version
}
}
compileOptions {
@@ -55,33 +55,24 @@ androidComponents {
onVariants(selector().all()) {
it.outputs.forEach { output ->
val currentType = it.buildType
// Workaround for GitHub Actions.
// Why? I don't know, but it works.
// Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
// public inline fun CharSequence.isNotBlank(): Boolean defined in kotlin.text.
@Suppress("UNNECESSARY_SAFE_CALL", "RemoveRedundantCallsOfConversionMethods")
val currentSuffix = property.github.ci.commit.id?.let { suffix ->
// Workaround for GitHub Actions.
// Strongly transfer type to [String].
val sSuffix = suffix.toString()
if (sSuffix.isNotBlank()) "-$sSuffix" else ""
val currentSuffix = gropify.github.ci.commit.id.let { suffix ->
if (suffix.isNotBlank()) "-$suffix" else ""
}
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
output.outputFileName.set("${property.project.name}-demo-v$currentVersion-$currentType.apk")
output.outputFileName.set("${gropify.project.name}-demo-v$currentVersion-$currentType.apk")
}
}
}
dependencies {
implementation(com.fankes.projectpromote.project.promote)
implementation(com.highcapable.kavaref.kavaref.core)
implementation(com.highcapable.kavaref.kavaref.extension)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(com.google.android.material.material)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
implementation(libs.project.promote)
implementation(libs.kavaref.core)
implementation(libs.kavaref.extension)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}

49
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,49 @@
[versions]
agp = "8.13.1"
kotlin = "2.2.21"
ksp = "2.2.21-2.0.4"
flexi-locale = "1.0.2"
project-promote = "1.0.1"
rovo89-xposed-api = "82"
yukihookapi = "1.3.1"
kavaref-core = "1.0.2"
kavaref-extension = "1.0.1"
microsoft-appcenter = "5.0.6"
libsu = "5.2.2"
drawabletoolbox = "1.0.7"
gson = "2.13.2"
okhttp = "5.3.0"
androidx-core-ktx = "1.17.0"
androidx-appcompat = "1.7.1"
material = "1.13.0"
androidx-constraintlayout = "2.2.1"
junit = "4.13.2"
androidx-test-junit = "1.3.0"
androidx-test-espresso-core = "3.7.0"
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
flexi-locale = { id = "com.highcapable.flexilocale", version.ref = "flexi-locale" }
[libraries]
project-promote = { group = "com.fankes.projectpromote", name = "project-promote", version.ref = "project-promote" }
rovo89-xposed-api = { group = "de.robv.android.xposed", name = "api", version.ref = "rovo89-xposed-api" }
yukihookapi = { group = "com.highcapable.yukihookapi", name = "api", version.ref = "yukihookapi" }
yukihookapi-ksp-xposed = { group = "com.highcapable.yukihookapi", name = "ksp-xposed", version.ref = "yukihookapi" }
kavaref-core = { group = "com.highcapable.kavaref", name = "kavaref-core", version.ref = "kavaref-core" }
kavaref-extension = { group = "com.highcapable.kavaref", name = "kavaref-extension", version.ref = "kavaref-extension" }
microsoft-appcenter-analytics = { group = "com.microsoft.appcenter", name = "appcenter-analytics", version.ref = "microsoft-appcenter" }
microsoft-appcenter-crashes = { group = "com.microsoft.appcenter", name = "appcenter-crashes", version.ref = "microsoft-appcenter" }
libsu = { group = "com.github.topjohnwu.libsu", name = "core", version.ref = "libsu" }
drawabletoolbox = { group = "com.github.duanhong169", name = "drawabletoolbox", version.ref = "drawabletoolbox" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-test-espresso-core" }

View File

@@ -1,95 +0,0 @@
preferences:
autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES
repositories-mode: FAIL_ON_PROJECT_REPOS
repositories:
gradle-plugin-portal:
scope: PLUGINS
google:
maven-central:
jit-pack:
sonatype-oss-releases:
rovo89-xposed-api:
scope: LIBRARIES
url: https://api.xposed.info/
content:
include:
group:
de.robv.android.xposed
fankes-maven-releases:
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
plugins:
com.android.application:
alias: android-application
version: 8.13.0
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 2.2.20
com.highcapable.flexilocale:
alias: flexi-locale
version: 1.0.2
com.google.devtools.ksp:
alias: kotlin-ksp
version: 2.2.20-2.0.3
libraries:
com.fankes.projectpromote:
project-promote:
version: 1.0.1
repositories:
fankes-maven-releases
de.robv.android.xposed:
api:
version: 82
repositories:
rovo89-xposed-api
com.highcapable.yukihookapi:
api:
version: 1.3.1
ksp-xposed:
version-ref: <this>::api
com.highcapable.kavaref:
kavaref-core:
version: 1.0.2
kavaref-extension:
version: 1.0.1
com.microsoft.appcenter:
appcenter-analytics:
version: 5.0.6
appcenter-crashes:
version-ref: <this>::appcenter-analytics
com.github.topjohnwu.libsu:
core:
version: 5.2.2
auto-update: false
com.github.duanhong169:
drawabletoolbox:
version: 1.0.7
com.google.code.gson:
gson:
version: 2.13.2
com.squareup.okhttp3:
okhttp:
version: 5.1.0
androidx.core:
core-ktx:
version: 1.17.0
androidx.appcompat:
appcompat:
version: 1.7.1
com.google.android.material:
material:
version: 1.13.0
androidx.constraintlayout:
constraintlayout:
version: 2.2.1
androidx.test.ext:
junit:
version: 1.3.0
androidx.test.espresso:
espresso-core:
version: 3.7.0
junit:
junit:
version: 4.13.2

View File

@@ -1,30 +1,30 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.kotlin.ksp)
autowire(libs.plugins.flexi.locale)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.flexi.locale)
}
android {
namespace = property.project.module.app.packageName
compileSdk = property.project.android.compileSdk
namespace = gropify.project.module.app.packageName
compileSdk = gropify.project.android.compileSdk
signingConfigs {
create("universal") {
keyAlias = property.project.module.app.signing.keyAlias
keyPassword = property.project.module.app.signing.keyPassword
storeFile = rootProject.file(property.project.module.app.signing.storeFilePath)
storePassword = property.project.module.app.signing.storePassword
keyAlias = gropify.project.module.app.signing.keyAlias
keyPassword = gropify.project.module.app.signing.keyPassword
storeFile = rootProject.file(gropify.project.module.app.signing.storeFilePath)
storePassword = gropify.project.module.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.module.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.module.app.versionName
versionCode = property.project.module.app.versionCode
applicationId = gropify.project.module.app.packageName
minSdk = gropify.project.android.minSdk
targetSdk = gropify.project.android.targetSdk
versionName = gropify.project.module.app.versionName
versionCode = gropify.project.module.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -51,43 +51,34 @@ androidComponents {
onVariants(selector().all()) {
it.outputs.forEach { output ->
val currentType = it.buildType
// Workaround for GitHub Actions.
// Why? I don't know, but it works.
// Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
// public inline fun CharSequence.isNotBlank(): Boolean defined in kotlin.text.
@Suppress("UNNECESSARY_SAFE_CALL", "RemoveRedundantCallsOfConversionMethods")
val currentSuffix = property.github.ci.commit.id?.let { suffix ->
// Workaround for GitHub Actions.
// Strongly transfer type to [String].
val sSuffix = suffix.toString()
if (sSuffix.isNotBlank()) "-$sSuffix" else ""
val currentSuffix = gropify.github.ci.commit.id.let { suffix ->
if (suffix.isNotBlank()) "-$suffix" else ""
}
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
output.outputFileName.set("${property.project.name}-module-v$currentVersion-$currentType.apk")
output.outputFileName.set("${gropify.project.name}-module-v$currentVersion-$currentType.apk")
}
}
}
dependencies {
compileOnly(de.robv.android.xposed.api)
implementation(com.highcapable.yukihookapi.api)
ksp(com.highcapable.yukihookapi.ksp.xposed)
implementation(com.highcapable.kavaref.kavaref.core)
implementation(com.highcapable.kavaref.kavaref.extension)
implementation(com.fankes.projectpromote.project.promote)
implementation(com.microsoft.appcenter.appcenter.analytics)
implementation(com.microsoft.appcenter.appcenter.crashes)
implementation(com.github.topjohnwu.libsu.core)
implementation(com.github.duanhong169.drawabletoolbox)
implementation(com.google.code.gson.gson)
implementation(com.squareup.okhttp3.okhttp)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(com.google.android.material.material)
implementation(androidx.constraintlayout.constraintlayout)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
compileOnly(libs.rovo89.xposed.api)
implementation(libs.yukihookapi)
ksp(libs.yukihookapi.ksp.xposed)
implementation(libs.kavaref.core)
implementation(libs.kavaref.extension)
implementation(libs.project.promote)
implementation(libs.microsoft.appcenter.analytics)
implementation(libs.microsoft.appcenter.crashes)
implementation(libs.libsu)
implementation(libs.drawabletoolbox)
implementation(libs.gson)
implementation(libs.okhttp)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}

View File

@@ -5,27 +5,41 @@ pluginManagement {
mavenCentral()
}
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.8"
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
maven("https://api.xposed.info/")
maven("https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases")
}
}
sweetProperty {
plugins {
id("com.highcapable.gropify") version "1.0.0"
}
gropify {
global {
all {
common {
permanentKeyValues(
"GITHUB_CI_COMMIT_ID" to "",
"APP_CENTER_SECRET" to ""
)
generateFrom(ROOT_PROJECT, SYSTEM_ENV)
includeKeys(
"GITHUB_CI_COMMIT_ID" to "",
"APP_CENTER_SECRET" to "",
"^project\\..*\$".toRegex()
)
locations(GropifyLocation.RootProject, GropifyLocation.SystemEnv)
}
sourcesCode {
propertiesFileNames(".secret/secret.properties")
android {
existsPropertyFiles(".secret/secret.properties")
includeKeys("GITHUB_CI_COMMIT_ID", "APP_CENTER_SECRET")
// 关闭类型自动转换功能,防止一些特殊 "COMMIT ID" 被生成为数值
isEnableTypeAutoConversion = false
useTypeAutoConversion = false
}
}
rootProject { all { isEnable = false } }
rootProject { common { isEnabled = false } }
}
rootProject.name = "AppErrorsTracking"
include(":module-app", ":demo-app")