2022-08-15 21:50:55 -04:00
|
|
|
@file:Suppress("UnstableApiUsage")
|
|
|
|
|
|
2022-10-23 07:47:00 -07:00
|
|
|
import java.io.ByteArrayOutputStream
|
|
|
|
|
|
2021-07-17 00:26:04 +02:00
|
|
|
plugins {
|
|
|
|
|
id("com.android.application")
|
|
|
|
|
id("kotlin-android")
|
2022-08-07 07:25:09 +03:00
|
|
|
id("kotlin-parcelize")
|
2022-08-02 16:33:04 -04:00
|
|
|
kotlin("plugin.serialization") version "1.7.10"
|
2021-07-17 00:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android {
|
2022-08-02 16:28:06 -04:00
|
|
|
namespace = "com.aliucord.manager"
|
2022-07-04 15:57:57 -04:00
|
|
|
compileSdk = 33
|
2021-07-17 00:26:04 +02:00
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
minSdk = 24
|
2022-07-04 15:57:57 -04:00
|
|
|
targetSdk = 33
|
2021-07-17 00:26:04 +02:00
|
|
|
versionCode = 1
|
|
|
|
|
versionName = "0.0.1"
|
|
|
|
|
|
2022-12-14 19:21:40 -08:00
|
|
|
vectorDrawables {
|
|
|
|
|
useSupportLibrary = true
|
|
|
|
|
}
|
2021-07-17 00:26:04 +02:00
|
|
|
|
|
|
|
|
buildConfigField("String", "TAG", "\"AliucordManager\"")
|
|
|
|
|
buildConfigField("String", "SUPPORT_SERVER", "\"EsNDvBaHVU\"")
|
2022-10-30 08:44:58 -07:00
|
|
|
buildConfigField("boolean", "RN_ENABLED", "true")
|
2022-10-23 07:47:00 -07:00
|
|
|
|
|
|
|
|
buildConfigField("String", "GIT_BRANCH", "\"${getCurrentBranch()}\"")
|
|
|
|
|
buildConfigField("String", "GIT_COMMIT", "\"${getLatestCommit()}\"")
|
|
|
|
|
buildConfigField("boolean", "GIT_LOCAL_COMMITS", "${gitHasLocalCommits()}")
|
|
|
|
|
buildConfigField("boolean", "GIT_LOCAL_CHANGES", "${gitHasLocalChanges()}")
|
2021-07-17 00:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
release {
|
|
|
|
|
isMinifyEnabled = true
|
2022-08-15 00:25:40 -04:00
|
|
|
isShrinkResources = true
|
2021-07-17 00:26:04 +02:00
|
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-17 18:25:22 -05:00
|
|
|
|
2022-09-18 12:42:27 -07:00
|
|
|
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"
|
|
|
|
|
|
|
|
|
|
// okhttp3 is used by some lib (no cookies so publicsuffixes.gz can be dropped)
|
|
|
|
|
excludes += "/okhttp3/**"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-17 00:26:04 +02:00
|
|
|
compileOptions {
|
2022-02-17 18:25:22 -05:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
2021-07-17 00:26:04 +02:00
|
|
|
}
|
2022-02-17 18:25:22 -05:00
|
|
|
|
2021-07-17 00:26:04 +02:00
|
|
|
kotlinOptions {
|
2022-02-17 18:25:22 -05:00
|
|
|
jvmTarget = "11"
|
2022-12-14 19:21:40 -08:00
|
|
|
freeCompilerArgs += listOf(
|
|
|
|
|
"-Xcontext-receivers",
|
|
|
|
|
"-P",
|
|
|
|
|
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=${buildDir.resolve("report").absolutePath}",
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
compose = true
|
2021-07-17 00:26:04 +02:00
|
|
|
}
|
2022-02-17 18:25:22 -05:00
|
|
|
|
2022-12-14 19:21:40 -08:00
|
|
|
composeOptions {
|
|
|
|
|
kotlinCompilerExtensionVersion = "1.3.1"
|
|
|
|
|
}
|
2022-03-05 15:45:46 -05:00
|
|
|
}
|
|
|
|
|
|
2021-07-17 00:26:04 +02:00
|
|
|
dependencies {
|
2022-08-31 23:53:35 -04:00
|
|
|
// AndroidX
|
2022-09-11 13:36:36 -04:00
|
|
|
implementation("androidx.core:core-ktx:1.9.0")
|
2022-08-02 16:33:04 -04:00
|
|
|
implementation("androidx.core:core-splashscreen:1.0.0")
|
2022-11-05 11:28:18 -07:00
|
|
|
implementation("androidx.activity:activity-compose:1.6.1")
|
|
|
|
|
implementation("androidx.paging:paging-compose:1.0.0-alpha17")
|
2022-08-07 07:25:09 +03:00
|
|
|
|
2022-08-31 23:53:35 -04:00
|
|
|
// Compose
|
2022-09-11 13:36:36 -04:00
|
|
|
val composeVersion = "1.3.0-beta02"
|
2022-08-31 23:53:35 -04:00
|
|
|
implementation("androidx.compose.ui:ui:$composeVersion")
|
|
|
|
|
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
|
|
|
|
|
implementation("androidx.compose.material:material-icons-extended:$composeVersion")
|
2022-11-05 11:28:18 -07:00
|
|
|
implementation("androidx.compose.material3:material3:1.0.0")
|
2021-07-17 00:26:04 +02:00
|
|
|
|
|
|
|
|
// accompanist dependencies
|
2022-09-12 17:28:53 -04:00
|
|
|
val accompanistVersion = "0.26.3-beta"
|
2022-09-05 17:58:56 -04:00
|
|
|
implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion")
|
2022-09-06 18:55:18 -04:00
|
|
|
implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion")
|
2021-07-17 00:26:04 +02:00
|
|
|
|
2022-08-31 23:53:35 -04:00
|
|
|
// Ktor
|
2022-09-06 18:53:59 -04:00
|
|
|
val ktorVersion = "2.1.1"
|
2022-08-31 23:53:35 -04:00
|
|
|
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
2022-09-23 16:44:34 -07:00
|
|
|
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
|
2022-08-31 23:53:35 -04:00
|
|
|
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
|
|
|
|
|
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
|
|
|
|
|
2022-08-15 00:25:40 -04:00
|
|
|
// Koin
|
|
|
|
|
val koinVersion = "3.2.0"
|
|
|
|
|
implementation("io.insert-koin:koin-android:$koinVersion")
|
|
|
|
|
implementation("io.insert-koin:koin-androidx-compose:$koinVersion")
|
|
|
|
|
|
2022-08-31 23:53:35 -04:00
|
|
|
// Other
|
2022-11-05 11:28:18 -07:00
|
|
|
implementation("dev.olshevski.navigation:reimagined:1.3.0")
|
2022-09-11 13:36:36 -04:00
|
|
|
implementation("io.coil-kt:coil-compose:2.2.1")
|
2022-04-10 00:08:23 -04:00
|
|
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
2022-10-22 12:02:48 -07:00
|
|
|
implementation("io.github.diamondminer88:zip-android:2.1.0@aar")
|
2022-09-25 13:06:11 -07:00
|
|
|
implementation("com.aliucord:axml:1.0.1")
|
2022-11-05 11:28:18 -07:00
|
|
|
implementation("com.android.tools.build:apksig:7.4.0-beta04")
|
2022-08-24 20:58:53 -04:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
|
2022-12-14 19:21:40 -08:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.5")
|
2022-03-12 22:30:38 +01:00
|
|
|
}
|
2022-10-23 07:47:00 -07:00
|
|
|
|
|
|
|
|
fun getCurrentBranch(): String? =
|
2022-11-05 11:28:18 -07:00
|
|
|
exec("git", "symbolic-ref", "--short", "HEAD")
|
2022-10-23 07:47:00 -07:00
|
|
|
|
|
|
|
|
fun getLatestCommit(): String? =
|
|
|
|
|
exec("git", "rev-parse", "--short", "HEAD")
|
|
|
|
|
|
|
|
|
|
fun gitHasLocalCommits(): Boolean {
|
|
|
|
|
val branch = getCurrentBranch() ?: return false
|
|
|
|
|
return exec("git", "log", "origin/$branch..HEAD")?.isNotEmpty() ?: false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun gitHasLocalChanges(): 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 (t: Throwable) {
|
|
|
|
|
t.printStackTrace()
|
|
|
|
|
null
|
|
|
|
|
}
|
|
|
|
|
}
|