From 5ada97d60e4c58a6cb8656e6d99286428e13d126 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Thu, 4 Jul 2024 12:00:24 +0200 Subject: [PATCH] Migrate APP gradle file to kotlin dsl --- api/build.gradle.kts | 2 +- app/build.gradle | 97 ------------------------------------------ app/build.gradle.kts | 97 ++++++++++++++++++++++++++++++++++++++++++ app/proguard-rules.pro | 2 +- db/build.gradle.kts | 26 +++++------ 5 files changed, 113 insertions(+), 111 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts diff --git a/api/build.gradle.kts b/api/build.gradle.kts index bc8e5d27..47c8397a 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -17,7 +17,7 @@ android { sourceSets { getByName("androidTest") { - kotlin.srcDirs("$projectDir/androidTest/assets") + assets.srcDirs("$projectDir/androidTest/assets") } } diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 722755fd..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,97 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.readrops.app' - compileSdk rootProject.ext.compileSdkVersion - - defaultConfig { - applicationId "com.readrops.app" - minSdk rootProject.ext.minSdkVersion - targetSdk rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - - debug { - minifyEnabled false - shrinkResources false - - testCoverageEnabled true - applicationIdSuffix ".debug" - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - coreLibraryDesugaringEnabled true - - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = '17' - } - - buildFeatures { - buildConfig true - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion = "1.4.0" - } - - lint { - abortOnError false - } -} - -dependencies { - implementation project(':api') - implementation project(':db') - - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - - implementation(libs.bundles.compose) - implementation(libs.compose.activity) - - implementation 'androidx.palette:palette-ktx:1.0.0' - - implementation(libs.bundles.voyager) - implementation(libs.bundles.lifecycle) - implementation(libs.bundles.coil) - - implementation(libs.bundles.coroutines) - androidTestImplementation(libs.coroutines.test) - - implementation(libs.bundles.room) - implementation(libs.bundles.paging) - - implementation(libs.bundles.koin) - androidTestImplementation(libs.bundles.kointest) - - androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.9.0' - - coreLibraryDesugaring(libs.jdk.desugar) - - implementation(libs.encrypted.preferences) - implementation(libs.work.manager) -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..2b33bc94 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,97 @@ +plugins { + id("com.android.application") + kotlin("android") +} + +android { + namespace = "com.readrops.app" + compileSdk = 34 + + defaultConfig { + applicationId = "com.readrops.app" + minSdk = 21 + targetSdk = 34 + versionCode = 15 + versionName = "2.0-beta01" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + + debug { + isMinifyEnabled = false + isShrinkResources = false + + isTestCoverageEnabled = true + applicationIdSuffix = ".debug" + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } + + compileOptions { + isCoreLibraryDesugaringEnabled = true + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + buildConfig = true + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.4.0" + } + + lint { + abortOnError = false + } +} + +dependencies { + implementation(project(":api")) + implementation(project(":db")) + + implementation("androidx.core:core-ktx:1.7.0") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("com.google.android.material:material:1.8.0") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + + implementation(libs.bundles.compose) + implementation(libs.compose.activity) + + implementation("androidx.palette:palette-ktx:1.0.0") + + implementation(libs.bundles.voyager) + implementation(libs.bundles.lifecycle) + implementation(libs.bundles.coil) + + implementation(libs.bundles.coroutines) + androidTestImplementation(libs.coroutines.test) + + implementation(libs.bundles.room) + implementation(libs.bundles.paging) + + implementation(libs.bundles.koin) + androidTestImplementation(libs.bundles.kointest) + + androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.9.0") + + coreLibraryDesugaring(libs.jdk.desugar) + + implementation(libs.encrypted.preferences) + implementation(libs.work.manager) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # 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 # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/db/build.gradle.kts b/db/build.gradle.kts index ae5debc1..6a9bcbc5 100644 --- a/db/build.gradle.kts +++ b/db/build.gradle.kts @@ -1,27 +1,27 @@ plugins { id("com.android.library") - id("org.jetbrains.kotlin.android") - id("org.jetbrains.kotlin.kapt") - id("org.jetbrains.kotlin.plugin.parcelize") + kotlin("android") + kotlin("kapt") + kotlin("plugin.parcelize") } android { namespace = "com.readrops.db" - compileSdkVersion(34) + compileSdk = 34 defaultConfig { - minSdkVersion(21) - targetSdkVersion(34) - buildToolsVersion("34.0.0") + minSdk = 21 + targetSdk = 34 + buildToolsVersion ="34.0.0" - /*javaCompileOptions { + javaCompileOptions { annotationProcessorOptions { - arguments = listOf( + arguments += mapOf( "room.incremental" to "true", - "room.schemaLocation" to "$projectDir/schemas".toString() + "room.schemaLocation" to "$projectDir/schemas".toString() ) } - }*/ + } testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") @@ -29,7 +29,7 @@ android { sourceSets { getByName("androidTest") { - kotlin.srcDirs("$projectDir/schemas") + assets.srcDirs("$projectDir/schemas") } } @@ -70,6 +70,8 @@ kapt { } } + + dependencies { api("androidx.core:core-ktx:1.6.0") api("androidx.appcompat:appcompat:1.3.0")