Migrate build scripts to use version catalogs and kts
This commit is contained in:
parent
2ad8e7b95a
commit
0660d39672
9 changed files with 208 additions and 126 deletions
|
@ -1,93 +0,0 @@
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
apply plugin: 'kotlin-kapt'
|
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
||||||
def keystoreProperties = new Properties()
|
|
||||||
if (keystorePropertiesFile.exists()) {
|
|
||||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 33
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "com.simplemobiletools.musicplayer"
|
|
||||||
minSdkVersion 23
|
|
||||||
targetSdkVersion 33
|
|
||||||
versionCode 114
|
|
||||||
versionName "5.17.1"
|
|
||||||
setProperty("archivesBaseName", "music-player")
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
|
||||||
}
|
|
||||||
|
|
||||||
signingConfigs {
|
|
||||||
if (keystorePropertiesFile.exists()) {
|
|
||||||
release {
|
|
||||||
keyAlias keystoreProperties['keyAlias']
|
|
||||||
keyPassword keystoreProperties['keyPassword']
|
|
||||||
storeFile file(keystoreProperties['storeFile'])
|
|
||||||
storePassword keystoreProperties['storePassword']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
debug {
|
|
||||||
applicationIdSuffix ".debug"
|
|
||||||
}
|
|
||||||
release {
|
|
||||||
minifyEnabled true
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
if (keystorePropertiesFile.exists()) {
|
|
||||||
signingConfig signingConfigs.release
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flavorDimensions "variants"
|
|
||||||
productFlavors {
|
|
||||||
core {}
|
|
||||||
fdroid {}
|
|
||||||
prepaid {}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
|
||||||
}
|
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
checkReleaseBuilds false
|
|
||||||
abortOnError false
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
coreLibraryDesugaringEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:f76d729b9d'
|
|
||||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
|
||||||
implementation 'androidx.media:media:1.6.0'
|
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
||||||
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
|
|
||||||
implementation 'androidx.media3:media3-session:1.1.1'
|
|
||||||
implementation 'androidx.media3:media3-exoplayer:1.1.1'
|
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
|
||||||
implementation 'com.airbnb.android:lottie:3.6.1'
|
|
||||||
implementation 'com.github.bjoernpetersen:m3u-parser:1.3.0'
|
|
||||||
implementation 'me.grantland:autofittextview:0.2.1'
|
|
||||||
coreLibraryDesugaring('com.android.tools:desugar_jdk_libs:1.1.5')
|
|
||||||
|
|
||||||
// higher versions of jaudiotagger not compatible with <= API 25 devices
|
|
||||||
// https://bitbucket.org/ijabz/jaudiotagger/issues/149/some-nio-classes-are-unavailable-while
|
|
||||||
implementation "net.jthink:jaudiotagger:2.2.5"
|
|
||||||
kapt "androidx.room:room-compiler:2.5.2"
|
|
||||||
implementation "androidx.room:room-runtime:2.5.2"
|
|
||||||
annotationProcessor "androidx.room:room-compiler:2.5.2"
|
|
||||||
}
|
|
109
app/build.gradle.kts
Normal file
109
app/build.gradle.kts
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import org.jetbrains.kotlin.konan.properties.Properties
|
||||||
|
import java.io.FileInputStream
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android)
|
||||||
|
alias(libs.plugins.kotlinAndroid)
|
||||||
|
alias(libs.plugins.ksp)
|
||||||
|
}
|
||||||
|
|
||||||
|
val keystorePropertiesFile: File = rootProject.file("keystore.properties")
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdk = project.libs.versions.app.build.compileSDKVersion.get().toInt()
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = libs.versions.app.version.appId.get()
|
||||||
|
minSdk = project.libs.versions.app.build.minimumSDK.get().toInt()
|
||||||
|
targetSdk = project.libs.versions.app.build.targetSDK.get().toInt()
|
||||||
|
versionName = project.libs.versions.app.version.versionName.get()
|
||||||
|
versionCode = project.libs.versions.app.version.versionCode.get().toInt()
|
||||||
|
setProperty("archivesBaseName", "music-player")
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
register("release") {
|
||||||
|
keyAlias = keystoreProperties["keyAlias"] as String
|
||||||
|
keyPassword = keystoreProperties["keyPassword"] as String
|
||||||
|
storeFile = file(keystoreProperties["storeFile"] as String)
|
||||||
|
storePassword = keystoreProperties["storePassword"] as String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
applicationIdSuffix = ".debug"
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions.add("variants")
|
||||||
|
productFlavors {
|
||||||
|
register("core")
|
||||||
|
register("fdroid")
|
||||||
|
register("prepaid")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
getByName("main").java.srcDirs("src/main/kotlin")
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
val currentJavaVersionFromLibs = JavaVersion.valueOf(libs.versions.app.build.javaVersion.get().toString())
|
||||||
|
sourceCompatibility = currentJavaVersionFromLibs
|
||||||
|
targetCompatibility = currentJavaVersionFromLibs
|
||||||
|
isCoreLibraryDesugaringEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile> {
|
||||||
|
kotlinOptions.jvmTarget = project.libs.versions.app.build.kotlinJVMTarget.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace = libs.versions.app.version.appId.get()
|
||||||
|
|
||||||
|
lint {
|
||||||
|
checkReleaseBuilds = false
|
||||||
|
abortOnError = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.simple.mobile.tools.commons)
|
||||||
|
implementation(libs.eventbus)
|
||||||
|
implementation(libs.androidx.media)
|
||||||
|
implementation(libs.androidx.swiperefreshlayout)
|
||||||
|
implementation(libs.androidx.constraintlayout)
|
||||||
|
implementation(libs.androidx.lifecycle.process)
|
||||||
|
implementation(libs.androidx.media3.session)
|
||||||
|
implementation(libs.androidx.media3.exoplayer)
|
||||||
|
implementation(libs.lottie)
|
||||||
|
implementation(libs.m3u.parser)
|
||||||
|
implementation(libs.autofittextview)
|
||||||
|
implementation(libs.jaudiotagger)
|
||||||
|
coreLibraryDesugaring(libs.desugar.jdk.libs)
|
||||||
|
|
||||||
|
implementation(libs.bundles.room)
|
||||||
|
ksp(libs.androidx.room.compiler)
|
||||||
|
}
|
30
build.gradle
30
build.gradle
|
@ -1,30 +0,0 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.7.10'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url "https://jitpack.io" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task clean(type: Delete) {
|
|
||||||
delete rootProject.buildDir
|
|
||||||
}
|
|
11
build.gradle.kts
Normal file
11
build.gradle.kts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android).apply(false)
|
||||||
|
alias(libs.plugins.kotlinAndroid).apply(false)
|
||||||
|
alias(libs.plugins.ksp).apply(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Delete>("clean") {
|
||||||
|
delete {
|
||||||
|
rootProject.buildDir
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx8192m
|
org.gradle.jvmargs=-Xmx8192m
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
|
69
gradle/libs.versions.toml
Normal file
69
gradle/libs.versions.toml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
[versions]
|
||||||
|
#jetbrains
|
||||||
|
autofittextview = "0.2.1"
|
||||||
|
desugar_jdk_libs = "2.0.3"
|
||||||
|
# higher versions of jaudiotagger not compatible with <= API 25 devices
|
||||||
|
# https://bitbucket.org/ijabz/jaudiotagger/issues/149/some-nio-classes-are-unavailable-while
|
||||||
|
jaudiotagger = "2.2.5"
|
||||||
|
kotlin = "1.9.0"
|
||||||
|
#KSP
|
||||||
|
ksp = "1.9.0-1.0.12"
|
||||||
|
#AndroidX
|
||||||
|
androidx-constraintlayout = "2.1.4"
|
||||||
|
androidx-swiperefreshlayout = "1.1.0"
|
||||||
|
androidx-lifecycleprocess = "2.6.1"
|
||||||
|
#Eventbus
|
||||||
|
eventbus = "3.3.1"
|
||||||
|
#Room
|
||||||
|
lottie = "6.1.0"
|
||||||
|
m3uParser = "1.3.0"
|
||||||
|
media = "1.6.0"
|
||||||
|
media3 = "1.1.1"
|
||||||
|
room = "2.5.2"
|
||||||
|
#Simple Mobile Tools
|
||||||
|
simple-commons = "adb7dea7ee"
|
||||||
|
#Gradle
|
||||||
|
gradlePlugins-agp = "8.1.0"
|
||||||
|
#build
|
||||||
|
app-build-compileSDKVersion = "34"
|
||||||
|
app-build-targetSDK = "34"
|
||||||
|
app-build-minimumSDK = "23"
|
||||||
|
app-build-javaVersion = "VERSION_17"
|
||||||
|
app-build-kotlinJVMTarget = "17"
|
||||||
|
#Helpers
|
||||||
|
shortcut-badger = "1.1.22"
|
||||||
|
#versioning
|
||||||
|
app-version-appId = "com.simplemobiletools.musicplayer"
|
||||||
|
app-version-versionCode = "114"
|
||||||
|
app-version-versionName = "5.17.1"
|
||||||
|
[libraries]
|
||||||
|
#AndroidX
|
||||||
|
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" }
|
||||||
|
androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "androidx-lifecycleprocess" }
|
||||||
|
androidx-media = { module = "androidx.media:media", version.ref = "media" }
|
||||||
|
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3" }
|
||||||
|
androidx-media3-session = { module = "androidx.media3:media3-session", version.ref = "media3" }
|
||||||
|
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" }
|
||||||
|
#Room
|
||||||
|
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
|
||||||
|
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
|
||||||
|
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
|
||||||
|
#Simple Mobile Tools
|
||||||
|
simple-mobile-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons", version.ref = "simple-commons" }
|
||||||
|
#EventBus
|
||||||
|
eventbus = { module = "org.greenrobot:eventbus", version.ref = "eventbus" }
|
||||||
|
#Helpers
|
||||||
|
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
||||||
|
jaudiotagger = { module = "net.jthink:jaudiotagger", version.ref = "jaudiotagger" }
|
||||||
|
lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" }
|
||||||
|
autofittextview = { module = "me.grantland:autofittextview", version.ref = "autofittextview" }
|
||||||
|
m3u-parser = { module = "com.github.bjoernpetersen:m3u-parser", version.ref = "m3uParser" }
|
||||||
|
[bundles]
|
||||||
|
room = [
|
||||||
|
"androidx-room-ktx",
|
||||||
|
"androidx-room-runtime",
|
||||||
|
]
|
||||||
|
[plugins]
|
||||||
|
android = { id = "com.android.application", version.ref = "gradlePlugins-agp" }
|
||||||
|
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Mon Nov 02 17:54:10 CET 2020
|
#Thu Aug 31 16:28:32 IST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
include ':app'
|
|
16
settings.gradle.kts
Normal file
16
settings.gradle.kts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
maven { setUrl("https://jitpack.io") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
include(":app")
|
Loading…
Reference in a new issue