Merge pull request #603 from eclipse/bug529291

[529291] Replace @build@ token in about.mappings
This commit is contained in:
Karsten Thoms 2018-01-10 11:55:55 +01:00 committed by GitHub
commit 06743350b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
import org.apache.tools.ant.filters.*
/*
* Since we use the Eclipse Style layout where sources and resources live in the same
* folders, we need to make some adjustments to Gradle's defaults.
@ -42,12 +43,46 @@ if (isTestProject) {
jar {
from ('.') {
include 'about*.*', 'plugin.xml', 'schema/**', 'model/**', 'plugin.properties'
exclude 'about.mappings'
}
from ('.') {
include 'about.mappings'
filter(ReplaceTokens, tokens: ['build': getBuildId()])
}
if (isTestProject) {
from sourceSets.test.output
}
}
/**
* Computes the build type from the project version.
* When property 'upstreamBranch' has been set the build type is 'I'.
*
* @return I,M,R (Integration, Milestone, Release)
*/
def String getBuildType () {
if (hasProperty('upstreamBranch')) {
return 'I'
}
def versionSplit = version.split('\\.')
if (version.endsWith('SNAPSHOT'))
return 'I'
else if (versionSplit.length == 4)
return 'M'
else
return 'R'
}
/**
* Computes a build identifier as a combination of the build type
* (Integration,Milestone/Release) and the build timestamp.
*/
def getBuildId () {
return getBuildType()+buildTime
}
sourcesJar {
from ('.') {
include 'about*.*'