feat: import Chinese-localized Buzz source snapshot
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
val uploadKeystorePath = providers.environmentVariable("BUZZ_ANDROID_UPLOAD_KEYSTORE_PATH").orNull
|
||||
val uploadKeystorePassword = providers.environmentVariable("BUZZ_ANDROID_UPLOAD_KEYSTORE_PASSWORD").orNull
|
||||
val uploadKeyAlias = providers.environmentVariable("BUZZ_ANDROID_UPLOAD_KEY_ALIAS").orNull
|
||||
val uploadKeyPassword = providers.environmentVariable("BUZZ_ANDROID_UPLOAD_KEY_PASSWORD").orNull
|
||||
val uploadSigningValues =
|
||||
mapOf(
|
||||
"BUZZ_ANDROID_UPLOAD_KEYSTORE_PATH" to uploadKeystorePath,
|
||||
"BUZZ_ANDROID_UPLOAD_KEYSTORE_PASSWORD" to uploadKeystorePassword,
|
||||
"BUZZ_ANDROID_UPLOAD_KEY_ALIAS" to uploadKeyAlias,
|
||||
"BUZZ_ANDROID_UPLOAD_KEY_PASSWORD" to uploadKeyPassword,
|
||||
)
|
||||
val missingUploadSigningValues = uploadSigningValues.filterValues { it.isNullOrBlank() }.keys
|
||||
val hasUploadSigning = missingUploadSigningValues.isEmpty()
|
||||
|
||||
// Worktree-aware debug identity (gitignored, written by
|
||||
// scripts/mobile-worktree-overrides.sh): debug builds from a git worktree get a
|
||||
// branch-labelled app name and a unique applicationId suffix so builds from
|
||||
// multiple worktrees install side by side. Release builds never read this.
|
||||
val worktreePropsFile = rootProject.file("worktree.properties")
|
||||
val worktreeProps =
|
||||
Properties().apply {
|
||||
if (worktreePropsFile.isFile) worktreePropsFile.inputStream().use { load(it) }
|
||||
}
|
||||
val worktreeLabel = worktreeProps.getProperty("label")?.takeIf { it.isNotBlank() }
|
||||
if (worktreeLabel != null && !worktreeLabel.matches(Regex("""[A-Za-z0-9._-]+"""))) {
|
||||
throw GradleException(
|
||||
"worktree.properties label must match [A-Za-z0-9._-]+ (safe for string " +
|
||||
"resources), got: " + worktreeLabel,
|
||||
)
|
||||
}
|
||||
val worktreeIdSuffix =
|
||||
worktreeProps.getProperty("applicationIdSuffix")?.takeIf { it.isNotBlank() }
|
||||
if (worktreeIdSuffix != null && !worktreeIdSuffix.matches(Regex("""\.[a-z][a-z0-9_]*"""))) {
|
||||
throw GradleException(
|
||||
"worktree.properties applicationIdSuffix must match \\.[a-z][a-z0-9_]*, got: " +
|
||||
worktreeIdSuffix,
|
||||
)
|
||||
}
|
||||
|
||||
// Release signing modes:
|
||||
// - "upload-keystore" (default): sign with the CI-vended upload keystore;
|
||||
// release builds fail loudly when any credential is missing.
|
||||
// - "external": deliberately produce an UNSIGNED release bundle for a
|
||||
// pipeline that signs through the central APK Signer service (Cashkite,
|
||||
// BOT-1234). No keystore material may be present in this mode.
|
||||
val releaseSigningMode =
|
||||
providers.environmentVariable("BUZZ_ANDROID_RELEASE_SIGNING").orNull ?: "upload-keystore"
|
||||
val externalReleaseSigning = releaseSigningMode == "external"
|
||||
if (releaseSigningMode !in setOf("upload-keystore", "external")) {
|
||||
throw GradleException(
|
||||
"BUZZ_ANDROID_RELEASE_SIGNING must be \"upload-keystore\" or \"external\", got: " +
|
||||
releaseSigningMode,
|
||||
)
|
||||
}
|
||||
if (externalReleaseSigning && uploadSigningValues.values.any { !it.isNullOrBlank() }) {
|
||||
throw GradleException(
|
||||
"BUZZ_ANDROID_RELEASE_SIGNING=external must not be combined with " +
|
||||
"BUZZ_ANDROID_UPLOAD_* credentials; unset one of them.",
|
||||
)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "xyz.block.buzz.mobile"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "xyz.block.buzz.mobile"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue("string", "app_name", "Buzz")
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (hasUploadSigning) {
|
||||
create("upload") {
|
||||
storeFile = file(requireNotNull(uploadKeystorePath))
|
||||
storePassword = uploadKeystorePassword
|
||||
keyAlias = uploadKeyAlias
|
||||
keyPassword = uploadKeyPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
// Only debug builds take the worktree identity; release/profile
|
||||
// keep the production applicationId and label.
|
||||
if (worktreeIdSuffix != null) {
|
||||
applicationIdSuffix = worktreeIdSuffix
|
||||
}
|
||||
if (worktreeLabel != null) {
|
||||
resValue("string", "app_name", "Buzz ($worktreeLabel)")
|
||||
}
|
||||
}
|
||||
release {
|
||||
if (hasUploadSigning) {
|
||||
signingConfig = signingConfigs.getByName("upload")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(kotlin("test"))
|
||||
|
||||
androidTestImplementation(kotlin("test"))
|
||||
androidTestImplementation("androidx.test.ext:junit:1.3.0")
|
||||
androidTestImplementation("androidx.test:runner:1.7.0")
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
val buildsRelease = allTasks.any { task ->
|
||||
task.project == project && task.name in setOf("assembleRelease", "bundleRelease")
|
||||
}
|
||||
if (buildsRelease && externalReleaseSigning) {
|
||||
// External signing: the unsigned bundle goes to the central APK
|
||||
// Signer. All keystore checks are intentionally skipped; the
|
||||
// guard above already rejected any BUZZ_ANDROID_UPLOAD_* values.
|
||||
return@whenReady
|
||||
}
|
||||
if (buildsRelease && !hasUploadSigning) {
|
||||
throw GradleException(
|
||||
"Release builds require Android upload signing credentials. Missing: " +
|
||||
missingUploadSigningValues.sorted().joinToString(", ") +
|
||||
". For central APK Signer pipelines set BUZZ_ANDROID_RELEASE_SIGNING=external.",
|
||||
)
|
||||
}
|
||||
if (buildsRelease) {
|
||||
val configuredKeystore = File(requireNotNull(uploadKeystorePath))
|
||||
if (!configuredKeystore.isAbsolute) {
|
||||
throw GradleException(
|
||||
"BUZZ_ANDROID_UPLOAD_KEYSTORE_PATH must be absolute: $configuredKeystore",
|
||||
)
|
||||
}
|
||||
val keystore = file(configuredKeystore)
|
||||
val repositoryRoot = rootProject.projectDir.parentFile.parentFile.canonicalFile
|
||||
if (keystore.canonicalFile.toPath().startsWith(repositoryRoot.toPath())) {
|
||||
throw GradleException(
|
||||
"BUZZ_ANDROID_UPLOAD_KEYSTORE_PATH must be outside the repository: $keystore",
|
||||
)
|
||||
}
|
||||
if (!keystore.isFile || !keystore.canRead()) {
|
||||
throw GradleException(
|
||||
"BUZZ_ANDROID_UPLOAD_KEYSTORE_PATH is not a readable file: $keystore",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
Reference in New Issue
Block a user