From cf41ed9cf8919fa5b0d575ddf2d22496dbab498b Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:00:22 +0000 Subject: [PATCH] Deduplicate lib build scripts (#1392) --- build.gradle.kts | 14 ---------- .../src/main/kotlin/lib-android.gradle.kts | 26 +++++++++++++++++++ lib/cookieinterceptor/build.gradle.kts | 22 +--------------- lib/cryptoaes/build.gradle.kts | 21 +-------------- lib/dataimage/build.gradle.kts | 23 +--------------- lib/i18n/build.gradle.kts | 21 +-------------- lib/lzstring/build.gradle.kts | 11 +------- lib/randomua/build.gradle.kts | 22 +--------------- lib/speedbinb/build.gradle.kts | 19 +------------- lib/synchrony/build.gradle.kts | 21 +-------------- lib/textinterceptor/build.gradle.kts | 22 +--------------- lib/unpacker/build.gradle.kts | 11 +------- 12 files changed, 36 insertions(+), 197 deletions(-) create mode 100644 buildSrc/src/main/kotlin/lib-android.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 08af62017..92ab568b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,17 +1,3 @@ -buildscript { - repositories { - mavenCentral() - google() - maven(url = "https://plugins.gradle.org/m2/") - } - dependencies { - classpath(libs.gradle.agp) - classpath(libs.gradle.kotlin) - classpath(libs.gradle.serialization) - classpath(libs.gradle.kotlinter) - } -} - allprojects { repositories { mavenCentral() diff --git a/buildSrc/src/main/kotlin/lib-android.gradle.kts b/buildSrc/src/main/kotlin/lib-android.gradle.kts new file mode 100644 index 000000000..2bacfb8d3 --- /dev/null +++ b/buildSrc/src/main/kotlin/lib-android.gradle.kts @@ -0,0 +1,26 @@ +plugins { + id("com.android.library") + kotlin("android") + id("kotlinx-serialization") +} + +android { + compileSdk = AndroidConfig.compileSdk + + defaultConfig { + minSdk = AndroidConfig.minSdk + } + + namespace = "eu.kanade.tachiyomi.lib.${project.name}" + + buildFeatures { + resValues = false + shaders = false + } +} + +// TODO: use versionCatalogs.named("libs") in Gradle 8.5 +val libs = project.extensions.getByType().named("libs") +dependencies { + compileOnly(libs.findBundle("common").get()) +} diff --git a/lib/cookieinterceptor/build.gradle.kts b/lib/cookieinterceptor/build.gradle.kts index de414c340..c26cbc8a8 100644 --- a/lib/cookieinterceptor/build.gradle.kts +++ b/lib/cookieinterceptor/build.gradle.kts @@ -1,23 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.cookieinterceptor" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) - compileOnly(libs.okhttp) + id("lib-android") } diff --git a/lib/cryptoaes/build.gradle.kts b/lib/cryptoaes/build.gradle.kts index a9c8a57c6..c26cbc8a8 100644 --- a/lib/cryptoaes/build.gradle.kts +++ b/lib/cryptoaes/build.gradle.kts @@ -1,22 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.cryptoaes" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) + id("lib-android") } diff --git a/lib/dataimage/build.gradle.kts b/lib/dataimage/build.gradle.kts index eebbf7808..c26cbc8a8 100644 --- a/lib/dataimage/build.gradle.kts +++ b/lib/dataimage/build.gradle.kts @@ -1,24 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.dataimage" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) - compileOnly(libs.okhttp) - compileOnly(libs.jsoup) + id("lib-android") } diff --git a/lib/i18n/build.gradle.kts b/lib/i18n/build.gradle.kts index f21bb7314..c26cbc8a8 100644 --- a/lib/i18n/build.gradle.kts +++ b/lib/i18n/build.gradle.kts @@ -1,22 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.i18n" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) + id("lib-android") } diff --git a/lib/lzstring/build.gradle.kts b/lib/lzstring/build.gradle.kts index 3aa58a627..c26cbc8a8 100644 --- a/lib/lzstring/build.gradle.kts +++ b/lib/lzstring/build.gradle.kts @@ -1,12 +1,3 @@ plugins { - `java-library` - kotlin("jvm") -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) + id("lib-android") } diff --git a/lib/randomua/build.gradle.kts b/lib/randomua/build.gradle.kts index 36ef0d678..c26cbc8a8 100644 --- a/lib/randomua/build.gradle.kts +++ b/lib/randomua/build.gradle.kts @@ -1,23 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") - id("kotlinx-serialization") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.randomua" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.bundles.common) + id("lib-android") } diff --git a/lib/speedbinb/build.gradle.kts b/lib/speedbinb/build.gradle.kts index 4a4078161..861160903 100644 --- a/lib/speedbinb/build.gradle.kts +++ b/lib/speedbinb/build.gradle.kts @@ -1,24 +1,7 @@ plugins { - id("com.android.library") - kotlin("android") - id("kotlinx-serialization") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.speedbinb" -} - -repositories { - mavenCentral() + id("lib-android") } dependencies { - compileOnly(libs.bundles.common) implementation(project(":lib:textinterceptor")) } diff --git a/lib/synchrony/build.gradle.kts b/lib/synchrony/build.gradle.kts index c178641a2..c26cbc8a8 100644 --- a/lib/synchrony/build.gradle.kts +++ b/lib/synchrony/build.gradle.kts @@ -1,22 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.synchrony" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.bundles.common) + id("lib-android") } diff --git a/lib/textinterceptor/build.gradle.kts b/lib/textinterceptor/build.gradle.kts index f7102a8a4..c26cbc8a8 100644 --- a/lib/textinterceptor/build.gradle.kts +++ b/lib/textinterceptor/build.gradle.kts @@ -1,23 +1,3 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdk = AndroidConfig.compileSdk - - defaultConfig { - minSdk = AndroidConfig.minSdk - } - - namespace = "eu.kanade.tachiyomi.lib.textinterceptor" -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) - compileOnly(libs.okhttp) + id("lib-android") } diff --git a/lib/unpacker/build.gradle.kts b/lib/unpacker/build.gradle.kts index 3aa58a627..c26cbc8a8 100644 --- a/lib/unpacker/build.gradle.kts +++ b/lib/unpacker/build.gradle.kts @@ -1,12 +1,3 @@ plugins { - `java-library` - kotlin("jvm") -} - -repositories { - mavenCentral() -} - -dependencies { - compileOnly(libs.kotlin.stdlib) + id("lib-android") }