加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
哄哄 提交于 2023-10-03 21:03 . get version from GITHUB_REF_NAME (#605)
allprojects {
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.googlecode.d2j'
version = System.getProperty('GITHUB_REF_NAME', '2.x').replaceAll('[/ ]','-')
}
defaultTasks('clean','distZip')
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
task packageSources(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts.archives packageSources
repositories {
mavenCentral()
google()
}
// == support provided scope
configurations {
provided
}
sourceSets {
main { compileClasspath += configurations.provided }
test {
compileClasspath += configurations.provided
}
}
// == end
[compileJava, compileTestJava]*.options.collect {options ->options.encoding = 'UTF-8'}
dependencies {
testCompile group: 'junit', name: 'junit', version:'4.11'
compile fileTree(dir: 'libs', include: '*.jar')
}
jar {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": project.version,
"Build-Time": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Revision":"${getRevision()}",
"Build-Number": System.env.BUILD_NUMBER?System.env.BUILD_NUMBER:"-1",
)
}
from (project.parent.projectDir) {
include 'NOTICE.txt'
include 'LICENSE.txt'
into('META-INF')
}
}
}
def getRevision() {
if (System.env.BUILD_REVISION) {
return System.env.BUILD_REVISION
}
if (System.env.GIT_REVISION) {
return System.env.GIT_REVISION
}
if (System.env.MERCURIAL_REVISION) {
System.env.MERCURIAL_REVISION
}
def ver = null;
try {
ver = 'git rev-parse --short HEAD'.execute().text.trim()
} catch (e) {
// ignore
}
if (!ver) {
try {
ver = 'hg id -i -b -t'.execute().text.split(' ')[0];
} catch (e) {
// ignore
}
}
if (!ver) {
ver = "HEAD"
}
return ver
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化