chore: migrate to version catalog, Gropify

This commit is contained in:
2025-11-12 18:50:55 +08:00
parent 64e7c24224
commit 72d08553f3
6 changed files with 101 additions and 138 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

@@ -1,29 +1,29 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.kotlin.ksp)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.ksp)
}
android {
namespace = property.project.app.packageName
compileSdk = property.project.android.compileSdk
namespace = gropify.project.app.packageName
compileSdk = gropify.project.android.compileSdk
signingConfigs {
create("universal") {
keyAlias = property.project.app.signing.keyAlias
keyPassword = property.project.app.signing.keyPassword
storeFile = rootProject.file(property.project.app.signing.storeFilePath)
storePassword = property.project.app.signing.storePassword
keyAlias = gropify.project.app.signing.keyAlias
keyPassword = gropify.project.app.signing.keyPassword
storeFile = rootProject.file(gropify.project.app.signing.storeFilePath)
storePassword = gropify.project.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.app.versionName
versionCode = property.project.app.versionCode
applicationId = gropify.project.app.packageName
minSdk = gropify.project.android.minSdk
targetSdk = gropify.project.android.targetSdk
versionName = gropify.project.app.versionName
versionCode = gropify.project.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -50,40 +50,31 @@ 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}-v$currentVersion-$currentType.apk")
output.outputFileName.set("${gropify.project.name}-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.github.topjohnwu.libsu.core)
implementation(com.github.duanhong169.drawabletoolbox)
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.libsu)
implementation(libs.drawabletoolbox)
implementation(libs.okhttp)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}

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 {

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

@@ -0,0 +1,42 @@
[versions]
agp = "8.13.1"
kotlin = "2.2.21"
ksp = "2.2.21-2.0.4"
project-promote = "1.0.1"
rovo89-xposed-api = "82"
yukihookapi = "1.3.1"
kavaref-core = "1.0.2"
kavaref-extension = "1.0.1"
libsu = "5.2.2"
drawabletoolbox = "1.0.7"
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" }
[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" }
libsu = { group = "com.github.topjohnwu.libsu", name = "core", version.ref = "libsu" }
drawabletoolbox = { group = "com.github.duanhong169", name = "drawabletoolbox", version.ref = "drawabletoolbox" }
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,84 +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.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.github.topjohnwu.libsu:
core:
version: 5.2.2
auto-update: false
com.github.duanhong169:
drawabletoolbox:
version: 1.0.7
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

@@ -5,23 +5,36 @@ 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 {
includeKeys(
"GITHUB_CI_COMMIT_ID",
"^project\\..*\$".toRegex()
)
permanentKeyValues("GITHUB_CI_COMMIT_ID" to "")
generateFrom(ROOT_PROJECT, SYSTEM_ENV)
locations(GropifyLocation.RootProject, GropifyLocation.SystemEnv)
}
sourcesCode {
android {
includeKeys("GITHUB_CI_COMMIT_ID")
// 关闭类型自动转换功能,防止一些特殊 "COMMIT ID" 被生成为数值
isEnableTypeAutoConversion = false
useTypeAutoConversion = false
}
}
rootProject { all { isEnable = false } }
rootProject { common { isEnabled = false } }
}
rootProject.name = "MIUINativeNotifyIcon"
include(":app")