mihon/app/build.gradle.kts

306 lines
9.3 KiB
Text
Raw Normal View History

import mihon.buildlogic.getBuildTime
import mihon.buildlogic.getCommitCount
import mihon.buildlogic.getGitSha
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("mihon.android.application")
id("mihon.android.application.compose")
id("com.github.zellius.shortcut-helper")
kotlin("plugin.serialization")
alias(libs.plugins.aboutLibraries)
}
2024-01-15 09:55:26 -05:00
if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
2024-09-03 05:45:19 -04:00
pluginManager.apply {
apply(libs.plugins.google.services.get().pluginId)
apply(libs.plugins.firebase.crashlytics.get().pluginId)
}
2024-01-15 09:55:26 -05:00
}
shortcutHelper.setFilePath("./shortcuts.xml")
val supportedAbis = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
2021-06-01 09:55:03 -04:00
android {
2022-07-02 13:08:22 -04:00
namespace = "eu.kanade.tachiyomi"
defaultConfig {
2024-01-15 15:55:29 -05:00
applicationId = "app.mihon"
versionCode = 7
2024-04-09 03:48:14 -04:00
versionName = "0.16.5"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
buildConfigField("boolean", "PREVIEW", "false")
ndk {
abiFilters += supportedAbis
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
2021-06-01 09:55:03 -04:00
splits {
abi {
2021-08-06 15:38:16 -04:00
isEnable = true
2021-06-01 09:55:03 -04:00
reset()
include(*supportedAbis.toTypedArray())
2021-06-01 09:55:03 -04:00
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")
2023-07-29 22:48:56 -04:00
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
val debugType = getByName("debug")
versionNameSuffix = debugType.versionNameSuffix
applicationIdSuffix = debugType.applicationIdSuffix
}
create("benchmark") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
isDebuggable = false
isProfileable = true
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 09:47:27 -04:00
// Include pseudolocales: https://developer.android.com/guide/topics/resources/pseudolocales
resourceConfigurations.addAll(listOf("en", "en_XA", "ar_XB", "xxhdpi"))
dimension = "default"
}
}
2023-04-16 18:02:24 -04:00
packaging {
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",
),
)
}
dependenciesInfo {
includeInApk = false
}
2021-06-01 09:55:03 -04:00
buildFeatures {
viewBinding = true
buildConfig = true
// Disable some unused things
aidl = false
renderScript = false
shaders = false
2021-06-01 09:55:03 -04:00
}
2021-07-28 15:08:04 -04:00
lint {
2022-01-25 22:49:50 -05:00
abortOnError = false
checkReleaseBuilds = false
}
}
dependencies {
implementation(projects.i18n)
2024-01-29 04:11:28 -05:00
implementation(projects.core.common)
implementation(projects.coreMetadata)
implementation(projects.sourceApi)
implementation(projects.sourceLocal)
implementation(projects.data)
implementation(projects.domain)
implementation(projects.presentationCore)
implementation(projects.presentationWidget)
2022-04-24 10:22:22 -04:00
// Compose
implementation(compose.activity)
implementation(compose.foundation)
implementation(compose.material3.core)
implementation(compose.material.icons)
implementation(compose.animation)
2022-06-25 11:03:48 -04:00
implementation(compose.animation.graphics)
debugImplementation(compose.ui.tooling)
implementation(compose.ui.tooling.preview)
implementation(compose.ui.util)
implementation(compose.accompanist.systemuicontroller)
implementation(androidx.interpolator)
implementation(androidx.paging.runtime)
implementation(androidx.paging.compose)
implementation(libs.bundles.sqlite)
implementation(kotlinx.reflect)
implementation(kotlinx.immutables)
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.corektx)
implementation(androidx.splashscreen)
implementation(androidx.recyclerview)
implementation(androidx.viewpager)
implementation(androidx.profileinstaller)
implementation(androidx.bundles.lifecycle)
// Job scheduling
2023-10-14 22:22:46 -04:00
implementation(androidx.workmanager)
// RxJava
2023-08-26 10:30:26 -04:00
implementation(libs.rxjava)
// Networking
implementation(libs.bundles.okhttp)
implementation(libs.okio)
implementation(libs.conscrypt.android) // TLS 1.3 support for Android < 10
// Data serialization (JSON, protobuf, xml)
implementation(kotlinx.bundles.serialization)
2021-08-07 10:50:50 -04:00
// HTML parser
implementation(libs.jsoup)
2021-08-07 10:50:50 -04:00
// Disk
implementation(libs.disklrucache)
implementation(libs.unifile)
// Preferences
implementation(libs.preferencektx)
// Dependency injection
implementation(libs.injekt.core)
2021-08-07 10:50:50 -04:00
// Image loading
2023-05-31 22:48:13 -04:00
implementation(platform(libs.coil.bom))
implementation(libs.bundles.coil)
implementation(libs.subsamplingscaleimageview) {
exclude(module = "image-decoder")
}
implementation(libs.image.decoder)
2021-08-07 10:50:50 -04:00
// UI libraries
implementation(libs.material)
implementation(libs.flexible.adapter.core)
implementation(libs.photoview)
implementation(libs.directionalviewpager) {
2021-09-20 14:33:35 -04:00
exclude(group = "androidx.viewpager", module = "viewpager")
}
implementation(libs.insetter)
implementation(libs.bundles.richtext)
implementation(libs.aboutLibraries.compose)
implementation(libs.bundles.voyager)
implementation(libs.compose.materialmotion)
implementation(libs.swipe)
implementation(libs.compose.webview)
implementation(libs.compose.grid)
2021-08-07 10:50:50 -04:00
// Logging
implementation(libs.logcat)
2021-08-07 10:50:50 -04:00
2024-01-15 09:55:26 -05:00
// Crash reports/analytics
2024-09-03 05:45:19 -04:00
"standardImplementation"(platform(libs.firebase.bom))
2024-01-15 09:55:26 -05:00
"standardImplementation"(libs.firebase.analytics)
2024-09-03 05:45:19 -04:00
"standardImplementation"(libs.firebase.crashlytics)
2024-01-15 09:55:26 -05:00
// Shizuku
implementation(libs.bundles.shizuku)
// Tests
2023-04-15 09:51:52 -04:00
testImplementation(libs.bundles.test)
// For detecting memory leaks; see https://square.github.io/leakcanary/
// debugImplementation(libs.leakcanary.android)
implementation(libs.leakcanary.plumber)
2024-03-28 14:36:33 -04:00
testImplementation(kotlinx.coroutines.test)
}
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 {
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xcontext-receivers",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
2022-04-28 18:09:16 -04:00
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
2022-04-28 18:09:16 -04:00
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
2022-06-25 11:03:48 -04:00
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
2022-06-25 11:03:48 -04:00
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=coil3.annotation.ExperimentalCoilApi",
2022-08-10 23:26:34 -04:00
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}
buildscript {
dependencies {
classpath(kotlinx.gradle)
}
}