Explorar el Código

Merge tag '2.2.1' into develop

cc12458 hace 2 semanas
padre
commit
5690d8a9b8

+ 53 - 19
app/build.gradle.kts

@@ -1,6 +1,7 @@
 import com.android.build.gradle.internal.api.BaseVariantOutputImpl
 import java.text.SimpleDateFormat
 import java.util.Date
+import java.util.Properties
 
 fun getVersionCode(): Int {
   val dateFormat = SimpleDateFormat("yyyyMMdd")
@@ -15,6 +16,35 @@ plugins {
   alias(libs.plugins.kotlin.serialization)
 }
 
+// 读取 gradle.properties 并解析 project.xx 字段
+fun buildTypeChain(): Map<String, List<String>> {
+  val properties = Properties()
+  val file = File(rootDir, "gradle.properties")
+  if (file.exists()) {
+    properties.load(file.inputStream())
+  }
+
+  // 只取 project.xx 字段
+  val projectMap = properties.entries
+    .filter { (k, _) -> k.toString().startsWith("project.") }
+    .associate { (k, v) -> k.toString().removePrefix("project.") to v.toString() }
+
+  // 递归查找链
+  fun resolveChain(key: String): List<String> {
+    val next = projectMap[key]
+    return if (next == null || next == "debug" || next == "release") {
+      listOfNotNull(key, next)
+    } else {
+      listOf(key) + resolveChain(next)
+    }
+  }
+
+  // 构建所有链并返回
+  return projectMap.keys.associateWith { resolveChain(it) }
+}
+
+val buildTypeChain = buildTypeChain()
+
 android {
   namespace = "com.hzliuzhi.applet.container"
   compileSdk = 35
@@ -24,7 +54,7 @@ android {
     minSdk = 26
     targetSdk = 35
     versionCode = getVersionCode()
-    versionName = "2.0.0"
+    versionName = "2.2.1"
 
     testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
   }
@@ -34,27 +64,31 @@ android {
       isMinifyEnabled = false
       proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
     }
-    create("aio") {
-      initWith(getByName("debug"))
-      matchingFallbacks += listOf("debug")
-    }
-    create("aio-test") {
-      initWith(getByName("aio"))
-      matchingFallbacks += listOf("aio", "debug")
-    }
-    create("aio-CQ") {
-      initWith(getByName("aio-test"))
-      matchingFallbacks += listOf("aio-test", "aio", "debug")
-    }
+    buildTypeChain.values.sortedBy { it.size }.forEach { chain ->
+      when (val name = chain.first()) {
+        "debug",
+        "release",
+          -> return@forEach
 
-    create("pda") {
-      initWith(getByName("debug"))
-      matchingFallbacks += listOf("debug")
+        else -> create(name) {
+          // initWith 取 chain 的下一个(即父级)
+          initWith(getByName(chain.getOrNull(1) ?: "debug"))
+          // matchingFallbacks 取除自己外的所有
+          matchingFallbacks += chain.drop(1)
+        }
+      }
     }
+  }
 
-    create("pda-test") {
-      initWith(getByName("pda"))
-      matchingFallbacks += listOf("pda", "debug")
+  sourceSets {
+    buildTypeChain.forEach { (name, chain) ->
+      maybeCreate(name).apply {
+        // 不包含 main,只合并链上的自定义类型
+        val dirs = chain.reversed()
+        dirs.forEach { dir ->
+          assets.srcDir("src/$dir/assets")
+        }
+      }
     }
   }
 

+ 6 - 0
app/src/pda-CQHZDJZX/res/values/application.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="app_id">PDA</string>
+  <string name="app_name">中药处方煎配朔源管理(重庆医药杭州代煎中心)</string>
+  <string name="app_screen">browser/kiosk?url=http://115.236.184.98:29110/pharmacy/pda/</string>
+</resources>

+ 10 - 0
app/src/pda-CQHZDJZX/res/values/browser_update.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="browser_min_version">111</string>
+  <bool name="browser_update_force">true</bool>
+  <string-array name="browser_update_package">
+    <item>com.google.android.webview</item>
+    <item>com.android.webview</item>
+    <item>com.android.chrome</item>
+  </string-array>
+</resources>

+ 6 - 0
app/src/pda-HZ/res/values/application.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="app_id">PDA</string>
+  <string name="app_name">中药处方煎配朔源管理(区域版.HZ)</string>
+  <string name="app_screen">browser/kiosk?url=http://8.139.252.178:8001/pharmacy/pda/</string>
+</resources>

+ 10 - 0
app/src/pda-HZ/res/values/browser_update.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="browser_min_version">111</string>
+  <bool name="browser_update_force">true</bool>
+  <string-array name="browser_update_package">
+    <item>com.google.android.webview</item>
+    <item>com.android.webview</item>
+    <item>com.android.chrome</item>
+  </string-array>
+</resources>

+ 6 - 0
app/src/pda-prod/res/values/application.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="app_id">PDA</string>
+  <string name="app_name">中药处方煎配朔源管理</string>
+  <string name="app_screen">browser/kiosk?url=https://wx.hzliuzhi.com/pharmacy/pda/</string>
+</resources>

+ 10 - 0
app/src/pda-prod/res/values/browser_update.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <string name="browser_min_version">111</string>
+  <bool name="browser_update_force">true</bool>
+  <string-array name="browser_update_package">
+    <item>com.google.android.webview</item>
+    <item>com.android.webview</item>
+    <item>com.android.chrome</item>
+  </string-array>
+</resources>

+ 12 - 1
gradle.properties

@@ -21,4 +21,15 @@ kotlin.code.style=official
 # Enables namespacing of each library's R class so that its R class includes only the
 # resources declared in the library itself and none from the library's dependencies,
 # thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
+android.nonTransitiveRClass=true
+
+project.aio=debug
+project.aio-test=aio
+project.aio-CQ=aio-test
+
+project.pda=debug
+project.pda-test=pda
+project.pda-prod=pda-test
+project.pda-HZ=pda-prod
+# ??????????????
+project.pda-CQHZDJZX=pda-prod