gradle: Migrate to Kotlin DSL

Kotlin DSL is the new default DSL for Android projects

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-08-18 22:32:35 +05:30
parent f648f6af49
commit c8228f45cc
5 changed files with 222 additions and 234 deletions

View File

@@ -1,212 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
* Copyright (C) 2022, The Calyx Institute
* Copyright (C) 2023, grrfe <grrfe@420blaze.it>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.parcelize'
id 'com.google.devtools.ksp'
id 'org.jetbrains.kotlin.kapt'
id 'androidx.navigation.safeargs.kotlin'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.starter.easylauncher'
id 'dev.rikka.tools.refine'
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
android {
namespace 'com.aurora.store'
compileSdk 33
defaultConfig {
applicationId "com.aurora.store"
minSdk 21
targetSdk 33
versionCode 48
versionName "4.3.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
nightly {
initWith release
applicationIdSuffix = ".nightly"
}
debug {
applicationIdSuffix = ".debug"
}
}
buildFeatures {
buildConfig true
viewBinding true
aidl true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
lint {
lintConfig file("lint.xml")
}
androidResources {
generateLocaleConfig true
}
}
kapt {
correctErrorTypes = true
}
easylauncher {
buildTypes {
nightly {
filters chromeLike()
}
debug {
filters chromeLike()
}
}
}
dependencies {
//Protobuf
implementation "com.google.protobuf:protobuf-javalite:3.22.3"
//Google's Goodies
implementation "com.google.android.material:material:1.9.0"
implementation "com.google.code.gson:gson:2.10.1"
//AndroidX
implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.vectordrawable:vectordrawable:1.1.0"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
//Arch LifeCycle
def life_version = '2.6.1'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$life_version"
implementation "androidx.lifecycle:lifecycle-service:$life_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$life_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$life_version"
//Arch Navigation
def nav_version = '2.6.0'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
//Glide
def glide_version = '4.15.1'
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
//Shimmer
implementation "com.facebook.shimmer:shimmer:0.5.0"
//Epoxy
def epoxy_version = '5.1.2'
implementation "com.airbnb.android:epoxy:$epoxy_version"
ksp "com.airbnb.android:epoxy-processor:$epoxy_version"
//HTTP Clients
implementation "com.squareup.okhttp3:okhttp:4.11.0"
//Fetch - Downloader
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.6"
//EventBus
implementation "org.greenrobot:eventbus:3.3.1"
//Lib-SU
implementation "com.github.topjohnwu.libsu:core:5.0.5"
//Love <3
implementation "com.gitlab.AuroraOSS:gplayapi:3.1.4"
//Browser
implementation 'androidx.browser:browser:1.5.0'
//Shizuku
def shizuku_version = '13.1.1'
compileOnly "dev.rikka.hidden:stub:4.2.0"
implementation "dev.rikka.tools.refine:runtime:4.3.0"
implementation "dev.rikka.shizuku:api:${shizuku_version}"
implementation "dev.rikka.shizuku:provider:${shizuku_version}"
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
//Test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
//WorkManager
implementation "androidx.work:work-runtime-ktx:2.8.1"
}
Properties props = new Properties()
def propFile = new File("signing.properties")
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey("STORE_FILE") && props.containsKey("STORE_PASSWORD") &&
props.containsKey("KEY_ALIAS") && props.containsKey("KEY_PASSWORD")) {
android.signingConfigs.release.storeFile = file(props["STORE_FILE"])
android.signingConfigs.release.storePassword = props["STORE_PASSWORD"]
android.signingConfigs.release.keyAlias = props["KEY_ALIAS"]
android.signingConfigs.release.keyPassword = props["KEY_PASSWORD"]
} else {
println "signing.properties found but some entries are missing"
android.buildTypes.release.signingConfig = null
}
} else {
println "signing.properties not found"
android.buildTypes.release.signingConfig = null
}

