mirror of
https://github.com/mihonapp/mihon.git
synced 2025-03-01 18:34:13 +01:00
316 lines
9.2 KiB
Plaintext
316 lines
9.2 KiB
Plaintext
import mihon.buildlogic.getBuildTime
|
|
import mihon.buildlogic.getCommitCount
|
|
import mihon.buildlogic.getGitSha
|
|
|
|
plugins {
|
|
id("mihon.android.application")
|
|
id("mihon.android.application.compose")
|
|
id("com.github.zellius.shortcut-helper")
|
|
kotlin("plugin.serialization")
|
|
alias(libs.plugins.aboutLibraries)
|
|
}
|
|
|
|
val includeAnalytics = project.hasProperty("with-analytics")
|
|
val includeUpdater = project.hasProperty("with-updater")
|
|
|
|
if (includeAnalytics) {
|
|
pluginManager.apply {
|
|
apply(libs.plugins.google.services.get().pluginId)
|
|
apply(libs.plugins.firebase.crashlytics.get().pluginId)
|
|
}
|
|
}
|
|
|
|
shortcutHelper.setFilePath("./shortcuts.xml")
|
|
|
|
android {
|
|
namespace = "eu.kanade.tachiyomi"
|
|
|
|
defaultConfig {
|
|
applicationId = "app.mihon"
|
|
|
|
versionCode = 10
|
|
versionName = "0.17.1"
|
|
|
|
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
|
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
|
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
|
|
buildConfigField("boolean", "INCLUDE_ANALYTICS", "$includeAnalytics")
|
|
buildConfigField("boolean", "INCLUDE_UPDATER", "$includeUpdater")
|
|
buildConfigField("boolean", "PREVIEW", "false")
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
buildTypes {
|
|
val debug by getting {
|
|
applicationIdSuffix = ".dev"
|
|
versionNameSuffix = "-${getCommitCount()}"
|
|
isPseudoLocalesEnabled = true
|
|
}
|
|
val release by getting {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
|
|
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
|
|
}
|
|
create("foss") {
|
|
initWith(release)
|
|
|
|
applicationIdSuffix = ".t-foss"
|
|
|
|
matchingFallbacks.add(release.name)
|
|
}
|
|
create("preview") {
|
|
initWith(release)
|
|
|
|
applicationIdSuffix = ".debug"
|
|
|
|
versionNameSuffix = debug.versionNameSuffix
|
|
signingConfig = debug.signingConfig
|
|
|
|
matchingFallbacks.add(release.name)
|
|
|
|
buildConfigField("boolean", "PREVIEW", "true")
|
|
}
|
|
create("benchmark") {
|
|
initWith(release)
|
|
|
|
isDebuggable = false
|
|
isProfileable = true
|
|
versionNameSuffix = "-benchmark"
|
|
applicationIdSuffix = ".benchmark"
|
|
|
|
signingConfig = debug.signingConfig
|
|
|
|
matchingFallbacks.add(release.name)
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
val analyticsDir = if (includeAnalytics) "analytics-firebase" else "analytics-firebase-noop"
|
|
getByName("main").kotlin.srcDirs("src/$analyticsDir/kotlin")
|
|
getByName("preview").res.srcDirs("src/debug/res")
|
|
getByName("benchmark").res.srcDirs("src/debug/res")
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
isEnable = true
|
|
isUniversalApk = true
|
|
reset()
|
|
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
|
}
|
|
}
|
|
|
|
packaging {
|
|
jniLibs {
|
|
keepDebugSymbols += listOf(
|
|
"libandroidx.graphics.path",
|
|
"libarchive-jni",
|
|
"libconscrypt_jni",
|
|
"libimagedecoder",
|
|
"libquickjs",
|
|
"libsqlite3x",
|
|
)
|
|
.map { "**/$it.so" }
|
|
}
|
|
resources {
|
|
excludes += setOf(
|
|
"kotlin-tooling-metadata.json",
|
|
"LICENSE.txt",
|
|
"META-INF/**/*.properties",
|
|
"META-INF/**/LICENSE.txt",
|
|
"META-INF/*.properties",
|
|
"META-INF/*.version",
|
|
"META-INF/DEPENDENCIES",
|
|
"META-INF/LICENSE",
|
|
"META-INF/NOTICE",
|
|
"META-INF/README.md",
|
|
)
|
|
}
|
|
}
|
|
|
|
dependenciesInfo {
|
|
includeInApk = false
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
buildConfig = true
|
|
|
|
// Disable some unused things
|
|
aidl = false
|
|
renderScript = false
|
|
shaders = false
|
|
}
|
|
|
|
lint {
|
|
abortOnError = false
|
|
checkReleaseBuilds = false
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
freeCompilerArgs.addAll(
|
|
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
|
|
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
|
|
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
|
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
|
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
|
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
|
|
"-opt-in=coil3.annotation.ExperimentalCoilApi",
|
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
"-opt-in=kotlinx.coroutines.FlowPreview",
|
|
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
|
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
|
)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(projects.i18n)
|
|
implementation(projects.core.archive)
|
|
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)
|
|
|
|
// Compose
|
|
implementation(compose.activity)
|
|
implementation(compose.foundation)
|
|
implementation(compose.material3.core)
|
|
implementation(compose.material.icons)
|
|
implementation(compose.animation)
|
|
implementation(compose.animation.graphics)
|
|
debugImplementation(compose.ui.tooling)
|
|
implementation(compose.ui.tooling.preview)
|
|
implementation(compose.ui.util)
|
|
|
|
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
|
|
implementation(androidx.workmanager)
|
|
|
|
// RxJava
|
|
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)
|
|
|
|
// HTML parser
|
|
implementation(libs.jsoup)
|
|
|
|
// Disk
|
|
implementation(libs.disklrucache)
|
|
implementation(libs.unifile)
|
|
|
|
// Preferences
|
|
implementation(libs.preferencektx)
|
|
|
|
// Dependency injection
|
|
implementation(libs.injekt)
|
|
|
|
// Image loading
|
|
implementation(platform(libs.coil.bom))
|
|
implementation(libs.bundles.coil)
|
|
implementation(libs.subsamplingscaleimageview) {
|
|
exclude(module = "image-decoder")
|
|
}
|
|
implementation(libs.image.decoder)
|
|
|
|
// UI libraries
|
|
implementation(libs.material)
|
|
implementation(libs.flexible.adapter.core)
|
|
implementation(libs.photoview)
|
|
implementation(libs.directionalviewpager) {
|
|
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)
|
|
implementation(libs.reorderable)
|
|
|
|
// Logging
|
|
implementation(libs.logcat)
|
|
|
|
// Crash reports/analytics
|
|
if (includeAnalytics) {
|
|
implementation(platform(libs.firebase.bom))
|
|
implementation(libs.firebase.analytics)
|
|
implementation(libs.firebase.crashlytics)
|
|
}
|
|
|
|
// Shizuku
|
|
implementation(libs.bundles.shizuku)
|
|
|
|
// Tests
|
|
testImplementation(libs.bundles.test)
|
|
|
|
// For detecting memory leaks; see https://square.github.io/leakcanary/
|
|
// debugImplementation(libs.leakcanary.android)
|
|
implementation(libs.leakcanary.plumber)
|
|
|
|
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")
|
|
}
|
|
}
|
|
|
|
buildscript {
|
|
dependencies {
|
|
classpath(kotlinx.gradle)
|
|
}
|
|
}
|