2023-03-14 22:43:14 +00:00
|
|
|
import java.io.ByteArrayOutputStream
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
|
|
|
kotlin("android")
|
2023-03-17 18:50:49 +00:00
|
|
|
kotlin("plugin.serialization") version "1.7.20"
|
2023-03-14 22:43:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
namespace = "dev.beefers.vendetta.manager"
|
|
|
|
compileSdk = 33
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId = "dev.beefers.vendetta.manager"
|
|
|
|
minSdk = 24
|
|
|
|
targetSdk = 33
|
2023-03-18 16:30:54 +00:00
|
|
|
versionCode = 1020
|
|
|
|
versionName = "1.0.2"
|
2023-03-14 22:43:14 +00:00
|
|
|
|
|
|
|
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.3.1")
|
|
|
|
|
|
|
|
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
|
|
|
|
implementation("androidx.activity:activity-compose:1.5.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")
|
|
|
|
|
|
|
|
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 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("com.android.tools.build:apksig:7.4.0-beta04")
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|