From 8d8c781bab4e0f4dbed6709205e6815ca7a787ec Mon Sep 17 00:00:00 2001 From: wangyupeng1-iri <871791801@qq.com> Date: Wed, 12 Jul 2017 21:55:44 +0800 Subject: [PATCH] Plugin gradle automatically synchronizes the version number --- replugin-plugin-gradle/build.gradle | 10 ++++++++-- .../qihoo360/replugin/gradle/plugin/AppConstant.groovy | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/replugin-plugin-gradle/build.gradle b/replugin-plugin-gradle/build.gradle index b90ca11..fd50c20 100644 --- a/replugin-plugin-gradle/build.gradle +++ b/replugin-plugin-gradle/build.gradle @@ -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' \ No newline at end of file diff --git a/replugin-plugin-gradle/src/main/groovy/com/qihoo360/replugin/gradle/plugin/AppConstant.groovy b/replugin-plugin-gradle/src/main/groovy/com/qihoo360/replugin/gradle/plugin/AppConstant.groovy index d6511c6..23347bf 100644 --- a/replugin-plugin-gradle/src/main/groovy/com/qihoo360/replugin/gradle/plugin/AppConstant.groovy +++ b/replugin-plugin-gradle/src/main/groovy/com/qihoo360/replugin/gradle/plugin/AppConstant.groovy @@ -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"