diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef2d64f5b..9c5441955 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,7 +108,7 @@ Extensions rely on [extensions-lib](https://github.com/tachiyomiorg/extensions-l ```gradle dependencies { - implementation(project(':lib-ratelimit')) + implementation project(':lib-ratelimit') } ``` @@ -118,7 +118,7 @@ dependencies { ```gradle dependencies { - implementation(project(':lib-dataimage')) + implementation project(':lib-dataimage') } ``` @@ -130,12 +130,12 @@ For example, an extension that needs coroutines, it could add the following: ```gradle dependencies { - compileOnly(libs.bundles.coroutines) + compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' + compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2' } ``` -> Note that several dependencies are already exposed to all extensions via Gradle version catalog. -> To view which are available view `libs.versions.toml` under the `gradle` folder +(Note that several dependencies are already exposed to all extensions via `common-dependencies.gradle`.) Notice that we're using `compileOnly` instead of `implementation`, since the app already contains it. You could use `implementation` instead for a new dependency, or you prefer not to rely on whatever the main app has at the expense of app size. diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..3ee68695b --- /dev/null +++ b/build.gradle @@ -0,0 +1,27 @@ +buildscript { + ext.kotlin_version = '1.4.32' + ext.coroutines_version = '1.4.3' + repositories { + mavenCentral() + google() + maven { url 'https://plugins.gradle.org/m2/' } + } + dependencies { + classpath 'com.android.tools.build:gradle:4.2.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath 'org.jmailen.gradle:kotlinter-gradle:3.4.0' + } +} + +allprojects { + repositories { + mavenCentral() + google() + maven { url 'https://jitpack.io' } + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 221231a1a..000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,27 +0,0 @@ -buildscript { - repositories { - mavenCentral() - google() - maven(url = "https://plugins.gradle.org/m2/") - } - dependencies { - val libs = project.extensions.getByType() - .named("libs") as org.gradle.accessors.dm.LibrariesForLibs - classpath(libs.gradle.agp) - classpath(libs.gradle.kotlin) - classpath(libs.gradle.serialization) - classpath(libs.gradle.kotlinter) - } -} - -allprojects { - repositories { - mavenCentral() - google() - maven(url = "https://jitpack.io") - } -} - -tasks.register("clean") { - delete(rootProject.buildDir) -} diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt new file mode 100644 index 000000000..5a209d904 --- /dev/null +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -0,0 +1,9 @@ +object Dependencies { + object kotlin { + const val version = "1.4.32" + const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" + } + + const val jsoup = "org.jsoup:jsoup:1.13.1" + const val okhttp = "com.squareup.okhttp3:okhttp:4.9.1" +} diff --git a/common-dependencies.gradle b/common-dependencies.gradle new file mode 100644 index 000000000..4c65ceb7e --- /dev/null +++ b/common-dependencies.gradle @@ -0,0 +1,15 @@ +// used both in common.gradle and themesources library +dependencies { + // Lib 1.2, but using specific commit so we don't need to bump up the version + compileOnly "com.github.tachiyomiorg:extensions-lib:58b2d3a" + + // These are provided by the app itself + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + + compileOnly 'com.github.inorichi.injekt:injekt-core:65b0440' + compileOnly 'com.squareup.okhttp3:okhttp:4.9.1' + compileOnly 'io.reactivex:rxjava:1.3.8' + compileOnly 'org.jsoup:jsoup:1.13.1' + compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.0' + compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0' +} diff --git a/common.gradle b/common.gradle index fa4222513..87d95583a 100644 --- a/common.gradle +++ b/common.gradle @@ -88,9 +88,9 @@ repositories { } dependencies { - implementation(project(":core")) - compileOnly(libs.bundles.common) + implementation project(":core") } +apply from: "$rootDir/common-dependencies.gradle" preBuild.dependsOn(lintKotlin) lintKotlin.dependsOn(formatKotlin) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml deleted file mode 100644 index a0318d1b9..000000000 --- a/gradle/libs.versions.toml +++ /dev/null @@ -1,29 +0,0 @@ -[versions] -kotlin_version = "1.4.32" -coroutines_version = "1.4.3" - -[libraries] -gradle-agp = { module = "com.android.tools.build:gradle", version = "4.2.1" } -gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin_version" } -gradle-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" } -gradle-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version = "3.4.0" } - -tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "58b2d3a" } - -kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" } -kotlin-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version = "1.2.0" } -kotlin-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.2.0" } - -coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines_version" } -coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" } - -injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" } -jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" } -okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.9.1" } -rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" } -rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" } - -[bundles] -common = ["tachiyomi-lib", "jsoup", "okhttp", "kotlin-stdlib", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json"] -coroutines = ["coroutines-core", "coroutines-android"] -reactivex = ["rxandroid"] diff --git a/lib/dataimage/build.gradle.kts b/lib/dataimage/build.gradle.kts index ccad53c68..003c09ec1 100644 --- a/lib/dataimage/build.gradle.kts +++ b/lib/dataimage/build.gradle.kts @@ -17,7 +17,7 @@ repositories { } dependencies { - compileOnly(libs.kotlin.stdlib) - compileOnly(libs.okhttp) - compileOnly(libs.jsoup) + compileOnly(Dependencies.kotlin.stdlib) + compileOnly(Dependencies.okhttp) + compileOnly(Dependencies.jsoup) } diff --git a/lib/ratelimit/build.gradle.kts b/lib/ratelimit/build.gradle.kts index 38826a541..ce110d9d3 100644 --- a/lib/ratelimit/build.gradle.kts +++ b/lib/ratelimit/build.gradle.kts @@ -17,6 +17,6 @@ repositories { } dependencies { - compileOnly(libs.kotlin.stdlib) - compileOnly(libs.okhttp) + compileOnly(Dependencies.kotlin.stdlib) + compileOnly(Dependencies.okhttp) } diff --git a/multisrc/build.gradle.kts b/multisrc/build.gradle.kts index c76a58361..5038992bc 100644 --- a/multisrc/build.gradle.kts +++ b/multisrc/build.gradle.kts @@ -20,19 +20,18 @@ repositories { mavenCentral() } -dependencies { - compileOnly(libs.bundles.common) -} +// dependencies +apply("$rootDir/common-dependencies.gradle") tasks { val generateExtensions by registering { doLast { val isWindows = System.getProperty("os.name").toString().toLowerCase().contains("win") var classPath = (configurations.debugCompileOnly.get().asFileTree.toList() + - listOf( + listOf( configurations.androidApis.get().asFileTree.first().absolutePath, // android.jar path "$projectDir/build/intermediates/aar_main_jar/debug/classes.jar" // jar made from this module - )) + )) .joinToString(if (isWindows) ";" else ":") var javaPath = "${System.getProperty("java.home")}/bin/java" diff --git a/settings.gradle.kts b/settings.gradle.kts index 6ba62be57..459698180 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,3 @@ -enableFeaturePreview("VERSION_CATALOGS") - include(":core") include(":lib-ratelimit") diff --git a/src/all/komga/build.gradle b/src/all/komga/build.gradle index 35d79ac97..7f38648b2 100644 --- a/src/all/komga/build.gradle +++ b/src/all/komga/build.gradle @@ -10,7 +10,8 @@ ext { } dependencies { - compileOnly libs.bundles.reactivex + compileOnly 'io.reactivex:rxandroid:1.2.1' + compileOnly 'io.reactivex:rxjava:1.3.8' } apply from: "$rootDir/common.gradle" diff --git a/src/zh/manhuagui/build.gradle b/src/zh/manhuagui/build.gradle index 7f125ed9f..24ab41db1 100644 --- a/src/zh/manhuagui/build.gradle +++ b/src/zh/manhuagui/build.gradle @@ -10,7 +10,8 @@ ext { } dependencies { - compileOnly libs.bundles.coroutines + compileOnly "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" + compileOnly "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation project(':lib-ratelimit') }