|
@@ -1,9 +1,20 @@
|
|
|
|
|
+import java.io.FileInputStream
|
|
|
|
|
+import java.util.Properties
|
|
|
|
|
+
|
|
|
plugins {
|
|
plugins {
|
|
|
id("com.android.application")
|
|
id("com.android.application")
|
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 发布签名凭据放在 android/key.properties(和 mathtool2 同一套)。
|
|
|
|
|
+// 该文件和 key.jks 都已被 android/.gitignore 忽略,不会进仓库。
|
|
|
|
|
+val keystorePropertiesFile = rootProject.file("key.properties")
|
|
|
|
|
+val keystoreProperties = Properties()
|
|
|
|
|
+if (keystorePropertiesFile.exists()) {
|
|
|
|
|
+ keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
android {
|
|
android {
|
|
|
namespace = "com.nonvioce.cal"
|
|
namespace = "com.nonvioce.cal"
|
|
|
compileSdk = flutter.compileSdkVersion
|
|
compileSdk = flutter.compileSdkVersion
|
|
@@ -26,10 +37,26 @@ android {
|
|
|
multiDexEnabled = true
|
|
multiDexEnabled = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ signingConfigs {
|
|
|
|
|
+ // 只有拿到凭据才建这个配置;否则下面的 release 退回调试签名,
|
|
|
|
|
+ // 保证"没带 key.properties 的机器"上依然能构建。
|
|
|
|
|
+ if (keystorePropertiesFile.exists()) {
|
|
|
|
|
+ create("release") {
|
|
|
|
|
+ keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
|
|
|
+ keyPassword = keystoreProperties.getProperty("keyPassword")
|
|
|
|
|
+ storeFile = file(keystoreProperties.getProperty("storeFile"))
|
|
|
|
|
+ storePassword = keystoreProperties.getProperty("storePassword")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
buildTypes {
|
|
buildTypes {
|
|
|
release {
|
|
release {
|
|
|
- // TODO: Add your own signing config for the release build.
|
|
|
|
|
- signingConfig = signingConfigs.getByName("debug")
|
|
|
|
|
|
|
+ signingConfig = if (keystorePropertiesFile.exists()) {
|
|
|
|
|
+ signingConfigs.getByName("release")
|
|
|
|
|
+ } else {
|
|
|
|
|
+ signingConfigs.getByName("debug")
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 【真机实测的结论】不要对 Symja 开 R8 混淆。
|
|
// 【真机实测的结论】不要对 Symja 开 R8 混淆。
|
|
|
// Symja 及其依赖大量用「类名字符串」做反射创建,R8 看不到引用关系就会改名,
|
|
// Symja 及其依赖大量用「类名字符串」做反射创建,R8 看不到引用关系就会改名,
|