A complete 3D game development suite written purely in Java.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
jmonkeyengine/version.gradle

109 lines
3.1 KiB

/*
Version Info Examples
=====================
Nightly Build Snapshot
* Full Version: 3.1.0-5124
* POM Version: 3.1.0-SNAPSHOT
* NBM Version: 3.1.0.5124
* NBM UC Suffix: nightly/3.1/plugins
Nightly Build Snapshot (PBRIsComing branch)
* Full Version: 3.1.0-PBRIsComing-5124
* POM Version: 3.1.0-PBRIsComing-SNAPSHOT
* NBM Version: 3.1.0.5124
* NBM UC Suffix: PBRIsComing-nightly/3.1/plugins
Alpha1 Release
* Full Version: 3.1.0-alpha1
* POM Version: 3.1.0-alpha1
* NBM Version: 3.1.0.0
* NBM UC Suffix: alpha1/3.1/plugins
Final Release
* Full Version: 3.1.0
* POM Version: 3.1.0
* NBM Version: 3.1.0.0
* NBM UC Suffix: stable/3.1/plugins
*/
import java.text.SimpleDateFormat
import org.ajoberstar.grgit.*
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.2.0'
}
}
ext {
jmeRevision = 0
jmeGitHash = ""
jmeGitTag = ""
jmeShortGitHash = ""
jmeBuildDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
jmeBranchName = "unknown"
jmeFullVersion = "${jmeVersion}-UNKNOWN"
jmePomVersion = "unknown"
jmeNbmVersion = "0.0.0.0"
jmeNbmUcSuffix = "unknown"
}
task configureVersionInfo {
try {
def grgit = Grgit.open(project.file('.'))
jmeRevision = grgit.log(includes:['HEAD']).size()
jmeGitHash = grgit.head().id
jmeShortGitHash = grgit.head().abbreviatedId
jmeBranchName = grgit.branch.current.name
jmeGitTag = grgit.describe()
if (jmeGitTag == null) jmeGitTag = ""
jmeFullVersion = "${jmeVersion}"
jmePomVersion = jmeVersion
jmeNbmVersion = jmeVersion
if (jmeBranchName != "master") {
jmeFullVersion += "-${jmeBranchName}"
jmePomVersion += "-${jmeBranchName}"
jmeNbmUcSuffix = "${jmeBranchName}-"
} else {
jmeNbmUcSuffix = ""
}
if (jmeVersionTag == "SNAPSHOT") {
jmeNbmUcSuffix += "nightly"
} else if (jmeVersionTag == "") {
jmeNbmUcSuffix += "stable"
} else {
jmeNbmUcSuffix += jmeVersionTag
}
jmeNbmUcSuffix += "/" + jmeMainVersion + "/plugins"
if (jmeVersionTag == "SNAPSHOT") {
jmeFullVersion += "-${jmeRevision}"
jmePomVersion += "-SNAPSHOT"
jmeNbmVersion += ".${jmeRevision}"
} else if (jmeVersionTag == "") {
jmeNbmVersion += ".0"
} else {
jmeFullVersion += "-${jmeVersionTag}"
jmePomVersion += "-${jmeVersionTag}"
jmeNbmVersion += ".0"
}
logger.warn("Full Version: ${jmeFullVersion}")
logger.warn("POM Version: ${jmePomVersion}")
logger.warn("NBM Version: ${jmeNbmVersion}")
logger.warn("NBM UC Suffix: ${jmeNbmUcSuffix}")
} catch (ex) {
// Failed to get repo info
logger.warn("Failed to get repository info: " + ex.message + ". " + \
"Only partial build info will be generated.")
}
}