chore: migrate to version catalog, Gropify

This commit is contained in:
2025-11-12 15:52:47 +08:00
parent d4a4973a7a
commit 333e73777f
7 changed files with 112 additions and 131 deletions

View File

@@ -1,5 +1,22 @@
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.android.library) apply false
autowire(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
}
allprojects {
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs.addAll(
"-opt-in=kotlin.ExperimentalStdlibApi",
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
}

View File

@@ -1,18 +1,18 @@
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.app.packageName
compileSdk = property.project.android.compileSdk
namespace = gropify.project.app.packageName
compileSdk = gropify.project.android.compileSdk
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 {
@@ -25,25 +25,17 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
buildFeatures { buildConfig = true }
lint { checkReleaseBuilds = false }
}
dependencies {
implementation(project(":projectpromote"))
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)
implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.junit.ext)
androidTestImplementation(libs.espresso.core)
}

View File

@@ -3,7 +3,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.code.style=official
kotlin.incremental.useClasspathSnapshot=true
# Project Configuration
project.name=ProjectPromote
project.description=An integrated dependency on my projects promotion for my own use.

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

@@ -0,0 +1,34 @@
[versions]
agp = "8.13.1"
kotlin = "2.2.21"
maven-publish = "0.35.0"
markwon = "4.6.2"
okhttp = "5.3.0"
lifecycle = "2.9.4"
core-ktx = "1.17.0"
appcompat = "1.7.1"
material = "1.13.0"
constraintlayout = "2.2.1"
junit-ext = "1.3.0"
espresso = "3.7.0"
junit = "4.13.2"
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
[libraries]
markwon-core = { group = "io.noties.markwon", name = "core", version.ref = "markwon" }
markwon-image = { group = "io.noties.markwon", name = "image", version.ref = "markwon" }
markwon-html = { group = "io.noties.markwon", name = "html", version.ref = "markwon" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
junit-ext = { group = "androidx.test.ext", name = "junit", version.ref = "junit-ext" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
junit = { group = "junit", name = "junit", version.ref = "junit" }

View File

@@ -1,60 +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:
plugins:
com.android.application:
alias: android-application
version: 8.13.0
com.android.library:
alias: android-library
version-ref: android-application
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 2.2.10
com.vanniktech.maven.publish:
alias: maven-publish
version: 0.34.0
libraries:
io.noties.markwon:
core:
version: 4.6.2
image:
version-ref: <this>::core
html:
version-ref: <this>::core
com.squareup.okhttp3:
okhttp:
version: 5.1.0
androidx.lifecycle:
lifecycle-runtime-ktx:
version: 2.9.3
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,15 +1,15 @@
plugins {
autowire(libs.plugins.android.library)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.maven.publish)
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.maven.publish)
}
android {
namespace = property.project.projectpromote.groupName
compileSdk = property.project.android.compileSdk
namespace = gropify.project.projectpromote.groupName
compileSdk = gropify.project.android.compileSdk
defaultConfig {
minSdk = property.project.android.minSdk
minSdk = gropify.project.android.minSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
@@ -23,28 +23,20 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
dependencies {
implementation(io.noties.markwon.core)
implementation(io.noties.markwon.image)
implementation(io.noties.markwon.html)
implementation(com.squareup.okhttp3.okhttp)
implementation(androidx.lifecycle.lifecycle.runtime.ktx)
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.markwon.core)
implementation(libs.markwon.image)
implementation(libs.markwon.html)
implementation(libs.okhttp)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.junit.ext)
androidTestImplementation(libs.espresso.core)
}
publishing {
@@ -64,23 +56,23 @@ publishing {
}
mavenPublishing {
coordinates(property.project.projectpromote.groupName, property.project.projectpromote.moduleName, property.project.projectpromote.version)
coordinates(gropify.project.projectpromote.groupName, gropify.project.projectpromote.moduleName, gropify.project.projectpromote.version)
pom {
name = property.project.name
description = property.project.description
url = property.project.url
name = gropify.project.name
description = gropify.project.description
url = gropify.project.url
licenses {
license {
name = property.project.licence.name
url = property.project.licence.url
distribution = property.project.licence.url
name = gropify.project.licence.name
url = gropify.project.licence.url
distribution = gropify.project.licence.url
}
}
developers {
developer {
id = property.project.developer.id
name = property.project.developer.name
email = property.project.developer.email
id = gropify.project.developer.id
name = gropify.project.developer.name
email = gropify.project.developer.email
}
}
}

View File

@@ -5,15 +5,22 @@ pluginManagement {
mavenCentral()
}
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.8"
}
sweetProperty {
global {
sourcesCode { isEnable = false }
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
rootProject { all { isEnable = false } }
}
plugins {
id("com.highcapable.gropify") version "1.0.0"
}
gropify {
global {
android { isEnabled = false }
}
rootProject { common { isEnabled = false } }
}
rootProject.name = "ProjectPromote"
include(":demo-app")