108 lines
3.3 KiB
Kotlin
108 lines
3.3 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.compose)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.gacy.android"
|
|
compileSdk = 35
|
|
|
|
defaultConfig {
|
|
applicationId = "com.gacy.android"
|
|
minSdk = 26
|
|
targetSdk = 35
|
|
versionCode = 7
|
|
versionName = "v1.0.6"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
ndk {
|
|
abiFilters += listOf("arm64-v8a")
|
|
if (providers.gradleProperty("gacyEmulator").isPresent) abiFilters += "x86_64"
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
getByName("main") {
|
|
jniLibs.srcDirs("src/main/jniLibs")
|
|
assets.setSrcDirs(listOf("src/goAssets"))
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = false
|
|
signingConfig = signingConfigs.getByName("debug")
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
buildFeatures {
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
packaging {
|
|
jniLibs {
|
|
useLegacyPackaging = true
|
|
keepDebugSymbols += "**/libgacy_*.so"
|
|
excludes += listOf("**/libchaquopy*.so", "**/libpython*.so", "**/libcrypto_*.so", "**/libsqlite3_*.so", "**/libssl_*.so")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
|
implementation("androidx.lifecycle:lifecycle-service:2.8.6")
|
|
implementation(libs.androidx.activity.compose)
|
|
implementation(platform(libs.androidx.compose.bom))
|
|
implementation(libs.androidx.ui)
|
|
implementation(libs.androidx.ui.graphics)
|
|
implementation(libs.androidx.ui.tooling.preview)
|
|
implementation(libs.androidx.material3)
|
|
implementation(libs.androidx.material.icons.extended)
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
implementation(libs.okhttp)
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
|
testImplementation("org.json:json:20240303")
|
|
debugImplementation(libs.androidx.ui.tooling)
|
|
}
|
|
|
|
tasks.named("preBuild") {
|
|
doFirst {
|
|
val required = listOf(
|
|
"src/goAssets/gacy-go-data.zip",
|
|
"src/main/jniLibs/arm64-v8a/libgacy_sdkserver.so",
|
|
"src/main/jniLibs/arm64-v8a/libgacy_gameserver.so"
|
|
)
|
|
check(required.all { file(it).isFile }) {
|
|
"GaCy Go runtime is missing. Run: python tools/package_go_runtime.py <path-to-GaC-hkrpg-go>"
|
|
}
|
|
}
|
|
}
|
|
|
|
val copyDebugApkToRoot by tasks.registering {
|
|
doNotTrackState("Copies the APK into the project root")
|
|
onlyIf { tasks.named("assembleDebug").get().state.failure == null }
|
|
doLast {
|
|
val source = layout.buildDirectory.file("outputs/apk/debug/app-debug.apk").get().asFile
|
|
check(source.isFile) { "Debug APK was not produced" }
|
|
source.copyTo(rootProject.file("GaCy-Android-${android.defaultConfig.versionName}-debug.apk"), overwrite = true)
|
|
}
|
|
}
|
|
|
|
tasks.matching { it.name == "assembleDebug" }.configureEach {
|
|
finalizedBy(copyDebugApkToRoot)
|
|
}
|