VendettaManager/app/build.gradle.kts
redstonekasi 35eafd1207
fix: migrate to new update tracker (#6)
* fix: migrate to new update tracker

* Fix download urls

---------

Co-authored-by: wingio <wingio@users.noreply.github.com>
2023-04-27 14:52:35 -04:00

172 lines
No EOL
5.8 KiB
Text

import java.io.ByteArrayOutputStream
plugins {
id("com.android.application")
kotlin("android")
kotlin("plugin.serialization") version "1.7.20"
}
android {
namespace = "dev.beefers.vendetta.manager"
compileSdk = 33
defaultConfig {
applicationId = "dev.beefers.vendetta.manager"
minSdk = 24
targetSdk = 33
versionCode = 1074
versionName = "1.0.74"
buildConfigField("String", "GIT_BRANCH", "\"${getCurrentBranch()}\"")
buildConfigField("String", "GIT_COMMIT", "\"${getLatestCommit()}\"")
buildConfigField("boolean", "GIT_LOCAL_COMMITS", "${hasLocalCommits()}")
buildConfigField("boolean", "GIT_LOCAL_CHANGES", "${hasLocalChanges()}")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
named("release") {
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += listOf(
"-Xcontext-receivers",
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=${buildDir.resolve("report").absolutePath}",
)
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.3.2"
}
androidComponents {
onVariants(selector().withBuildType("release")) {
it.packaging.resources.excludes.apply {
// Debug metadata
add("/**/*.version")
add("/kotlin-tooling-metadata.json")
// Kotlin debugging (https://github.com/Kotlin/kotlinx.coroutines/issues/2274)
add("/DebugProbesKt.bin")
}
}
}
packagingOptions {
resources {
// Reflection symbol list (https://stackoverflow.com/a/41073782/13964629)
excludes += "/**/*.kotlin_builtins"
}
}
configurations {
all {
exclude(module = "listenablefuture")
}
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.0")
implementation("androidx.paging:paging-compose:1.0.0-alpha18")
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
implementation("androidx.activity:activity-compose:1.6.1")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
val koinVersion = "3.2.0"
implementation("io.insert-koin:koin-core:$koinVersion")
implementation("io.insert-koin:koin-android:$koinVersion")
implementation("io.insert-koin:koin-androidx-compose:$koinVersion")
val accompanistVersion = "0.29.1-alpha"
implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion")
implementation("com.google.accompanist:accompanist-pager:$accompanistVersion")
implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion")
val voyagerVersion = "1.0.0-rc03"
implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-tab-navigator:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-koin:$voyagerVersion")
val coilVersion = "2.2.2"
implementation("io.coil-kt:coil:$coilVersion")
implementation("io.coil-kt:coil-compose:$coilVersion")
val ktorVersion = "2.1.1"
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
implementation("io.github.diamondminer88:zip-android:2.1.0@aar")
implementation(files("libs/lspatch.jar"))
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2022.10.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
fun getCurrentBranch(): String? =
exec("git", "symbolic-ref", "--short", "HEAD")
fun getLatestCommit(): String? =
exec("git", "rev-parse", "--short", "HEAD")
fun hasLocalCommits(): Boolean {
val branch = getCurrentBranch() ?: return false
return exec("git", "log", "origin/$branch..HEAD")?.isNotEmpty() ?: false
}
fun hasLocalChanges(): Boolean =
exec("git", "status", "-s")?.isNotEmpty() ?: false
fun exec(vararg command: String): String? {
return try {
val stdout = ByteArrayOutputStream()
val errout = ByteArrayOutputStream()
exec {
commandLine = command.toList()
standardOutput = stdout
errorOutput = errout
isIgnoreExitValue = true
}
if(errout.size() > 0)
throw Error(errout.toString(Charsets.UTF_8))
stdout.toString(Charsets.UTF_8).trim()
} catch (e: Throwable) {
e.printStackTrace()
null
}
}