You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by lu...@apache.org on 2019/05/16 09:32:19 UTC
[incubator-weex] branch master updated: [Android] Check weexVersion
(#2451)
This is an automated email from the ASF dual-hosted git repository.
luckychen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new 151c469 [Android] Check weexVersion (#2451)
151c469 is described below
commit 151c46939847185c6cc58dd97dbbee2e37e5fb18
Author: YorkShen <sh...@gmail.com>
AuthorDate: Thu May 16 17:32:14 2019 +0800
[Android] Check weexVersion (#2451)
* [Android] Check weexVersion
1. The version must have 4 sections.
2. The leading three section must be number, and the last section is odd number with or without suffix string.
* [Android] Add ignoreVersionCheck
---
android/sdk/build.gradle | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle
index 0e3183d..182908f 100755
--- a/android/sdk/build.gradle
+++ b/android/sdk/build.gradle
@@ -63,7 +63,26 @@ checkstyle {
toolVersion = '6.9'
}
-version = project.hasProperty('weexVersion')? project.getProperty('weexVersion') : "0.20.0.1"
+version = project.hasProperty('weexVersion') ? project.getProperty('weexVersion') : "0.20.0.1"
+
+//Check version, the version must have 4 sections. The leading three section must be number, and the last section is odd number with or without suffix string.
+if (!project.hasProperty('ignoreVersionCheck') || !project.getProperty('ignoreVersionCheck').equals("true")) {
+ assert version.tokenize('.').eachWithIndex { it, i ->
+ if (i < 3) {
+ assert it.isNumber()
+ } else if (i == 3) {
+ it.split("-|_").toList().eachWithIndex { inner_it, inner_i ->
+ if (inner_i == 0) {
+ assert inner_it.isNumber() && inner_it.toInteger() % 2
+ } else {
+ assert !inner_it.isNumber()
+ }
+ }.size == 4
+ } else {
+ assert false: "Please use semantic versioning witch 4 sections, you are using ${$ { i } + 1} section instead"
+ }
+ }.size == 4
+}
android {
compileSdkVersion project.compileSdkVersion