Summary Table

Categories Total Count
PII 0
URL 6
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

String runCmd(String cmd) {
return cmd.execute().text.trim()
}

def getGitBranch = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "bash", "-c", "git rev-parse HEAD | git branch -a --contains | grep remotes | sed s/.*remotes.origin.// | head -1 |tr -d '\\n'"
standardOutput = stdout
}
return stdout.toString().trim()
}

def getGitBranchLocal = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "bash", "-c", "git rev-parse HEAD | git branch -a --contains | tr -d '\\n'"
standardOutput = stdout
}
return stdout.toString().trim()
}

allprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8

ext {
longRunningTime = 1000;
timestamp = new Date();

commitBranch = getGitBranch()
if(commitBranch == "") { //this can happen when local head is ahead of remote branch head, so attempt to build based on local branch name (usually on dev machine)
commitBranch = getGitBranchLocal()
}
commitRevision = runCmd "git rev-parse --short HEAD"
commitCount = runCmd "git rev-list HEAD --count"

if(project.ext.properties.buildMode == null){
def pattern = ~/[Rr]elease\/[0-9]+\.[0-9]+/
def isReleaseBranch = pattern.matcher(commitBranch).matches()

if(isReleaseBranch){
buildMode = "RELEASE"
println "branch " + commitBranch + " detected, performing release build"
}
else{
buildMode = "SNAPSHOT"
println "branch " + commitBranch + " detected, performing snapshot build"
}
}

if (buildMode == "RELEASE") {
if (project.ext.properties.buildNumber != null){ //CI build should pass this in, or it can be used as an optional parameter
modifierString = "+${buildNumber}.${commitRevision}"
}
else{ //use commitCount only if no build number is provided
modifierString = "-${commitCount}"
}
} else {
modifierString = "-SNAPSHOT"
}
}

version = "${baseVersion}${modifierString}"

configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 1, 'minutes'
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 1, 'minutes'
}
}

task wrapper(type: Wrapper) {
gradleVersion = '2.8'
}

subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

repositories {
maven {
url "https://
URL /content/repositories/central/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven {
url "https://
URL /content/repositories/jaspersoft/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven {
url "https://
URL /content/repositories/agilex-releases/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven {
url "https://
URL /content/repositories/agilex-snapshots/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven {
url "https://
URL /content/repositories/ckm-releases/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven {
url "https://
URL /content/repositories/thirdparty/"
credentials {
username "${nexusUser}"
password "${nexusPass}"
}
}
maven { url { 'http://maven.springframework.org/snapshot/' } }
}
}