From 2b5d9fd76b9b7b629921bc793553cd4a571eda00 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 21 Jan 2023 05:04:22 +0100 Subject: [PATCH] Move shared configuration to subprojects in root Gradle file (#8951) * Move shared configuration to subprojects in root Gradle file * Missed but not forgotten * Review changes --- app/build.gradle.kts | 25 ------------------- build.gradle.kts | 44 +++++++++++++++++++++++++++++++++ core/build.gradle.kts | 16 ------------ i18n/build.gradle.kts | 15 ----------- macrobenchmark/build.gradle.kts | 14 ----------- source-api/build.gradle.kts | 12 --------- 6 files changed, 44 insertions(+), 82 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7e6126557..b2570e887 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,4 +1,3 @@ -import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jmailen.gradle.kotlinter.tasks.LintTask @@ -6,7 +5,6 @@ plugins { id("com.android.application") id("com.mikepenz.aboutlibraries.plugin") kotlin("android") - id("tachiyomi.lint") kotlin("plugin.serialization") id("com.github.zellius.shortcut-helper") id("com.squareup.sqldelight") @@ -22,13 +20,9 @@ val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") android { namespace = "eu.kanade.tachiyomi" - compileSdk = AndroidConfig.compileSdk - ndkVersion = AndroidConfig.ndk defaultConfig { applicationId = "eu.kanade.tachiyomi" - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk versionCode = 94 versionName = "0.14.3" @@ -143,17 +137,6 @@ android { kotlinCompilerExtensionVersion = compose.versions.compiler.get() } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - - isCoreLibraryDesugaringEnabled = true - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - sqldelight { database("Database") { packageName = "eu.kanade.tachiyomi" @@ -167,8 +150,6 @@ dependencies { implementation(project(":core")) implementation(project(":source-api")) - coreLibraryDesugaring(libs.desugar) - // Compose implementation(platform(compose.bom)) implementation(compose.activity) @@ -304,12 +285,6 @@ androidComponents { } tasks { - withType { - useJUnitPlatform() - testLogging { - events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) - } - } withType().configureEach { exclude { it.file.path.contains("generated[\\\\/]".toRegex()) } diff --git a/build.gradle.kts b/build.gradle.kts index 10b653f9c..2957e6ace 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,8 @@ +import com.android.build.gradle.BaseExtension +import com.android.build.gradle.BasePlugin +import org.gradle.api.tasks.testing.logging.TestLogEvent +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile + buildscript { dependencies { classpath(libs.android.shortcut.gradle) @@ -11,6 +16,45 @@ plugins { alias(kotlinx.plugins.serialization) apply false } +subprojects { + tasks.withType { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + } + + tasks.withType { + useJUnitPlatform() + testLogging { + events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) + } + } + + plugins.withType { + plugins.apply("tachiyomi.lint") + configure { + compileSdkVersion(AndroidConfig.compileSdk) + defaultConfig { + minSdk = AndroidConfig.minSdk + targetSdk = AndroidConfig.targetSdk + ndk { + version = AndroidConfig.ndk + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + isCoreLibraryDesugaringEnabled = true + } + + dependencies { + add("coreLibraryDesugaring", libs.desugar) + } + } + } +} + tasks.register("clean") { delete(rootProject.buildDir) } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 0334387a5..2c2f64a6b 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,27 +1,11 @@ plugins { id("com.android.library") kotlin("android") - id("tachiyomi.lint") kotlin("plugin.serialization") } android { namespace = "eu.kanade.tachiyomi.core" - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } } dependencies { diff --git a/i18n/build.gradle.kts b/i18n/build.gradle.kts index e0d5f475d..beee80656 100644 --- a/i18n/build.gradle.kts +++ b/i18n/build.gradle.kts @@ -1,25 +1,10 @@ plugins { id("com.android.library") kotlin("android") - id("tachiyomi.lint") } android { namespace = "eu.kanade.tachiyomi.i18n" - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } lint { disable.addAll(listOf("MissingTranslation", "ExtraTranslation")) diff --git a/macrobenchmark/build.gradle.kts b/macrobenchmark/build.gradle.kts index 0b32ad047..c47779767 100644 --- a/macrobenchmark/build.gradle.kts +++ b/macrobenchmark/build.gradle.kts @@ -1,26 +1,12 @@ plugins { id("com.android.test") kotlin("android") - id("tachiyomi.lint") } android { namespace = "tachiyomi.macrobenchmark" - compileSdk = AndroidConfig.compileSdk - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } defaultConfig { - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/source-api/build.gradle.kts b/source-api/build.gradle.kts index b530eba00..7034078b6 100644 --- a/source-api/build.gradle.kts +++ b/source-api/build.gradle.kts @@ -1,28 +1,16 @@ plugins { id("com.android.library") kotlin("android") - id("tachiyomi.lint") kotlin("plugin.serialization") } android { namespace = "eu.kanade.tachiyomi.source" - compileSdk = AndroidConfig.compileSdk defaultConfig { - minSdk = AndroidConfig.minSdk - targetSdk = AndroidConfig.targetSdk consumerProguardFile("consumer-proguard.pro") } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } } dependencies {