From 8eafad72e6f61e2a7d4e374ec1d83d3874db576b Mon Sep 17 00:00:00 2001 From: Dinar Khakimov <85668474+mdrlzy@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:44:18 +0500 Subject: [PATCH] Migrate to gradle kts (#127) --- app/build.gradle | 163 ----------------------------------------- app/build.gradle.kts | 168 +++++++++++++++++++++++++++++++++++++++++++ build.gradle | 19 ----- build.gradle.kts | 10 +++ 4 files changed, 178 insertions(+), 182 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 diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 1015c65d4..000000000 --- a/app/build.gradle +++ /dev/null @@ -1,163 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlin-parcelize' - id 'com.google.devtools.ksp' - id 'com.google.gms.google-services' - id 'com.google.firebase.crashlytics' - id "org.jlleitschuh.gradle.ktlint" -} - -android { - compileSdk 34 - - defaultConfig { - applicationId "dev.arkbuilders.rate" - minSdk 26 - targetSdk 34 - versionCode 3 - versionName "1.2.0" - setProperty("archivesBaseName", "ark-rate") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - - ksp { - arg("room.schemaLocation", "$projectDir/schemas") - } - } - - signingConfigs { - testRelease { - storeFile project.rootProject.file('keystore.jks') - storePassword "sw0rdf1sh" - keyAlias "ark-builders-test" - keyPassword "rybamech" - v1SigningEnabled true - v2SigningEnabled true - } - } - - buildTypes { - debug { - debuggable true - manifestPlaceholders = [ - appIcon : "@mipmap/ic_launcher_debug", - appLabel: "@string/app_name_debug" - ] - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.testRelease - - manifestPlaceholders = [ - appIcon : "@mipmap/ic_launcher", - appLabel: "@string/app_name" - ] - } - } - - flavorDimensions = ["publishTarget"] - productFlavors { - github { - dimension "publishTarget" - buildConfigField "boolean", "GOOGLE_PLAY_BUILD", "false" - } - - googleplay { - dimension "publishTarget" - buildConfigField "boolean", "GOOGLE_PLAY_BUILD", "true" - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - - buildFeatures { - buildConfig = true - compose true - } - composeOptions { - kotlinCompilerExtensionVersion compose_version - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } - namespace 'dev.arkbuilders.rate' -} - -dependencies { - implementation project(':fiaticons') - implementation project(':cryptoicons') - - implementation "dev.arkbuilders.components:about:0.1.1" - implementation "androidx.compose.ui:ui:1.6.8" - implementation "androidx.navigation:navigation-compose:2.7.7" - implementation "androidx.compose.material3:material3:1.2.1" - implementation "androidx.compose.ui:ui-tooling-preview:1.6.8" - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4' - implementation 'androidx.activity:activity-compose:1.9.1' - implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1" - - implementation "com.google.dagger:dagger:2.50" - implementation 'androidx.glance:glance-appwidget:1.1.0' - ksp "com.google.dagger:dagger-compiler:2.50" - - implementation "androidx.room:room-runtime:2.6.1" - implementation "androidx.room:room-ktx:2.6.1" - ksp "androidx.room:room-compiler:2.6.1" - - implementation "androidx.datastore:datastore-preferences:1.1.1" - - implementation 'com.jakewharton.timber:timber:5.0.1' - - implementation "androidx.work:work-runtime-ktx:2.8.1" - implementation 'io.github.oleksandrbalan:tagcloud:1.1.0' - - implementation("org.orbit-mvi:orbit-compose:4.6.1") - implementation("org.orbit-mvi:orbit-viewmodel:6.1.0") - - implementation("io.arrow-kt:arrow-core:1.2.1") - implementation("io.arrow-kt:arrow-fx-coroutines:1.2.1") - - implementation 'com.github.androidmads:QRGenerator:1.0.1' - - implementation("io.github.raamcosta.compose-destinations:animations-core:1.9.62") - ksp 'io.github.raamcosta.compose-destinations:ksp:1.9.62' - - implementation 'com.squareup.retrofit2:retrofit:2.11.0' - implementation 'com.squareup.retrofit2:converter-gson:2.9.0' - implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' - - implementation(platform("com.google.firebase:firebase-bom:33.1.2")) - implementation("com.google.firebase:firebase-analytics-ktx") - implementation("com.google.firebase:firebase-crashlytics-ktx") - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' - androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.8" - debugImplementation "androidx.compose.ui:ui-tooling:1.6.8" - debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.8" -} - -ktlint { - android.set(true) - outputToConsole = true -} - -tasks.preBuild.dependsOn ktlintCheck - -tasks.preBuild.dependsOn ktlintFormat - -tasks.ktlintCheck.shouldRunAfter ktlintFormat diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 000000000..e1d5f77e2 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,168 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("kotlin-parcelize") + id("com.google.devtools.ksp") + id("com.google.gms.google-services") + id("com.google.firebase.crashlytics") + id("org.jlleitschuh.gradle.ktlint") +} + +android { + namespace = "dev.arkbuilders.rate" + compileSdk = 34 + + defaultConfig { + applicationId = "dev.arkbuilders.rate" + minSdk = 26 + targetSdk = 34 + versionCode = 3 + versionName = "1.2.0" + setProperty("archivesBaseName", "ark-rate") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + + ksp { + arg("room.schemaLocation", "$projectDir/schemas") + } + } + + signingConfigs { + create("testRelease") { + storeFile = project.rootProject.file("keystore.jks") + storePassword = "sw0rdf1sh" + keyAlias = "ark-builders-test" + keyPassword = "rybamech" + } + } + + buildTypes { + debug { + isDebuggable = true + addManifestPlaceholders( + mapOf( + "appIcon" to "@mipmap/ic_launcher_debug", + "appLabel" to "@string/app_name_debug", + ), + ) + } + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro", + ) + signingConfig = signingConfigs.getByName("testRelease") + + addManifestPlaceholders( + mapOf( + "appIcon" to "@mipmap/ic_launcher_debug", + "appLabel" to "@string/app_name_debug", + ), + ) + } + } + + flavorDimensions += "publishTarget" + productFlavors { + create("github") { + dimension = "publishTarget" + buildConfigField("boolean", "GOOGLE_PLAY_BUILD", "false") + } + + create("googleplay") { + dimension = "publishTarget" + buildConfigField("boolean", "GOOGLE_PLAY_BUILD", "true") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + buildConfig = true + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.4" + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation(project(":fiaticons")) + implementation(project(":cryptoicons")) + + implementation("dev.arkbuilders.components:about:0.1.1") + implementation("androidx.compose.ui:ui:1.6.8") + implementation("androidx.navigation:navigation-compose:2.7.7") + implementation("androidx.compose.material3:material3:1.2.1") + implementation("androidx.compose.ui:ui-tooling-preview:1.6.8") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4") + implementation("androidx.activity:activity-compose:1.9.1") + implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1") + + implementation("com.google.dagger:dagger:2.50") + implementation("androidx.glance:glance-appwidget:1.1.0") + ksp("com.google.dagger:dagger-compiler:2.50") + + implementation("androidx.room:room-runtime:2.6.1") + implementation("androidx.room:room-ktx:2.6.1") + ksp("androidx.room:room-compiler:2.6.1") + + implementation("androidx.datastore:datastore-preferences:1.1.1") + + implementation("com.jakewharton.timber:timber:5.0.1") + + implementation("androidx.work:work-runtime-ktx:2.8.1") + implementation("io.github.oleksandrbalan:tagcloud:1.1.0") + + implementation("org.orbit-mvi:orbit-compose:4.6.1") + implementation("org.orbit-mvi:orbit-viewmodel:6.1.0") + + implementation("io.arrow-kt:arrow-core:1.2.1") + implementation("io.arrow-kt:arrow-fx-coroutines:1.2.1") + + implementation("com.github.androidmads:QRGenerator:1.0.1") + + implementation("io.github.raamcosta.compose-destinations:animations-core:1.9.62") + ksp("io.github.raamcosta.compose-destinations:ksp:1.9.62") + + implementation("com.squareup.retrofit2:retrofit:2.11.0") + implementation("com.squareup.retrofit2:converter-gson:2.9.0") + implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") + + implementation(platform("com.google.firebase:firebase-bom:33.1.2")) + implementation("com.google.firebase:firebase-analytics-ktx") + implementation("com.google.firebase:firebase-crashlytics-ktx") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.6.8") + debugImplementation("androidx.compose.ui:ui-tooling:1.6.8") + debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.8") +} + +ktlint { + android.set(true) + outputToConsole.set(true) +} + +tasks.getByPath(":app:preBuild").dependsOn("ktlintCheck") + +tasks.getByPath(":app:preBuild").dependsOn("ktlintFormat") + +tasks.getByPath("ktlintCheck").shouldRunAfter("ktlintFormat") diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 93aae980b..000000000 --- a/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -buildscript { - ext { - compose_version = '1.5.4' - } - ext.kotlin_version = '1.9.20' -}// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '8.1.3' apply false - id 'com.android.library' version '8.1.3' apply false - id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false - id 'com.google.devtools.ksp' version '1.9.22-1.0.17' - id 'com.google.gms.google-services' version '4.4.2' apply false - id 'com.google.firebase.crashlytics' version "3.0.1" apply false - id "org.jlleitschuh.gradle.ktlint" version "12.1.1" -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..7e2642b51 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "8.1.3" apply false + id("com.android.library") version "8.1.3" apply false + id("org.jetbrains.kotlin.android") version "1.9.20" apply false + id("com.google.devtools.ksp") version "1.9.22-1.0.17" + id("com.google.gms.google-services") version "4.4.2" apply false + id("com.google.firebase.crashlytics") version "3.0.1" apply false + id("org.jlleitschuh.gradle.ktlint") version "12.1.1" +}