Tweak version

This commit is contained in:
Jesse Boyd 2016-09-26 02:42:23 +10:00
parent 3306bd2cdc
commit f8a606c783
2 changed files with 18 additions and 6 deletions

View File

@ -25,12 +25,12 @@ ext {
date = git.head().date.format("yy.MM.dd") date = git.head().date.format("yy.MM.dd")
revision = "-${git.head().abbreviatedId}" revision = "-${git.head().abbreviatedId}"
parents = git.head().parentIds; parents = git.head().parentIds;
index = -45; // Offset to mach CI index = -47; // Offset to mach CI
int major, minor, patch; int major, minor, patch;
major = minor = patch = 0; major = minor = patch = 0;
for (;parents != null && !parents.isEmpty();index++) { for (;parents != null && !parents.isEmpty();index++) {
int majorCount, minorCount, patchCount; int majorCount, minorCount, patchCount;
patchCount = 1; patchCount = minor == 0 && major == 0 ? 1 : 0;
commit = git.getResolve().toCommit(parents.get(0)); commit = git.getResolve().toCommit(parents.get(0));
for (String line : commit.fullMessage.tokenize("\n")) { for (String line : commit.fullMessage.tokenize("\n")) {
switch (line.replaceAll("- ", "").split(" ")[0].toLowerCase()) { switch (line.replaceAll("- ", "").split(" ")[0].toLowerCase()) {
@ -40,12 +40,12 @@ ext {
case "change": case "change":
case "changed": case "changed":
case "changes": case "changes":
if (majorCount == 0) {minorCount = 1; patch = patchCount = 0;} if (major == 0) {minorCount = 1; patchCount = 0;}
break; break;
case "refactor": case "refactor":
case "remove": case "remove":
case "major": case "major":
patch = minor = minorCount = patchCount = 0; patchCount = minorCount = 0;
majorCount = 1; majorCount = 1;
break; break;
} }

View File

@ -26,7 +26,6 @@ processResources {
jar.archiveName="fawe-api-${project.parent.version}.jar" jar.archiveName="fawe-api-${project.parent.version}.jar"
jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version
task createPom << { task createPom << {
pom { pom {
project { project {
@ -37,4 +36,17 @@ task createPom << {
}.writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom") }.writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom")
} }
build.finalizedBy(createPom) task copyFiles {
doLast {
copy {
from "../mvn/com/boydti/fawe-api/${project.parent.version}/"
into '../mvn/com/boydti/fawe-api/latest/'
include('*.*')
rename ("fawe-api-${project.parent.version}.pom", 'fawe-api-latest.pom')
rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar')
}
}
}
build.finalizedBy(copyFiles)
copyFiles.dependsOn(createPom)