You've already forked KsuWebUIStandalone
mirror of
https://github.com/5ec1cff/KsuWebUIStandalone.git
synced 2025-09-06 06:37:11 +00:00
115 lines
3.4 KiB
Plaintext
115 lines
3.4 KiB
Plaintext
@file:Suppress("UnstableApiUsage")
|
|
|
|
import com.android.build.gradle.tasks.PackageAndroidArtifact
|
|
import java.io.ByteArrayOutputStream
|
|
import java.io.FileInputStream
|
|
import java.util.Properties
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.jetbrains.kotlin.android)
|
|
}
|
|
|
|
val keystorePropertiesFile: File = rootProject.file("keystore.properties")
|
|
val keystoreProperties = if (keystorePropertiesFile.exists() && keystorePropertiesFile.isFile) {
|
|
Properties().apply {
|
|
load(FileInputStream(keystorePropertiesFile))
|
|
}
|
|
} else null
|
|
|
|
fun String.execute(currentWorkingDir: File = file("./")): String {
|
|
val byteOut = ByteArrayOutputStream()
|
|
project.exec {
|
|
workingDir = currentWorkingDir
|
|
commandLine = split("\\s".toRegex())
|
|
standardOutput = byteOut
|
|
}
|
|
return String(byteOut.toByteArray()).trim()
|
|
}
|
|
|
|
val gitCommitCount = "git rev-list HEAD --count".execute().toInt()
|
|
|
|
android {
|
|
namespace = "io.github.a13e300.ksuwebui"
|
|
compileSdk = 36
|
|
|
|
signingConfigs {
|
|
if (keystoreProperties != null) {
|
|
create("release") {
|
|
keyAlias = keystoreProperties["keyAlias"] as String
|
|
keyPassword = keystoreProperties["keyPassword"] as String
|
|
storeFile = file(keystoreProperties["storeFile"] as String)
|
|
storePassword = keystoreProperties["storePassword"] as String
|
|
}
|
|
}
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "io.github.a13e300.ksuwebui"
|
|
minSdk = 26
|
|
targetSdk = 36
|
|
versionCode = gitCommitCount
|
|
versionName = "1.0"
|
|
setProperty("archivesBaseName", "KsuWebUI-$versionName-$versionCode")
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
val releaseSig = signingConfigs.findByName("release")
|
|
signingConfig = if (releaseSig != null) releaseSig else {
|
|
println("use debug signing config")
|
|
signingConfigs["debug"]
|
|
}
|
|
}
|
|
}
|
|
dependenciesInfo {
|
|
includeInApk = false
|
|
includeInBundle = false
|
|
}
|
|
// https://stackoverflow.com/a/77745844
|
|
tasks.withType<PackageAndroidArtifact> {
|
|
doFirst { appMetadata.asFile.orNull?.writeText("") }
|
|
}
|
|
androidResources {
|
|
generateLocaleConfig = true
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
kotlin {
|
|
jvmToolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(21))
|
|
}
|
|
}
|
|
buildFeatures {
|
|
buildConfig = true
|
|
viewBinding = true
|
|
}
|
|
packaging {
|
|
resources {
|
|
excludes += "**"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.activity.ktx)
|
|
implementation(libs.androidx.appcompat)
|
|
implementation(libs.androidx.swiperefreshlayout)
|
|
implementation(libs.androidx.recyclerview)
|
|
implementation(libs.androidx.webkit)
|
|
implementation(libs.material)
|
|
|
|
implementation(libs.com.github.topjohnwu.libsu.core)
|
|
implementation(libs.com.github.topjohnwu.libsu.service)
|
|
implementation(libs.com.github.topjohnwu.libsu.io)
|
|
}
|