TaiwanStar_general_size_s_C.../app/build.gradle
sky121113 3409f93f07 [REFACTOR] 重構銷售流程至雙維度 Flavor 架構、統一忙碌狀態並修正版本規範
1. 引進 SaleFlowHandler 與 SaleFlowCallback 介面,分離通用版 (General)、晟崴版 (Chengwai) 與中國醫版 (Cmuh) 的前台銷售進入點,降低 FontendActivity 耦合度。
2. 建立 src/Chengwai/、src/Cmuh/、src/General/ 目錄,將客製 dialog(如 FontendPickupCodeDialog、TakeMedicineDialog)與 layout 移入對應的專屬目錄。
3. 統一狀態檢查機制,將全專案背景排程、定時重啟與日誌備份中的舊 isShowDialog() 替換為更安全的 isMachineBusy();於 NFC 交易與鍵盤 Enter 防誤觸中特意保留原 isShowDialog() 以守護安全性防線。
4. 修正英文 values-en/strings.xml 缺漏與預設 locale 對齊的 sync_product/sync_product_warning,解決 lintVital 報告的 ExtraTranslation 錯誤,使 Release 打包 100% 成功。
5. 微調 app/build.gradle,將起點版號重置為 10_01_1,自動連動 versionCode 100101 與 versionName 10_01_1_R。
6. 修正 .agents/rules/versioning.md 規範,將 S 修正為「來源 (Source)」,將 verMajor 修正為「螢幕大小」,並補齊官方命名規範對照圖表與欄位解析。
7. 升級一鍵編譯 /compiler-apk(新增中文與英文別名智慧防呆映射)與新建發版 /release-apk 工作流。
2026-05-27 14:48:22 +08:00

117 lines
3.7 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

plugins {
alias(libs.plugins.android.application)
}
// =========================================================================
// 核心版號與自動連動定義
// 每次發佈新版本給機台時,只需遞增 verPatch (修補版號)。
// 例如:從 5 改為 6對應的 versionName 就會自動變成 "10_08_6_R"
// versionCode 就會自動變大為 100806以正確觸發實體機台的 OTA 自動更新。
// =========================================================================
def verMajor = 10
def verMinor = 1
def verPatch = 1
android {
namespace 'com.unibuy.smartdevice'
compileSdk 35
defaultConfig {
applicationId "com.unibuy.smartdevice"
minSdk 21
targetSdk 34
versionCode verMajor * 10000 + verMinor * 100 + verPatch
versionName "${verMajor}_0${verMinor}_${verPatch}_R"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// =====================================================================
// 雙維度 Flavorproject客戶專案× hardware硬體規格
// =====================================================================
flavorDimensions "project", "hardware"
productFlavors {
General {
dimension "project"
}
Chengwai {
dimension "project"
}
Cmuh {
dimension "project"
}
S12XYU {
dimension "hardware"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
// 自定義打包檔案名稱遵循公司命名規範來源_安卓號_主板號_機器系列_專案名稱_螢幕大小_次版號_修補版號_環境
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionName = variant.versionName
def project = variant.productFlavors[0].name // project dimension
def hardware = variant.productFlavors[1].name // hardware dimension
def buildType = variant.buildType.name
// 將 hardware flavor 名稱展開為公司規範格式 S12XYU → S_12_XY_U
def hwFormatted = hardware
.replaceAll(/^([A-Z])(\d+)([A-Z]+)([A-Z])$/, '$1_$2_$3_$4')
// 輸出範例app-S_12_XY_U_Chengwai-10_08_8_R-release.apk
output.outputFileName = "app-${hwFormatted}_${project}-${versionName}-${buildType}.apk"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildFeatures {
viewBinding true
}
packaging {
resources {
excludes += ['META-INF/INDEX.LIST', 'META-INF/io.netty.versions.properties']
}
}
}
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.activity
implementation libs.constraintlayout
implementation libs.work.runtime
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
annotationProcessor libs.compiler
implementation libs.usb.serial.for.android
implementation libs.android.serialport
implementation libs.glide
implementation libs.media3.exoplayer
implementation libs.media3.ui
implementation libs.tsnackBar
implementation 'com.blankj:utilcodex:1.31.1'
implementation 'com.hivemq:hivemq-mqtt-client:1.3.3'
implementation 'io.netty:netty-codec-http:4.1.94.Final'
implementation 'io.netty:netty-handler:4.1.94.Final'
implementation 'com.google.code.gson:gson:2.10.1'
}