2020-12-31 19:28:34 +03:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
2023-09-04 03:22:10 +03:00
|
|
|
import java.io.FileInputStream
|
|
|
|
import java.util.Properties
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
|
|
|
id("com.mikepenz.aboutlibraries.plugin")
|
|
|
|
kotlin("android")
|
|
|
|
kotlin("plugin.serialization")
|
2024-06-30 22:29:59 +03:00
|
|
|
kotlin("plugin.compose")
|
2020-12-31 19:28:34 +03:00
|
|
|
id("com.github.zellius.shortcut-helper")
|
|
|
|
}
|
|
|
|
|
|
|
|
shortcutHelper.setFilePath("./shortcuts.xml")
|
|
|
|
|
2022-02-21 04:00:52 +03:00
|
|
|
val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
2021-06-01 16:55:03 +03:00
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
android {
|
2022-07-02 20:08:22 +03:00
|
|
|
namespace = "eu.kanade.tachiyomi"
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
defaultConfig {
|
2021-04-26 03:24:56 +03:00
|
|
|
applicationId = "xyz.jmir.tachiyomi.mi"
|
2023-08-01 10:27:49 +03:00
|
|
|
|
2024-07-02 01:10:22 +03:00
|
|
|
versionCode = 125
|
2024-07-01 19:16:24 +03:00
|
|
|
versionName = "0.16.4.2"
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
|
|
|
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
|
|
|
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
|
|
|
|
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
|
2021-10-09 17:28:43 +03:00
|
|
|
buildConfigField("boolean", "PREVIEW", "false")
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2023-09-04 03:22:10 +03:00
|
|
|
// Put these fields in acra.properties
|
|
|
|
val acraProperties = Properties()
|
|
|
|
rootProject.file("acra.properties")
|
|
|
|
.takeIf { it.exists() }
|
|
|
|
?.let { acraProperties.load(FileInputStream(it)) }
|
|
|
|
val acraUri = acraProperties.getProperty("ACRA_URI", "")
|
|
|
|
val acraLogin = acraProperties.getProperty("ACRA_LOGIN", "")
|
|
|
|
val acraPassword = acraProperties.getProperty("ACRA_PASSWORD", "")
|
|
|
|
buildConfigField("String", "ACRA_URI", "\"$acraUri\"")
|
|
|
|
buildConfigField("String", "ACRA_LOGIN", "\"$acraLogin\"")
|
|
|
|
buildConfigField("String", "ACRA_PASSWORD", "\"$acraPassword\"")
|
2021-01-17 19:09:29 +03:00
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
ndk {
|
2021-07-25 15:53:17 +03:00
|
|
|
abiFilters += SUPPORTED_ABIS
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
2021-11-07 17:20:13 +03:00
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
2021-07-25 15:53:17 +03:00
|
|
|
|
|
|
|
splits {
|
2021-06-01 16:55:03 +03:00
|
|
|
abi {
|
2021-08-09 00:02:30 +03:00
|
|
|
isEnable = true
|
2021-06-01 16:55:03 +03:00
|
|
|
reset()
|
|
|
|
include(*SUPPORTED_ABIS.toTypedArray())
|
|
|
|
isUniversalApk = true
|
2021-07-25 15:53:17 +03:00
|
|
|
}
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
named("debug") {
|
|
|
|
versionNameSuffix = "-${getCommitCount()}"
|
|
|
|
applicationIdSuffix = ".debug"
|
2022-11-03 16:46:53 +03:00
|
|
|
isPseudoLocalesEnabled = true
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
named("release") {
|
2021-05-22 21:47:40 +03:00
|
|
|
isShrinkResources = true
|
|
|
|
isMinifyEnabled = true
|
|
|
|
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
2021-10-09 17:28:43 +03:00
|
|
|
create("preview") {
|
|
|
|
initWith(getByName("release"))
|
|
|
|
buildConfigField("boolean", "PREVIEW", "true")
|
|
|
|
|
2023-11-28 01:08:16 +03:00
|
|
|
signingConfig = signingConfigs.getByName("debug")
|
|
|
|
matchingFallbacks.add("release")
|
2021-10-09 17:28:43 +03:00
|
|
|
val debugType = getByName("debug")
|
|
|
|
versionNameSuffix = debugType.versionNameSuffix
|
|
|
|
applicationIdSuffix = debugType.applicationIdSuffix
|
|
|
|
}
|
2022-10-04 16:22:55 +03:00
|
|
|
create("benchmark") {
|
|
|
|
initWith(getByName("release"))
|
|
|
|
|
|
|
|
signingConfig = signingConfigs.getByName("debug")
|
|
|
|
matchingFallbacks.add("release")
|
|
|
|
isDebuggable = false
|
2023-11-28 01:08:16 +03:00
|
|
|
isProfileable = true
|
2022-10-04 16:22:55 +03:00
|
|
|
versionNameSuffix = "-benchmark"
|
|
|
|
applicationIdSuffix = ".benchmark"
|
2021-10-09 17:28:43 +03:00
|
|
|
}
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
2021-05-22 21:47:40 +03:00
|
|
|
sourceSets {
|
2021-10-09 17:28:43 +03:00
|
|
|
getByName("preview").res.srcDirs("src/debug/res")
|
2022-10-04 16:22:55 +03:00
|
|
|
getByName("benchmark").res.srcDirs("src/debug/res")
|
2021-05-22 21:47:40 +03:00
|
|
|
}
|
|
|
|
|
2021-08-23 01:05:18 +03:00
|
|
|
flavorDimensions.add("default")
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
productFlavors {
|
|
|
|
create("standard") {
|
|
|
|
buildConfigField("boolean", "INCLUDE_UPDATER", "true")
|
|
|
|
dimension = "default"
|
|
|
|
}
|
|
|
|
create("dev") {
|
2022-11-03 16:47:27 +03:00
|
|
|
// Include pseudolocales: https://developer.android.com/guide/topics/resources/pseudolocales
|
|
|
|
resourceConfigurations.addAll(listOf("en", "en_XA", "ar_XB", "xxhdpi"))
|
2020-12-31 19:28:34 +03:00
|
|
|
dimension = "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-23 16:50:00 +03:00
|
|
|
packaging {
|
2023-11-28 01:08:16 +03:00
|
|
|
resources.excludes.addAll(
|
|
|
|
listOf(
|
|
|
|
"META-INF/DEPENDENCIES",
|
|
|
|
"LICENSE.txt",
|
|
|
|
"META-INF/LICENSE",
|
|
|
|
"META-INF/LICENSE.txt",
|
|
|
|
"META-INF/README.md",
|
|
|
|
"META-INF/NOTICE",
|
|
|
|
"META-INF/*.kotlin_module",
|
|
|
|
),
|
|
|
|
)
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
dependenciesInfo {
|
|
|
|
includeInApk = false
|
|
|
|
}
|
|
|
|
|
2021-07-25 15:53:17 +03:00
|
|
|
buildFeatures {
|
2021-06-01 16:55:03 +03:00
|
|
|
viewBinding = true
|
2022-04-23 00:29:24 +03:00
|
|
|
compose = true
|
2023-12-16 23:57:45 +03:00
|
|
|
buildConfig = true
|
2021-11-07 17:20:13 +03:00
|
|
|
|
|
|
|
// Disable some unused things
|
|
|
|
aidl = false
|
|
|
|
renderScript = false
|
|
|
|
shaders = false
|
2021-07-25 15:53:17 +03:00
|
|
|
}
|
2021-06-01 16:55:03 +03:00
|
|
|
|
2021-07-28 22:08:04 +03:00
|
|
|
lint {
|
2022-01-26 06:49:50 +03:00
|
|
|
abortOnError = false
|
|
|
|
checkReleaseBuilds = false
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
2022-04-23 00:29:24 +03:00
|
|
|
composeOptions {
|
2022-06-30 05:45:11 +03:00
|
|
|
kotlinCompilerExtensionVersion = compose.versions.compiler.get()
|
2022-04-23 00:29:24 +03:00
|
|
|
}
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-05-14 11:17:59 +03:00
|
|
|
implementation(projects.i18n)
|
2024-06-05 12:20:50 +03:00
|
|
|
implementation(projects.core.common)
|
2024-05-14 11:17:59 +03:00
|
|
|
implementation(projects.coreMetadata)
|
|
|
|
implementation(projects.sourceApi)
|
|
|
|
implementation(projects.sourceLocal)
|
|
|
|
implementation(projects.data)
|
|
|
|
implementation(projects.domain)
|
|
|
|
implementation(projects.presentationCore)
|
|
|
|
implementation(projects.presentationWidget)
|
2022-11-10 06:31:56 +03:00
|
|
|
|
2022-04-24 17:22:22 +03:00
|
|
|
// Compose
|
2022-10-27 01:12:32 +03:00
|
|
|
implementation(platform(compose.bom))
|
2022-04-24 17:22:22 +03:00
|
|
|
implementation(compose.activity)
|
2022-04-23 00:29:24 +03:00
|
|
|
implementation(compose.foundation)
|
|
|
|
implementation(compose.material3.core)
|
2022-11-11 23:02:45 +03:00
|
|
|
implementation(compose.material.core)
|
2022-04-23 19:05:00 +03:00
|
|
|
implementation(compose.material.icons)
|
2022-04-23 00:29:24 +03:00
|
|
|
implementation(compose.animation)
|
2022-06-25 18:03:48 +03:00
|
|
|
implementation(compose.animation.graphics)
|
2023-11-28 01:08:16 +03:00
|
|
|
debugImplementation(compose.ui.tooling)
|
|
|
|
implementation(compose.ui.tooling.preview)
|
2022-05-24 01:03:46 +03:00
|
|
|
implementation(compose.ui.util)
|
2022-12-09 19:20:13 +03:00
|
|
|
implementation(compose.accompanist.systemuicontroller)
|
2022-04-23 00:29:24 +03:00
|
|
|
|
|
|
|
implementation(androidx.paging.runtime)
|
|
|
|
implementation(androidx.paging.compose)
|
|
|
|
|
2022-07-03 17:17:41 +03:00
|
|
|
implementation(libs.bundles.sqlite)
|
2021-07-04 19:16:12 +03:00
|
|
|
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(kotlinx.reflect)
|
2023-11-28 01:08:16 +03:00
|
|
|
implementation(kotlinx.immutables)
|
2022-10-31 02:38:18 +03:00
|
|
|
|
|
|
|
implementation(platform(kotlinx.coroutines.bom))
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(kotlinx.bundles.coroutines)
|
2021-07-04 19:16:12 +03:00
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
// AndroidX libraries
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(androidx.annotation)
|
|
|
|
implementation(androidx.appcompat)
|
|
|
|
implementation(androidx.biometricktx)
|
|
|
|
implementation(androidx.constraintlayout)
|
|
|
|
implementation(androidx.corektx)
|
|
|
|
implementation(androidx.splashscreen)
|
|
|
|
implementation(androidx.recyclerview)
|
|
|
|
implementation(androidx.viewpager)
|
2022-10-04 16:22:55 +03:00
|
|
|
implementation(androidx.profileinstaller)
|
2023-08-04 20:53:57 +03:00
|
|
|
implementation(androidx.mediasession)
|
2022-03-04 17:58:31 +03:00
|
|
|
|
|
|
|
implementation(androidx.bundles.lifecycle)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
// Job scheduling
|
2023-11-28 01:08:16 +03:00
|
|
|
implementation(androidx.workmanager)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2023-07-07 22:09:13 +03:00
|
|
|
// RxJava
|
2023-11-28 01:08:16 +03:00
|
|
|
implementation(libs.rxjava)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2023-07-07 22:09:13 +03:00
|
|
|
// Networking
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.bundles.okhttp)
|
|
|
|
implementation(libs.okio)
|
2023-07-07 22:09:13 +03:00
|
|
|
implementation(libs.conscrypt.android) // TLS 1.3 support for Android < 10
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2023-06-06 13:55:36 +03:00
|
|
|
// Data serialization (JSON, protobuf, xml)
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(kotlinx.bundles.serialization)
|
2021-09-06 18:54:00 +03:00
|
|
|
|
2021-08-07 17:50:50 +03:00
|
|
|
// HTML parser
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.jsoup)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
// Disk
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.disklrucache)
|
|
|
|
implementation(libs.unifile)
|
2024-06-05 15:45:53 +03:00
|
|
|
implementation(libs.bundles.archive)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
// Preferences
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.preferencektx)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
// Dependency injection
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.injekt.core)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2021-08-07 17:50:50 +03:00
|
|
|
// Image loading
|
2023-11-28 01:08:16 +03:00
|
|
|
implementation(platform(libs.coil.bom))
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.bundles.coil)
|
|
|
|
implementation(libs.subsamplingscaleimageview) {
|
2021-05-25 20:42:48 +03:00
|
|
|
exclude(module = "image-decoder")
|
|
|
|
}
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.image.decoder)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2021-08-07 17:50:50 +03:00
|
|
|
// UI libraries
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.material)
|
|
|
|
implementation(libs.flexible.adapter.core)
|
|
|
|
implementation(libs.photoview)
|
|
|
|
implementation(libs.directionalviewpager) {
|
2021-09-20 21:33:35 +03:00
|
|
|
exclude(group = "androidx.viewpager", module = "viewpager")
|
|
|
|
}
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.insetter)
|
2022-12-03 06:35:30 +03:00
|
|
|
implementation(libs.bundles.richtext)
|
2022-04-23 17:52:19 +03:00
|
|
|
implementation(libs.aboutLibraries.compose)
|
2022-10-15 18:38:01 +03:00
|
|
|
implementation(libs.bundles.voyager)
|
2023-07-07 22:09:13 +03:00
|
|
|
implementation(libs.compose.materialmotion)
|
2023-11-28 01:08:16 +03:00
|
|
|
implementation(libs.swipe)
|
2024-07-03 20:01:00 +03:00
|
|
|
implementation(libs.compose.webview)
|
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
|
2021-08-07 17:50:50 +03:00
|
|
|
// Logging
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.logcat)
|
2021-08-07 17:50:50 +03:00
|
|
|
|
2023-09-04 03:22:10 +03:00
|
|
|
// Crash reports
|
2024-01-01 17:53:21 +03:00
|
|
|
implementation(libs.bundles.acra)
|
2021-08-07 17:50:50 +03:00
|
|
|
|
2021-09-25 21:31:52 +03:00
|
|
|
// Shizuku
|
2022-03-04 17:58:31 +03:00
|
|
|
implementation(libs.bundles.shizuku)
|
2021-09-25 21:31:52 +03:00
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
// Tests
|
2023-07-23 16:50:00 +03:00
|
|
|
testImplementation(libs.bundles.test)
|
2020-12-31 19:28:34 +03:00
|
|
|
|
|
|
|
// For detecting memory leaks; see https://square.github.io/leakcanary/
|
2022-03-04 17:58:31 +03:00
|
|
|
// debugImplementation(libs.leakcanary.android)
|
2021-04-29 04:14:11 +03:00
|
|
|
|
2022-04-24 23:28:09 +03:00
|
|
|
implementation(libs.leakcanary.plumber)
|
2022-05-07 02:16:23 +03:00
|
|
|
|
2024-07-03 23:55:33 +03:00
|
|
|
testImplementation(kotlinx.coroutines.test)
|
|
|
|
|
2022-01-08 21:11:54 +03:00
|
|
|
// mpv-android
|
2022-04-10 17:22:04 +03:00
|
|
|
implementation(libs.aniyomi.mpv)
|
2023-01-03 17:49:33 +03:00
|
|
|
// FFmpeg-kit
|
|
|
|
implementation(libs.ffmpeg.kit)
|
|
|
|
implementation(libs.arthenica.smartexceptions)
|
2023-07-11 16:44:57 +03:00
|
|
|
// seeker seek bar
|
|
|
|
implementation(libs.seeker)
|
2023-11-03 00:00:58 +03:00
|
|
|
// true type parser
|
|
|
|
implementation(libs.truetypeparser)
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
|
2022-10-04 16:22:55 +03:00
|
|
|
androidComponents {
|
|
|
|
beforeVariants { variantBuilder ->
|
|
|
|
// Disables standardBenchmark
|
|
|
|
if (variantBuilder.buildType == "benchmark") {
|
2023-11-28 01:08:16 +03:00
|
|
|
variantBuilder.enable = variantBuilder.productFlavors.containsAll(
|
|
|
|
listOf("default" to "dev"),
|
|
|
|
)
|
2022-10-04 16:22:55 +03:00
|
|
|
}
|
|
|
|
}
|
2022-10-30 18:42:06 +03:00
|
|
|
onVariants(selector().withFlavor("default" to "standard")) {
|
|
|
|
// Only excluding in standard flavor because this breaks
|
|
|
|
// Layout Inspector's Compose tree
|
|
|
|
it.packaging.resources.excludes.add("META-INF/*.version")
|
|
|
|
}
|
2022-10-04 16:22:55 +03:00
|
|
|
}
|
|
|
|
|
2020-12-31 19:28:34 +03:00
|
|
|
tasks {
|
|
|
|
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
|
|
|
|
withType<KotlinCompile> {
|
2024-06-30 22:29:59 +03:00
|
|
|
compilerOptions.freeCompilerArgs.addAll(
|
|
|
|
listOf(
|
|
|
|
"-Xcontext-receivers",
|
|
|
|
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
|
|
|
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
|
|
|
|
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
|
|
|
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
|
|
|
|
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
|
|
|
|
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
|
|
|
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
|
|
|
|
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
|
2024-07-01 22:29:11 +03:00
|
|
|
"-opt-in=coil3.annotation.ExperimentalCoilApi",
|
2024-06-30 22:29:59 +03:00
|
|
|
"-opt-in=com.google.accompanist.permissions.ExperimentalPermissionsApi",
|
|
|
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
|
|
"-opt-in=kotlinx.coroutines.FlowPreview",
|
|
|
|
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
|
|
|
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
|
|
|
),
|
2020-12-31 19:28:34 +03:00
|
|
|
)
|
|
|
|
|
2022-10-29 16:37:48 +03:00
|
|
|
if (project.findProperty("tachiyomi.enableComposeCompilerMetrics") == "true") {
|
2024-06-30 22:29:59 +03:00
|
|
|
compilerOptions.freeCompilerArgs.addAll(
|
|
|
|
listOf(
|
|
|
|
"-P",
|
|
|
|
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
|
|
|
|
project.layout.buildDirectory.dir("compose_metrics").get().asFile.absolutePath,
|
|
|
|
),
|
2022-10-29 16:37:48 +03:00
|
|
|
)
|
2024-06-30 22:29:59 +03:00
|
|
|
compilerOptions.freeCompilerArgs.addAll(
|
|
|
|
listOf(
|
|
|
|
"-P",
|
|
|
|
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
|
|
|
|
project.layout.buildDirectory.dir("compose_metrics").get().asFile.absolutePath,
|
|
|
|
),
|
2022-10-29 16:37:48 +03:00
|
|
|
)
|
|
|
|
}
|
2020-12-31 19:28:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-31 19:32:18 +03:00
|
|
|
buildscript {
|
|
|
|
dependencies {
|
2022-03-04 17:58:31 +03:00
|
|
|
classpath(kotlinx.gradle)
|
2021-01-17 19:09:29 +03:00
|
|
|
}
|
|
|
|
}
|