From d36d12c2392217141c49bf331d47e5983833b5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 6 Sep 2023 13:21:58 +0200 Subject: [PATCH] Migrate to version catalog --- app/build.gradle | 90 --------------------------------- app/build.gradle.kts | 101 ++++++++++++++++++++++++++++++++++++++ build.gradle | 30 ----------- build.gradle.kts | 4 ++ gradle/libs.versions.toml | 43 ++++++++++++++++ settings.gradle | 1 - settings.gradle.kts | 16 ++++++ 7 files changed, 164 insertions(+), 121 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 gradle/libs.versions.toml delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index d27b0f93..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,90 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - -android { - namespace "com.simplemobiletools.filemanager.pro" - compileSdk 34 - - defaultConfig { - applicationId "com.simplemobiletools.filemanager.pro" - minSdk 23 - targetSdk 34 - versionCode 135 - versionName "6.16.0" - multiDexEnabled true - setProperty("archivesBaseName", "file-manager") - vectorDrawables.useSupportLibrary = true - } - - signingConfigs { - if (keystorePropertiesFile.exists()) { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - } - } - } - - buildFeatures { - buildConfig true - viewBinding true - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - } - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - if (keystorePropertiesFile.exists()) { - signingConfig signingConfigs.release - } - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = '17' - } - - flavorDimensions = ["variants"] - productFlavors { - core {} - fdroid {} - prepaid {} - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - checkReleaseBuilds false - abortOnError false - } -} - -dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:d1629c7f1a' - implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' - implementation 'com.github.Stericson:RootTools:df729dcb13' - implementation 'com.github.Stericson:RootShell:1.6' - implementation 'com.alexvasilkov:gesture-views:2.5.2' - implementation 'androidx.documentfile:documentfile:1.0.1' - implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'me.grantland:autofittextview:0.2.1' - implementation 'net.lingala.zip4j:zip4j:2.11.5' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..2d546728 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,101 @@ +import java.io.FileInputStream +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.konan.properties.Properties + +plugins { + alias(libs.plugins.android) + alias(libs.plugins.kotlinAndroid) +} + +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", "file-manager") + multiDexEnabled = true + vectorDrawables.useSupportLibrary = true + } + + signingConfigs { + if (keystorePropertiesFile.exists()) { + register("release") { + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + storeFile = file(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + } + } + } + + 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 + } + + tasks.withType { + 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.tools.commons) + implementation(libs.androidx.documentfile) + implementation(libs.androidx.swiperefreshlayout) + implementation(libs.androidpdfviewer) + implementation(libs.roottools) + implementation(libs.rootshell) + implementation(libs.gestureviews) + implementation(libs.autofittextview) + implementation(libs.zip4j) +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 36758110..00000000 --- a/build.gradle +++ /dev/null @@ -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.9.0' - - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' - 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 -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..f0236317 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + alias(libs.plugins.android).apply(false) + alias(libs.plugins.kotlinAndroid).apply(false) +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..fda6737d --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,43 @@ +[versions] +#jetbrains +kotlin = "1.9.0" +#AndroidX +androidx-swiperefreshlayout = "1.1.0" +androidx-documentfile = "1.0.1" +#Simple tools +simple-commons = "d1629c7f1a" +#Other +autofittextview = "0.2.1" +gestureviews = "2.5.2" +androidpdfviewer = "e6a533125b" +rootshell = "1.6" +roottools = "df729dcb13" +zip4j = "2.11.5" +#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" +#versioning +app-version-appId = "com.simplemobiletools.filemanager.pro" +app-version-versionCode = "135" +app-version-versionName = "6.16.0" +[libraries] +#AndroidX +androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" } +androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "androidx-documentfile" } +#Simple Mobile Tools +simple-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons", version.ref = "simple-commons" } +#Other +androidpdfviewer = { module = "com.github.tibbi:AndroidPdfViewer", version.ref = "androidpdfviewer" } +autofittextview = { module = "me.grantland:autofittextview", version.ref = "autofittextview" } +gestureviews = { module = "com.alexvasilkov:gesture-views", version.ref = "gestureviews" } +rootshell = { module = "com.github.Stericson:RootShell", version.ref = "rootshell" } +roottools = { module = "com.github.Stericson:RootTools", version.ref = "roottools" } +zip4j = { module = "net.lingala.zip4j:zip4j", version.ref = "zip4j" } +[plugins] +android = { id = "com.android.application", version.ref = "gradlePlugins-agp" } +kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def4..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..45478cbe --- /dev/null +++ b/settings.gradle.kts @@ -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")