Plugin gradle automatically synchronizes the version number

This commit is contained in:
wangyupeng1-iri 2017-07-12 21:55:44 +08:00
parent 8fac381ea0
commit 8d8c781bab
2 changed files with 12 additions and 3 deletions

View File

@ -40,7 +40,13 @@ buildscript {
}
group = 'com.qihoo360.replugin' //
version = '2.1.4' //
String classPath = ".src.main.groovy.com.qihoo360.replugin.gradle.plugin.AppConstant".replace(".", java.io.File.separator)
String verPath = "${project.projectDir}" + classPath + ".groovy"
String verLine = new File(verPath).filterLine { it =~ /def static final VER =/ }
version = "${verLine.split("\"")[1]}" //
//
java.lang.System.err.println "version=${version}"
dependencies {
compile 'com.android.tools.build:gradle:2.1.3'
@ -106,4 +112,4 @@ publishing {
}
}
apply from: 'bintray.gradle'
apply from: 'bintray.gradle'

View File

@ -22,8 +22,11 @@ package com.qihoo360.replugin.gradle.plugin
*/
class AppConstant {
/** 版本号 */
def static final VER = "2.1.5"
/** 打印信息时候的前缀 */
def static final TAG = "< replugin-plugin-v2.1.1 >"
def static final TAG = "< replugin-plugin-v${VER} >"
/** 外部用户配置信息 */
def static final USER_CONFIG = "repluginPluginConfig"