aniyomi/app/build.gradle.kts

332 lines
10 KiB
Text
Raw Normal View History

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2022-12-17 20:02:01 +03:00
import org.jmailen.gradle.kotlinter.tasks.LintTask
plugins {
id("com.android.application")
id("com.mikepenz.aboutlibraries.plugin")
kotlin("android")
kotlin("plugin.serialization")
id("com.github.zellius.shortcut-helper")
id("com.squareup.sqldelight")
}
if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
apply<com.google.gms.googleservices.GoogleServicesPlugin>()
}
shortcutHelper.setFilePath("./shortcuts.xml")
val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
2021-06-01 16:55:03 +03:00
android {
2022-07-02 20:08:22 +03:00
namespace = "eu.kanade.tachiyomi"
defaultConfig {
applicationId = "eu.kanade.tachiyomi"
versionCode = 94
2023-01-07 20:09:27 +03:00
versionName = "0.14.3"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
buildConfigField("boolean", "PREVIEW", "false")
// Please disable ACRA or use your own instance in forked versions of the project
buildConfigField("String", "ACRA_URI", "\"https://tachiyomi.kanade.eu/crash_report\"")
ndk {
2021-06-01 16:55:03 +03:00
abiFilters += SUPPORTED_ABIS
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
2021-06-01 16:55:03 +03:00
splits {
abi {
2021-08-06 22:38:16 +03:00
isEnable = true
2021-06-01 16:55:03 +03:00
reset()
include(*SUPPORTED_ABIS.toTypedArray())
isUniversalApk = true
}
}
buildTypes {
named("debug") {
versionNameSuffix = "-${getCommitCount()}"
applicationIdSuffix = ".debug"
isPseudoLocalesEnabled = true
}
named("release") {
isShrinkResources = true
isMinifyEnabled = true
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
}
create("preview") {
initWith(getByName("release"))
buildConfigField("boolean", "PREVIEW", "true")
val debugType = getByName("debug")
signingConfig = debugType.signingConfig
versionNameSuffix = debugType.versionNameSuffix
applicationIdSuffix = debugType.applicationIdSuffix
matchingFallbacks.add("release")
}
create("benchmark") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
isDebuggable = false
versionNameSuffix = "-benchmark"
applicationIdSuffix = ".benchmark"
}
}
sourceSets {
getByName("preview").res.srcDirs("src/debug/res")
getByName("benchmark").res.srcDirs("src/debug/res")
}
flavorDimensions.add("default")
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"))
dimension = "default"
}
}
packagingOptions {
resources.excludes.addAll(listOf(
"META-INF/DEPENDENCIES",
"LICENSE.txt",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
2021-10-16 17:21:25 +03:00
"META-INF/README.md",
"META-INF/NOTICE",
"META-INF/*.kotlin_module",
))
}
dependenciesInfo {
includeInApk = false
}
2021-06-01 16:55:03 +03:00
buildFeatures {
viewBinding = true
compose = true
// Disable some unused things
aidl = false
renderScript = false
shaders = false
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
}
composeOptions {
2022-06-30 05:45:11 +03:00
kotlinCompilerExtensionVersion = compose.versions.compiler.get()
}
sqldelight {
database("Database") {
packageName = "eu.kanade.tachiyomi"
dialect = "sqlite:3.24"
}
}
}
dependencies {
implementation(project(":i18n"))
implementation(project(":core"))
implementation(project(":source-api"))
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)
implementation(compose.foundation)
implementation(compose.material3.core)
implementation(compose.material.core)
implementation(compose.material.icons)
implementation(compose.animation)
2022-06-25 18:03:48 +03:00
implementation(compose.animation.graphics)
implementation(compose.ui.tooling)
implementation(compose.ui.util)
2022-04-24 17:22:22 +03:00
implementation(compose.accompanist.webview)
2022-06-25 18:03:48 +03:00
implementation(compose.accompanist.flowlayout)
implementation(compose.accompanist.permissions)
implementation(compose.accompanist.themeadapter)
implementation(compose.accompanist.systemuicontroller)
implementation(androidx.paging.runtime)
implementation(androidx.paging.compose)
implementation(libs.bundles.sqlite)
implementation(libs.sqldelight.android.driver)
implementation(libs.sqldelight.coroutines)
implementation(libs.sqldelight.android.paging)
implementation(kotlinx.reflect)
implementation(platform(kotlinx.coroutines.bom))
implementation(kotlinx.bundles.coroutines)
// AndroidX libraries
implementation(androidx.annotation)
implementation(androidx.appcompat)
implementation(androidx.biometricktx)
implementation(androidx.constraintlayout)
implementation(androidx.coordinatorlayout)
implementation(androidx.corektx)
implementation(androidx.splashscreen)
implementation(androidx.recyclerview)
implementation(androidx.viewpager)
implementation(androidx.glance)
implementation(androidx.profileinstaller)
implementation(androidx.bundles.lifecycle)
// Job scheduling
2022-04-11 15:56:22 +03:00
implementation(androidx.bundles.workmanager)
2021-08-07 17:50:50 +03:00
// RX
implementation(libs.bundles.reactivex)
implementation(libs.flowreactivenetwork)
// Network client
implementation(libs.bundles.okhttp)
implementation(libs.okio)
// TLS 1.3 support for Android < 10
implementation(libs.conscrypt.android)
2021-08-07 17:50:50 +03:00
// Data serialization (JSON, protobuf)
implementation(kotlinx.bundles.serialization)
2021-08-07 17:50:50 +03:00
// HTML parser
implementation(libs.jsoup)
2021-08-07 17:50:50 +03:00
// Disk
implementation(libs.disklrucache)
implementation(libs.unifile)
implementation(libs.junrar)
// Preferences
implementation(libs.preferencektx)
// Dependency injection
implementation(libs.injekt.core)
2021-08-07 17:50:50 +03:00
// Image loading
implementation(libs.bundles.coil)
implementation(libs.subsamplingscaleimageview) {
exclude(module = "image-decoder")
}
implementation(libs.image.decoder)
// Sort
implementation(libs.natural.comparator)
2021-08-07 17:50:50 +03:00
// UI libraries
implementation(libs.material)
implementation(libs.flexible.adapter.core)
implementation(libs.flexible.adapter.ui)
implementation(libs.photoview)
implementation(libs.directionalviewpager) {
2021-09-20 21:33:35 +03:00
exclude(group = "androidx.viewpager", module = "viewpager")
}
implementation(libs.insetter)
implementation(libs.bundles.richtext)
implementation(libs.aboutLibraries.compose)
implementation(libs.cascade)
implementation(libs.bundles.voyager)
implementation(libs.wheelpicker)
implementation(libs.materialmotion.core)
2021-08-07 17:50:50 +03:00
// Logging
implementation(libs.logcat)
2021-08-07 17:50:50 +03:00
// Crash reports/analytics
implementation(libs.acra.http)
"standardImplementation"(libs.firebase.analytics)
2021-08-07 17:50:50 +03:00
// Shizuku
implementation(libs.bundles.shizuku)
// Tests
testImplementation(libs.junit)
// For detecting memory leaks; see https://square.github.io/leakcanary/
// debugImplementation(libs.leakcanary.android)
implementation(libs.leakcanary.plumber)
}
androidComponents {
beforeVariants { variantBuilder ->
// Disables standardBenchmark
if (variantBuilder.buildType == "benchmark") {
variantBuilder.enable = variantBuilder.productFlavors.containsAll(listOf("default" to "dev"))
}
}
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")
}
}
tasks {
2022-12-17 20:02:01 +03:00
withType<LintTask>().configureEach {
exclude { it.file.path.contains("generated[\\\\/]".toRegex()) }
}
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf(
2022-04-29 01:09:16 +03:00
"-opt-in=coil.annotation.ExperimentalCoilApi",
"-opt-in=com.google.accompanist.permissions.ExperimentalPermissionsApi",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
2022-04-29 01:09:16 +03:00
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
2022-04-29 01:09:16 +03:00
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
2022-06-25 18:03:48 +03:00
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
2022-06-25 18:03:48 +03:00
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
2022-08-11 06:26:34 +03:00
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
if (project.findProperty("tachiyomi.enableComposeCompilerMetrics") == "true") {
kotlinOptions.freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
kotlinOptions.freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
}
}
}
buildscript {
dependencies {
classpath(kotlinx.gradle)
}
}