验证中...
7.21 杭州源创会火热报名中,一起来看看移动开发如何紧跟浪潮?
configure.gradle
原始数据 复制代码
ext {
isModuleDebug = false
isOnLine= false
android = [compileSdkVersion : 25,
buildToolsVersion : "25.0.2",
minSdkVersion : 22,
targetSdkVersion : 22,
versionCode : getVersionCode(),
versionName : getVersionName()
]
}
//git commit 总数
def int getVersionCode() {
def cmd = "git rev-list HEAD --count"
return cmd.execute().text.trim().toInteger()
}
//git tag + 距离该tag的commit数
def String getVersionName() {
def cmd = "git describe --tags"
def tagDesc = cmd.execute().text.trim()
def pattern = "-(\\d+)-g"
def matcher = tagDesc =~ pattern
def tagName
def commitCount
if (matcher) {
tagName = tagDesc.substring(0, matcher.start())
commitCount = matcher[0][1]
} else {
tagName = tagDesc;
commitCount = "0";
}
return tagName + "." + commitCount
}

评论列表( 0 )

你可以在登录后,发表评论

11_float_left_people 11_float_left_close