Skip to content

Commit

Permalink
Migrate gradle to kts
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasnlm committed Nov 18, 2023
1 parent e8eba31 commit 6ea22af
Show file tree
Hide file tree
Showing 47 changed files with 569 additions and 796 deletions.
46 changes: 22 additions & 24 deletions about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
namespace = "dev.lucasnlm.antimine.about"

defaultConfig {
minSdk = 21
compileSdk = 34
minSdk = libs.versions.minSdk.get().toInt()
compileSdk = libs.versions.compileSdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
Expand All @@ -22,12 +22,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}

buildFeatures {
Expand All @@ -37,8 +37,6 @@ android {
}

dependencies {
// Dependencies must be hardcoded to support F-droid

implementation(project(":core"))
implementation(project(":i18n"))
implementation(project(":preferences"))
Expand All @@ -48,37 +46,37 @@ dependencies {
implementation(project(":external"))

// Google
implementation("com.google.android.material:material:1.10.0")
implementation(libs.material)

// AndroidX
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.activity:activity-ktx:1.8.0")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation(libs.appcompat)
implementation(libs.activity.ktx)
implementation(libs.fragment.ktx)

// RecyclerView
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation(libs.recyclerview)

// Constraint
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation(libs.constraintlayout)

// Lifecycle
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
implementation(libs.lifecycle.viewmodel.ktx)

// Koin
implementation("io.insert-koin:koin-android:3.1.2")
testImplementation("io.insert-koin:koin-test:3.1.2")
implementation(libs.koin.android)
testImplementation(libs.koin.test)

// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)
testImplementation(libs.kotlinx.coroutines.test)

// Kotlin Lib
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.10")
implementation(libs.kotlin.stdlib)

// Unit Tests
testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-core:4.6.1")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
testImplementation("io.mockk:mockk:1.13.5")
testImplementation(libs.junit)
testImplementation(libs.mockito.core)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.mockk)
}
24 changes: 3 additions & 21 deletions about/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn com.google.android.material.R$attr
-dontwarn dev.lucasnlm.antimine.i18n.R$string
98 changes: 50 additions & 48 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

val isGoogleBuild: Boolean by rootProject.extra
val isReleaseBuild: Boolean by rootProject.extra
val isGoogleBuild: Boolean = System.getenv("IS_GOOGLE_BUILD")?.isNotBlank() == true
val isReleaseBuild: Boolean = System.getenv("IS_RELEASE_BUILD")?.isNotBlank() == true

plugins {
id("com.android.application")
Expand All @@ -13,11 +13,11 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode = 1705111
versionName = "17.5.11"
minSdk = 21
targetSdk = 34
compileSdk = 34
versionCode = 1706001
versionName = "17.6.0"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
compileSdk = libs.versions.compileSdk.get().toInt()
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -56,12 +56,12 @@ android {
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

testOptions {
Expand Down Expand Up @@ -107,15 +107,17 @@ android {
versionNameSuffix = " F"
}
}

lint {
lintConfig = file("$rootDir/lint.xml")
}
}

val googleImplementation by configurations
val googleInstantImplementation by configurations
val fossImplementation by configurations

dependencies {
// Dependencies must be hardcoded to support F-droid

implementation(project(":external"))
implementation(project(":common"))
implementation(project(":control"))
Expand All @@ -139,59 +141,59 @@ dependencies {
googleInstantImplementation(project(":audio-low"))

// AndroidX
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.multidex:multidex:2.0.1")
implementation("androidx.activity:activity-ktx:1.8.0")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation(libs.appcompat)
implementation(libs.preference.ktx)
implementation(libs.recyclerview)
implementation(libs.multidex)
implementation(libs.activity.ktx)
implementation(libs.fragment.ktx)

// Lifecycle
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-common-java8:2.6.2")
implementation(libs.lifecycle.viewmodel.ktx)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.lifecycle.livedata.ktx)
implementation(libs.lifecycle.common.java8)

// Constraint
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation(libs.constraintlayout)

// Google
implementation("com.google.android.material:material:1.10.0")
implementation(libs.material)

// Koin
implementation("io.insert-koin:koin-android:3.1.2")
testImplementation("io.insert-koin:koin-test:3.1.2")
implementation(libs.koin.android)
testImplementation(libs.koin.test)

// Kotlin
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.10")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlin.stdlib)
testImplementation(libs.kotlinx.coroutines.test)

// Konfetti
implementation("nl.dionsegijn:konfetti-xml:2.0.3")
implementation(libs.konfetti.xml)

// Tests
testImplementation("junit:junit:4.13.2")
testImplementation("androidx.core:core-ktx:1.12.0")
testImplementation("androidx.test:core-ktx:1.5.0")
testImplementation("androidx.test:rules:1.5.0")
testImplementation("androidx.test:runner:1.5.2")
testImplementation("androidx.test.espresso:espresso-core:3.5.1")
testImplementation("androidx.fragment:fragment-testing:1.6.2")
testImplementation("org.robolectric:robolectric:4.5.1")
testImplementation("androidx.test.ext:junit:1.1.5")
testImplementation("io.mockk:mockk:1.13.5")
testImplementation(libs.junit)
testImplementation(libs.core.ktx)
testImplementation(libs.test.core.ktx)
testImplementation(libs.rules)
testImplementation(libs.runner)
testImplementation(libs.espresso.core)
testImplementation(libs.fragment.testing)
testImplementation(libs.robolectric)
testImplementation(libs.ext.junit)
testImplementation(libs.mockk)

// Core library
androidTestImplementation("androidx.test:core:1.5.0")
androidTestImplementation(libs.test.core)

// AndroidJUnitRunner and JUnit Rules
androidTestImplementation("androidx.test:core:1.5.0")
androidTestImplementation("androidx.test:core-ktx:1.5.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.test:runner:1.5.2")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestUtil("androidx.test:orchestrator:1.4.2")
androidTestImplementation(libs.test.core)
androidTestImplementation(libs.test.core.ktx)
androidTestImplementation(libs.espresso.core)
androidTestImplementation(libs.runner)
androidTestImplementation(libs.rules)
androidTestUtil(libs.orchestrator)
}

tasks.withType<Test>().configureEach {
Expand Down Expand Up @@ -221,7 +223,7 @@ tasks.withType<Test>().configureEach {
}

// The following code disables Google Services when building for F-Droid
if (isGoogleBuild) {
if (!isGoogleBuild) {
android.applicationVariants.configureEach {
if (flavorName == "foss") {
project
Expand Down
4 changes: 4 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@

-dontwarn javax.annotation.processing.AbstractProcessor
-dontwarn javax.annotation.processing.SupportedOptions
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn com.google.android.material.R$attr
-dontwarn dev.lucasnlm.antimine.i18n.R$string

10 changes: 5 additions & 5 deletions audio-low/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
namespace = "dev.lucasnlm.antimine.audio"

defaultConfig {
minSdk = 21
compileSdk = 34
minSdk = libs.versions.minSdk.get().toInt()
compileSdk = libs.versions.compileSdk.get().toInt()
}

buildTypes {
Expand All @@ -19,12 +19,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}

buildFeatures {
Expand Down
24 changes: 3 additions & 21 deletions audio-low/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn com.google.android.material.R$attr
-dontwarn dev.lucasnlm.antimine.i18n.R$string
10 changes: 5 additions & 5 deletions audio/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
namespace = "dev.lucasnlm.antimine.audio"

defaultConfig {
minSdk = 21
compileSdk = 34
minSdk = libs.versions.minSdk.get().toInt()
compileSdk = libs.versions.compileSdk.get().toInt()
}

buildTypes {
Expand All @@ -19,12 +19,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}

buildFeatures {
Expand Down
24 changes: 3 additions & 21 deletions audio/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn com.google.android.material.R$attr
-dontwarn dev.lucasnlm.antimine.i18n.R$string
Loading

0 comments on commit 6ea22af

Please sign in to comment.