From a634a8bf53aa74c5e4fd1e9a4769b3da984d06b2 Mon Sep 17 00:00:00 2001 From: Daniel Schaal Date: Fri, 16 Jul 2021 05:52:22 +0200 Subject: Convert gradle scripts to kotlin --- app/build.gradle | 156 --------------------------------------------------- app/build.gradle.kts | 152 +++++++++++++++++++++++++++++++++++++++++++++++++ build.gradle | 49 ---------------- build.gradle.kts | 48 ++++++++++++++++ settings.gradle | 21 ------- settings.gradle.kts | 21 +++++++ 6 files changed, 221 insertions(+), 226 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 delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 86bf8ca3..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2015-2016 Daniel Schaal - * - * This file is part of OCReader. - * - * OCReader 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 3 of the License, or - * (at your option) any later version. - * - * OCReader 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 OCReader. If not, see . - * - */ - -plugins { - id "com.android.application" - id "kotlin-android" - id "kotlin-parcelize" - id "kotlin-kapt" - id "realm-android" - id "com.mikepenz.aboutlibraries.plugin" -} - -android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" - - buildFeatures.dataBinding = true - - defaultConfig { - applicationId "email.schaal.ocreader" - minSdkVersion 23 - targetSdkVersion 30 - versionCode 57 - versionName "0.57" - - archivesBaseName = "${getApplicationId()}_${getVersionCode()}" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - buildTypes { - debug { - minifyEnabled true - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - applicationIdSuffix ".debug" - } - release { - minifyEnabled true - shrinkResources true - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - } - } - - lintOptions { - abortOnError false - disable 'MissingTranslation' - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } -} - -ext { - versions = [ - okhttp : "4.9.1", - retrofit : "2.9.0", - glide : "4.12.0", - lifecycle : "2.3.1", - moshi : "1.12.0", - core : "1.6.0", - annotation : "1.2.0", - junit_ext : "1.1.3", - espresso : "3.4.0" - ] -} - -dependencies { - implementation ("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") - implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") - - implementation ("androidx.core:core-ktx:${versions.core}") - implementation("androidx.core:core-ktx:${versions.core}") - - implementation("androidx.appcompat:appcompat:1.3.0") - - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:${versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:${versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-common-java8:${versions.lifecycle}") - - implementation("androidx.work:work-runtime-ktx:2.5.0") - implementation("androidx.fragment:fragment-ktx:1.3.5") - implementation("androidx.activity:activity-ktx:1.2.3") - - implementation("androidx.recyclerview:recyclerview:1.2.1") - implementation("androidx.palette:palette-ktx:1.0.0") - implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") - implementation("androidx.preference:preference-ktx:1.1.1") - implementation("androidx.viewpager2:viewpager2:1.1.0-alpha01") - implementation("androidx.constraintlayout:constraintlayout:2.0.4") - - implementation("androidx.annotation:annotation:${versions.annotation}") - kapt("androidx.annotation:annotation:${versions.annotation}") - - implementation("com.google.android.material:material:1.4.0") - - implementation("com.mikepenz:aboutlibraries:$about_libraries_version") - - implementation("org.jsoup:jsoup:1.13.1") - - implementation("com.squareup.okhttp3:okhttp:${versions.okhttp}") - - implementation("com.squareup.retrofit2:retrofit:${versions.retrofit}") - implementation("com.squareup.retrofit2:converter-moshi:${versions.retrofit}") - - implementation("com.squareup.moshi:moshi:${versions.moshi}") - kapt("com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}") - - implementation("com.github.bumptech.glide:glide:${versions.glide}") - kapt("com.github.bumptech.glide:compiler:${versions.glide}") - - implementation("com.github.bumptech.glide:okhttp3-integration:${versions.glide}") - implementation("com.github.bumptech.glide:recyclerview-integration:${versions.glide}") - - implementation("com.github.zafarkhaja:java-semver:0.9.0") - - androidTestImplementation("androidx.test.ext:junit:${versions.junit_ext}") - androidTestImplementation("androidx.test.espresso:espresso-core:${versions.espresso}") - androidTestImplementation("androidx.test.espresso:espresso-intents:${versions.espresso}") - - androidTestImplementation("com.squareup.okhttp3:mockwebserver:${versions.okhttp}") - - testImplementation("androidx.test:core:1.4.0") - testImplementation("androidx.test.ext:junit:${versions.junit_ext}") - testImplementation("org.robolectric:robolectric:4.5.1") - testImplementation("junit:junit:4.13.2") -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..cc067abf --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2015-2016 Daniel Schaal + * + * This file is part of OCReader. + * + * OCReader 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 3 of the License, or + * (at your option) any later version. + * + * OCReader 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 OCReader. If not, see . + * + */ + +plugins { + id("com.android.application") + id("kotlin-android") + id("kotlin-parcelize") + id("kotlin-kapt") + id("realm-android") + id("com.mikepenz.aboutlibraries.plugin") +} + +android { + compileSdkVersion(30) + buildToolsVersion = "30.0.3" + + buildFeatures.dataBinding = true + + defaultConfig { + applicationId = "email.schaal.ocreader" + minSdkVersion(23) + targetSdkVersion(30) + versionCode = 57 + versionName = "0.57" + + base.archivesName.set("${applicationId}_${versionCode}") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + buildTypes { + getByName("debug") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + applicationIdSuffix = ".debug" + } + getByName("release") { + isShrinkResources = true + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + lintOptions { + isAbortOnError = true + disable.add("MissingTranslation") + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + } + } +} + +dependencies { + val okhttp = "4.9.1" + val retrofit = "2.9.0" + val glide = "4.12.0" + val lifecycle = "2.3.1" + val moshi = "1.12.0" + val core = "1.6.0" + val annotation = "1.2.0" + val junit_ext = "1.1.3" + val espresso = "3.4.0" + + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + + implementation("androidx.core:core-ktx:${core}") + implementation("androidx.core:core-ktx:${core}") + + implementation("androidx.appcompat:appcompat:1.3.0") + + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${lifecycle}") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:${lifecycle}") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:${lifecycle}") + implementation("androidx.lifecycle:lifecycle-common-java8:${lifecycle}") + + implementation("androidx.work:work-runtime-ktx:2.5.0") + implementation("androidx.fragment:fragment-ktx:1.3.5") + implementation("androidx.activity:activity-ktx:1.2.3") + + implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation("androidx.palette:palette-ktx:1.0.0") + implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") + implementation("androidx.preference:preference-ktx:1.1.1") + implementation("androidx.viewpager2:viewpager2:1.1.0-alpha01") + implementation("androidx.constraintlayout:constraintlayout:2.0.4") + + implementation("androidx.annotation:annotation:${annotation}") + kapt("androidx.annotation:annotation:${annotation}") + + implementation("com.google.android.material:material:1.4.0") + + implementation("com.mikepenz:aboutlibraries:8.9.0") + + implementation("org.jsoup:jsoup:1.13.1") + + implementation("com.squareup.okhttp3:okhttp:${okhttp}") + + implementation("com.squareup.retrofit2:retrofit:${retrofit}") + implementation("com.squareup.retrofit2:converter-moshi:${retrofit}") + + implementation("com.squareup.moshi:moshi:${moshi}") + kapt("com.squareup.moshi:moshi-kotlin-codegen:${moshi}") + + implementation("com.github.bumptech.glide:glide:${glide}") + kapt("com.github.bumptech.glide:compiler:${glide}") + + implementation("com.github.bumptech.glide:okhttp3-integration:${glide}") + implementation("com.github.bumptech.glide:recyclerview-integration:${glide}") + + implementation("com.github.zafarkhaja:java-semver:0.9.0") + + androidTestImplementation("androidx.test.ext:junit:${junit_ext}") + androidTestImplementation("androidx.test.espresso:espresso-core:${espresso}") + androidTestImplementation("androidx.test.espresso:espresso-intents:${espresso}") + + androidTestImplementation("com.squareup.okhttp3:mockwebserver:${okhttp}") + + testImplementation("androidx.test:core:1.4.0") + testImplementation("androidx.test.ext:junit:${junit_ext}") + testImplementation("org.robolectric:robolectric:4.5.1") + testImplementation("junit:junit:4.13.2") +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0841fc1a..00000000 --- a/build.gradle +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2015-2016 Daniel Schaal - * - * This file is part of OCReader. - * - * OCReader 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 3 of the License, or - * (at your option) any later version. - * - * OCReader 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 OCReader. If not, see . - * - */ - -buildscript { - ext.kotlin_version = "1.5.21" - ext.about_libraries_version = "8.9.0" - - repositories { - mavenCentral() - google() - } - dependencies { - classpath("com.android.tools.build:gradle:4.2.2") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") - classpath("io.realm:realm-gradle-plugin:10.6.1") - } -} - -plugins { - id("com.mikepenz.aboutlibraries.plugin") version "${about_libraries_version}" apply false -} - -allprojects { - repositories { - mavenCentral() - google() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..68aa4ac0 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2015-2016 Daniel Schaal + * + * This file is part of OCReader. + * + * OCReader 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 3 of the License, or + * (at your option) any later version. + * + * OCReader 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 OCReader. If not, see . + * + */ + +buildscript { + repositories { + mavenCentral() + google() + } + dependencies { + classpath("com.android.tools.build:gradle:4.2.2") + // keep kotlin version in sync with app/build.gradle.kts + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21") + classpath("io.realm:realm-gradle-plugin:10.6.1") + } +} + +plugins { + // keep aboutlibraries version in sync with app/build.gradle.kts + id("com.mikepenz.aboutlibraries.plugin") version "8.9.0" apply false +} + +allprojects { + repositories { + mavenCentral() + google() + } +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 959b31f2..00000000 --- a/settings.gradle +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2015 Daniel Schaal - * - * This file is part of OCReader. - * - * OCReader 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 3 of the License, or - * (at your option) any later version. - * - * OCReader 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 OCReader. If not, see . - * - */ - -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..99357ef7 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 Daniel Schaal + * + * This file is part of OCReader. + * + * OCReader 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 3 of the License, or + * (at your option) any later version. + * + * OCReader 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 OCReader. If not, see . + * + */ + +include(":app") -- cgit v1.2.3