210
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,210 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
* Copyright (C) 2022, The Calyx Institute
* Copyright (C) 2023, grrfe <grrfe@420blaze.it>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.parcelize")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.kapt")
id("androidx.navigation.safeargs.kotlin")
id("org.jlleitschuh.gradle.ktlint")
id("com.starter.easylauncher")
id("dev.rikka.tools.refine")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
android {
namespace = "com.aurora.store"
compileSdk = 33
defaultConfig {
applicationId = "com.aurora.store"
minSdk = 21
targetSdk = 33
versionCode = 48
versionName = "4.3.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
if (File("signing.properties").exists()) {
create("release") {
val properties = Properties().apply {
File("signing.properties").inputStream().use { load(it) }
}
keyAlias = properties["KEY_ALIAS"] as String
keyPassword = properties["KEY_PASSWORD"] as String
storeFile = file(properties["STORE_FILE"] as String)
storePassword = properties["KEY_PASSWORD"] as String
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
if (File("signing.properties").exists()) {
signingConfig = signingConfigs.getByName("release")
}
}
register("nightly") {
initWith(getByName("release"))
applicationIdSuffix = ".nightly"
}
debug {
applicationIdSuffix = ".debug"
}
}
buildFeatures {
buildConfig = true
viewBinding = true
aidl = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
lint {
lintConfig = file("lint.xml")
}
androidResources {
generateLocaleConfig = true
}
}
kapt {
correctErrorTypes = true
}
easylauncher {
buildTypes {
register("nightly") {
setFilters(chromeLike())
}
register("debug") {
setFilters(chromeLike())
}
}
}
dependencies {
//Protobuf
implementation("com.google.protobuf:protobuf-javalite:3.22.3")
//Google's Goodies
implementation("com.google.android.material:material:1.9.0")
implementation("com.google.code.gson:gson:2.10.1")
//AndroidX
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.viewpager2:viewpager2:1.0.0")
implementation("androidx.vectordrawable:vectordrawable:1.1.0")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
//Arch LifeCycle
val life_version = "2.6.1"
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$life_version")
implementation("androidx.lifecycle:lifecycle-service:$life_version")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$life_version")
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$life_version")
//Arch Navigation
val nav_version = "2.6.0"
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
//Glide
val glide_version = "4.15.1"
implementation("com.github.bumptech.glide:glide:$glide_version")
kapt("com.github.bumptech.glide:compiler:$glide_version")
//Shimmer
implementation("com.facebook.shimmer:shimmer:0.5.0")
//Epoxy
val epoxy_version = "5.1.2"
implementation("com.airbnb.android:epoxy:$epoxy_version")
ksp("com.airbnb.android:epoxy-processor:$epoxy_version")
//HTTP Clients
implementation("com.squareup.okhttp3:okhttp:4.11.0")
//Fetch - Downloader
implementation("androidx.tonyodev.fetch2:xfetch2:3.1.6")
//EventBus
implementation("org.greenrobot:eventbus:3.3.1")
//Lib-SU
implementation("com.github.topjohnwu.libsu:core:5.0.5")
//Love <3
implementation("com.gitlab.AuroraOSS:gplayapi:3.1.4")
//Browser
implementation("androidx.browser:browser:1.5.0")
//Shizuku
val shizuku_version = "13.1.1"
compileOnly("dev.rikka.hidden:stub:4.2.0")
implementation("dev.rikka.tools.refine:runtime:4.3.0")
implementation("dev.rikka.shizuku:api:${shizuku_version}")
implementation("dev.rikka.shizuku:provider:${shizuku_version}")
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
//Test
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
//WorkManager
implementation("androidx.work:work-runtime-ktx:2.8.1")
}

View File

@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here. # Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the # You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle. # proguardFiles setting in build.gradle.kts.
# #
# For more details, see # For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html # http://developer.android.com/guide/developing/tools/proguard.html

View File

@@ -20,16 +20,12 @@
*/ */
plugins { plugins {
id 'com.android.application' version '8.1.0' apply false id("com.android.application") version "8.1.0" apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false id("org.jetbrains.kotlin.android") version "1.9.0" apply false
id 'org.jetbrains.kotlin.plugin.parcelize' version '1.9.0' apply false id("org.jetbrains.kotlin.plugin.parcelize") version "1.9.0" apply false
id 'com.google.devtools.ksp' version '1.9.0-1.0.13' apply false id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
id 'androidx.navigation.safeargs.kotlin' version '2.6.0' apply false id("androidx.navigation.safeargs.kotlin") version "2.6.0" apply false
id 'org.jlleitschuh.gradle.ktlint' version '11.4.0' apply false id("org.jlleitschuh.gradle.ktlint") version "11.4.0" apply false
id 'com.starter.easylauncher' version '6.2.0' apply false id("com.starter.easylauncher") version "6.2.0" apply false
id 'dev.rikka.tools.refine' version '4.3.0' apply false id("dev.rikka.tools.refine") version "4.3.0" apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
} }

View File

@@ -31,15 +31,9 @@ dependencyResolutionManagement {
google() google()
jcenter() // Required for androidx.tonyodev.fetch2 jcenter() // Required for androidx.tonyodev.fetch2
mavenCentral() mavenCentral()
maven { maven("https://jitpack.io/")
name 'JitPack' maven("https://maven.google.com/")
url 'https://jitpack.io/'
}
maven {
name 'Google'
url 'https://maven.google.com/'
}
} }
} }
include ':app' include(":app")
rootProject.name = "AuroraStore4" rootProject.name = "AuroraStore4"