From c7a1f667be6221cb512a1b7b59820068354fba84 Mon Sep 17 00:00:00 2001 From: Jean-BaptisteC Date: Wed, 11 Oct 2023 20:51:50 +0200 Subject: [PATCH] Migrate Groovy to Kotlin DSL --- app/build.gradle | 101 ------------------------ app/build.gradle.kts | 105 +++++++++++++++++++++++++ app/proguard-rules.pro | 2 +- build.gradle | 16 ---- build.gradle.kts | 10 +++ settings.gradle => settings.gradle.kts | 4 +- 6 files changed, 118 insertions(+), 120 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 rename settings.gradle => settings.gradle.kts (84%) diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index a7182b44b..000000000 --- a/app/build.gradle +++ /dev/null @@ -1,101 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlinx-serialization' - id 'com.google.devtools.ksp' -} - -android { - compileSdk 33 - - defaultConfig { - applicationId "com.bnyro.translate" - minSdk 21 - targetSdk 33 - versionCode 38 - versionName "7.1" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - - ksp { - arg("room.schemaLocation", "$projectDir/schemas".toString()) - } - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - - debug { - debuggable true - applicationIdSuffix ".debug" - } - } - - flavorDimensions "version" - productFlavors { - libre { - dimension "version" - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion "1.4.2" - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } - namespace 'com.bnyro.translate' -} - -dependencies { - // Android Core - implementation 'androidx.core:core-ktx:1.10.1' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' - implementation 'androidx.activity:activity-compose:1.7.2' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - - // Compose - implementation "androidx.compose.ui:ui:$compose_version" - implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1' - implementation 'androidx.compose.material3:material3:1.2.0-alpha02' - implementation "androidx.compose.material:material-icons-extended:$compose_version" - androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" - debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" - debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" - implementation "androidx.navigation:navigation-compose:2.5.3" - - // Retrofit - implementation 'com.squareup.retrofit2:retrofit:2.9.0' - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0" - implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0' - implementation 'com.squareup.retrofit2:converter-scalars:2.9.0' - implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0' - - // Room database - implementation 'androidx.room:room-runtime:2.5.1' - ksp "androidx.room:room-compiler:2.5.1" - - // Tesseract OCR - implementation 'cz.adaptech.tesseract4android:tesseract4android-openmp:4.3.0' -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 000000000..063d866a1 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,105 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("kotlinx-serialization") + id("com.google.devtools.ksp") +} + +android { + compileSdk = 33 + + defaultConfig { + applicationId = "com.bnyro.translate" + minSdk = 21 + targetSdk = 33 + versionCode = 38 + versionName = "7.1" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + + ksp { + arg("room.schemaLocation", "$projectDir/schemas".toString()) + } + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + + debug { + isDebuggable = true + applicationIdSuffix = ".debug" + } + } + + flavorDimensions.add("version") + productFlavors { + create("libre") { + dimension = "version" + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.2" + } + packagingOptions { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } + namespace = "com.bnyro.translate" +} + +dependencies { + val compose_version: String by rootProject.extra + // Android Core + implementation("androidx.core:core-ktx:1.10.1") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") + implementation("androidx.activity:activity-compose:1.7.2") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + + // Compose + implementation("androidx.compose.ui:ui:$compose_version") + implementation("androidx.compose.ui:ui-tooling-preview:$compose_version") + implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") + implementation("androidx.compose.material3:material3:1.2.0-alpha02") + implementation("androidx.compose.material:material-icons-extended:$compose_version") + androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version") + debugImplementation("androidx.compose.ui:ui-tooling:$compose_version") + debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version") + implementation("androidx.navigation:navigation-compose:2.5.3") + + // Retrofit + implementation("com.squareup.retrofit2:retrofit:2.9.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0") + implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0") + implementation("com.squareup.retrofit2:converter-scalars:2.9.0") + implementation("com.squareup.okhttp3:logging-interceptor:4.11.0") + + // Room database + implementation("androidx.room:room-runtime:2.5.1") + ksp("androidx.room:room-compiler:2.5.1") + + // Tesseract OCR + implementation("cz.adaptech.tesseract4android:tesseract4android-openmp:4.3.0") +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 024fa0f46..2a1ab78cd 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/build.gradle b/build.gradle deleted file mode 100644 index 82446ae46..000000000 --- a/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -buildscript { - ext { - compose_version = '1.5.0-beta01' - } -}// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '8.0.1' apply false - id 'com.android.library' version '8.0.1' apply false - id 'org.jetbrains.kotlin.android' version '1.8.10' apply false - id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.10' - id 'com.google.devtools.ksp' version '1.8.10-1.0.9' apply false -} - -task clean(type: Delete) { - delete rootProject.buildDir -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..cc08084c1 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +buildscript { + val compose_version by extra("1.5.0-beta01") +}// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "8.0.1" apply false + id("com.android.library") version "8.0.1" apply false + id("org.jetbrains.kotlin.android") version "1.8.10" apply false + id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10" + id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false +} diff --git a/settings.gradle b/settings.gradle.kts similarity index 84% rename from settings.gradle rename to settings.gradle.kts index 5bb141342..ae26d92be 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -11,8 +11,8 @@ dependencyResolutionManagement { google() mavenCentral() // used for OCR - maven { url 'https://jitpack.io' } + maven { setUrl("https://jitpack.io") } } } rootProject.name = "Translate You" -include ':app' +include(":app")