diff --git a/android/app/build.gradle b/android/app/build.gradle index a87443e..4b59ad1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,6 +6,29 @@ if (localPropertiesFile.exists()) { } } +//add by Farry +def gitVersionCode() { + def cmd = 'git rev-list HEAD --first-parent --count' + cmd.execute().text.trim().toInteger() +} + +def gitVersionTag() { + def cmd = 'git describe --tags' + def version = cmd.execute().text.trim() + + def pattern = "-(\\d+)-g" + def matcher = version =~ pattern + + if (matcher) { + version = version.substring(0, matcher.start()) + "." + matcher[0][1] + } else { + version = version + ".0" + } + + return version +} +//add end + def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") @@ -40,8 +63,8 @@ android { applicationId "com.iotserv.gateway" minSdkVersion 16 targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + versionCode gitVersionCode() + versionName gitVersionTag() testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -55,6 +78,12 @@ android { } buildTypes { +// add by Farry + debug { + // 为了不和 release 版本冲突 + applicationIdSuffix ".debug" + } +// add end release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. diff --git a/android/app/libs/client.aar b/android/app/libs/client.aar index d081c8b..02b9d4c 100644 Binary files a/android/app/libs/client.aar and b/android/app/libs/client.aar differ diff --git a/pubspec.lock b/pubspec.lock index cc8bd0a..c712b3e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -265,9 +265,11 @@ packages: modules: dependency: "direct main" description: - path: "../modules" - relative: true - source: path + path: "." + ref: HEAD + resolved-ref: b9f16ad5c3e83c42b9ebbbc84bc2de56dfee2063 + url: "https://github.com/OpenIoTHub/modules" + source: git version: "0.0.1" open_file: dependency: transitive