2698116696
- compile-android.sh: 建 libbox.aar + split-per-abi 取 arm64-v8a(~82MB, 避 232MB universal) + release 签名(RELEASE_KEYSTORE/KEY_PASSWORD)。本地已验证构建通过、 libbox.so 打进 APK。 - compile-windows.sh: 复用 client/windows/installer/pangolin.iss(Inno Setup),不签名。 - release-client.sh / deploy-client.sh: 复用 pangolin lib-forgejo/lib-ssh,传 Gitea release + 部署最新到 pangolin1:/var/lib/pangolin/downloads(仅留最新)。 - deploy-client.yml: client-v* tag → build-android(mac)+build-windows(windows) → release-deploy(mac)。 - build.gradle: 补 release 签名 config(读 key.properties, 缺则回退 debug)。 - 待确认: keystore alias/密码(见脚本 TODO);runner 需提到 user 级;服务器 /downloads + 官网链接下一步。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
104 lines
3.6 KiB
Groovy
104 lines
3.6 KiB
Groovy
plugins {
|
||
id "com.android.application"
|
||
id "kotlin-android"
|
||
id "dev.flutter.flutter-gradle-plugin"
|
||
}
|
||
|
||
def localProperties = new Properties()
|
||
def localPropertiesFile = rootProject.file('local.properties')
|
||
if (localPropertiesFile.exists()) {
|
||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||
localProperties.load(reader)
|
||
}
|
||
}
|
||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||
if (flutterVersionCode == null) {
|
||
flutterVersionCode = '1'
|
||
}
|
||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||
if (flutterVersionName == null) {
|
||
flutterVersionName = '1.0'
|
||
}
|
||
|
||
// ── release 签名(key.properties 不入库,由本地或 CI 生成)────────────────
|
||
// 缺失时回退 debug 签名,保证本地 `flutter run --release`/无密钥环境仍可构建。
|
||
// CI 侧由 scripts/ci/compile-android.sh 落盘:client/android/key.properties
|
||
// (storeFile/storePassword/keyAlias/keyPassword)。
|
||
def keystoreProperties = new Properties()
|
||
def keystorePropertiesFile = rootProject.file('key.properties')
|
||
def hasReleaseSigning = keystorePropertiesFile.exists()
|
||
if (hasReleaseSigning) {
|
||
keystorePropertiesFile.withReader('UTF-8') { reader ->
|
||
keystoreProperties.load(reader)
|
||
}
|
||
}
|
||
|
||
android {
|
||
namespace "com.pangolin.pangolin_vpn"
|
||
compileSdkVersion flutter.compileSdkVersion
|
||
ndkVersion flutter.ndkVersion
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '1.8'
|
||
}
|
||
|
||
sourceSets {
|
||
main.java.srcDirs += 'src/main/kotlin'
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId "com.pangolin.pangolin_vpn"
|
||
// libbox requires minSdk 21 (gomobile -androidapi 21)
|
||
minSdkVersion Math.max(flutter.minSdkVersion as Integer, 21)
|
||
targetSdkVersion flutter.targetSdkVersion
|
||
versionCode flutterVersionCode.toInteger()
|
||
versionName flutterVersionName
|
||
}
|
||
|
||
signingConfigs {
|
||
if (hasReleaseSigning) {
|
||
release {
|
||
storeFile file(keystoreProperties['storeFile'])
|
||
storePassword keystoreProperties['storePassword']
|
||
keyAlias keystoreProperties['keyAlias']
|
||
keyPassword keystoreProperties['keyPassword']
|
||
}
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
signingConfig hasReleaseSigning ? signingConfigs.release : signingConfigs.debug
|
||
}
|
||
}
|
||
}
|
||
|
||
flutter {
|
||
source '../..'
|
||
}
|
||
|
||
dependencies {
|
||
// ── sing-box libbox(gomobile AAR)──────────────────────────────
|
||
// 产物(gitignore,清掉/换 worktree 都要重建)二选一,均产 io.nekohasekai.libbox 包:
|
||
// bash scripts/build-libbox.sh android # 官方 build_libbox,需 NDK ≥ 28(自动部署到此路径)
|
||
// cd app/kernel && ./build-android.sh # 裸 gomobile bind,精简 tag、NDK 27 可
|
||
// ⚠️ 包名必须是 io.nekohasekai.libbox(Kotlin import 依赖);若编出默认 `libbox` 包,
|
||
// 多半是 build-android.sh 漏了 -javapkg io.nekohasekai。
|
||
// 路径:client/android/app → ../../.. → repo root → app/kernel/dist/android/
|
||
// Kotlin stdlib 由 kotlin-android 插件自动引入,无需显式声明。
|
||
def libboxAar = file("${projectDir}/../../../app/kernel/dist/android/libbox.aar")
|
||
if (libboxAar.exists()) {
|
||
implementation files(libboxAar)
|
||
} else {
|
||
logger.warn("⚠ libbox.aar not found at ${libboxAar.absolutePath}")
|
||
logger.warn(" Run: cd app/kernel && ./build-android.sh")
|
||
}
|
||
}
|