1 Star 8 Fork 6

山野羡民 / RSAUtils

加入 Gitee
與超過 1200 萬 開發者一起發現、參與優秀開源項目,私有倉庫也完全免費 :)
免費加入
克隆/下載
build.gradle 3.14 KB
一鍵複製 編輯 原始數據 按行查看 歷史
liyujiang 提交於 2020-07-15 13:16 . ci: 基于GIT版本进行版本管理
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath "com.tencent.mm:AndResGuard-gradle-plugin:${andResGuardVersion}"
}
}
allprojects {
repositories {
//本地的Maven仓库:{USER_HOME}/.m2/repository,如C:/Users/Administrator/.m2/repository
mavenLocal()
//项目里的aar文件
flatDir { dirs "libs" }
//JitPack提供的Maven仓库
maven { url "https://jitpack.io" }
//JFrog公司提供的Maven仓库:https://jcenter.bintray.com
jcenter()
//谷歌公司提供的Maven仓库:https://maven.google.com
google()
//Sonatype公司提供的中央库:http://central.maven.org/maven2
mavenCentral()
}
}
subprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
//增加一些编译选项
//options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
task clean(type: Delete) {
println("********** clean build **********")
println("delete project dir:" + rootProject.buildDir)
rootProject.buildDir.deleteDir()
def dir = new File(new File(".").getAbsolutePath())
println(" root dir:" + dir.getAbsolutePath())
dir.eachDirRecurse {
dir2 ->
dir2.eachDirMatch(~/build/) {
directory ->
println("delete child dir:" + directory)
directory.deleteDir()
}
}
}
@SuppressWarnings(["GrMethodMayBeStatic", "unused"])
def gitGitCommitNumber() {
try {
// See https://www.jianshu.com/p/1f81af606e41
def cmd = 'git rev-list HEAD --first-parent --count'
return cmd.execute().text.trim().toInteger()
} catch (ignored) {
return 1
}
}
@SuppressWarnings(["GrMethodMayBeStatic", "unused"])
def getGitLatestTag() {
try {
// See https://www.jianshu.com/p/1f81af606e41
def cmd = 'git describe --tags'
return cmd.execute().text.trim()
} catch (ignored) {
return "1.0.0"
}
}
@SuppressWarnings(["GrMethodMayBeStatic", "unused"])
def getGitBranch() {
try {
// See https://www.jianshu.com/p/1f81af606e41
def cmd = 'git symbolic-ref --short -q HEAD'
return cmd.execute().text.trim()
} catch (ignored) {
return "unknown"
}
}
@SuppressWarnings(["GrMethodMayBeStatic", "unused"])
def getGitLatestCommitHash() {
try {
// See https://www.cnblogs.com/fuyaozhishang/p/7675551.html
def cmd = 'git rev-parse HEAD'
return cmd.execute().text.trim()
} catch (ignored) {
return "unknown"
}
}
@SuppressWarnings(["GrMethodMayBeStatic", "unused"])
def getGitLatestCommitHashShort() {
try {
// See https://www.jianshu.com/p/1f81af606e41
def cmd = 'git rev-parse --short HEAD'
return cmd.execute().text.trim()
} catch (ignored) {
return "unknown"
}
}
Android
1
https://gitee.com/li_yu_jiang/RSADemo.git
git@gitee.com:li_yu_jiang/RSADemo.git
li_yu_jiang
RSADemo
RSAUtils
master

搜索幫助