3
0

Migrate to gitlab ci 7.12

This commit is contained in:
Prototik
2015-06-28 04:35:19 +07:00
parent 495e0435d5
commit 831c8733cc
3 changed files with 93 additions and 6 deletions

View File

@ -3,17 +3,22 @@ package kcauldron
import java.util.regex.Matcher
class VersionParser {
public static String parseForgeRevision(File forgeFile, File propsFile) {
public static String parseForgeVersion(File forgeFile, File propsFile) {
def forgeVersion = forgeFile.text
def int majorVersion = v(forgeVersion =~ /.+int majorVersion\s+=\s+(\d+);/)
def int minorVersion = v(forgeVersion =~ /.+int minorVersion\s+=\s+(\d+);/)
def int revisionVersion = v(forgeVersion =~ /.+int revisionVersion\s+=\s+(\d+);/)
def props = new Properties();
propsFile.withInputStream { props.load(it) }
def int buildVersion = props['fmlbuild.build.number'] as int
def int buildVersion = parseForgeRevision propsFile
return "${majorVersion}.${minorVersion}.${revisionVersion}.${buildVersion}"
}
def static int parseForgeRevision(File propsFile) {
def props = new Properties();
propsFile.withInputStream { props.load(it) }
props['fmlbuild.build.number'] as int
}
static int v(Matcher matcher) {
matcher.find()
matcher.group(1) as int