Update build.gradle to have single line for specifying minecraft version, and will update ForgeVersion.java as needed.

This commit is contained in:
LexManos 2016-06-30 00:17:17 -07:00
parent 72f7c0be1f
commit a9e4516068

View file

@ -21,15 +21,17 @@ repositories {
url = "file:///home/cpw/projects/repo"
}
}
apply plugin: "maven"
apply plugin: "net.minecraftforge.gradle.patcher"
apply plugin: "net.minecraftforge.gradle.launch4j"
minecraft.version = "1.10.2"
minecraft {
version = "1.10.2"
mappings = 'snapshot_nodoc_20160518'
workspaceDir = "projects"
versionJson = "jsons/1.10.2-dev.json"
versionJson = "jsons/${minecraft.version}-dev.json"
buildUserdev = true
buildInstaller = true
installerVersion = "1.4"
@ -66,7 +68,7 @@ extractForgeResources { exclude "**/log4j2.xml" }
genGradleProjects { addTestCompileDep "junit:junit:4.12" }
processJson {
releaseJson = "jsons/1.10.2-rel.json"
releaseJson = "jsons/${minecraft.version}-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
@ -218,11 +220,13 @@ task ciWriteBuildNumber << {
def file = file("src/main/java/net/minecraftforge/common/ForgeVersion.java");
def bn = System.getenv("BUILD_NUMBER")?:project.ext.properties.buildNumber?:0;
def outfile = "";
def ln = System.getProperty('line.separator')
def ln = "\n"; //Linux line endings because we're on git!
file.eachLine{ String s ->
if (s.matches("^ public static final int buildVersion = [\\d]+;\$"))
s = " public static final int buildVersion = ${bn};";
if (s.matches('^ public static final String mcVersion = "[^\\"]+";'))
s = " public static final String mcVersion = \"${minecraft.version}\";";
outfile += (s+ln);
}
file.write(outfile);
@ -371,7 +375,7 @@ task resetBuildNumber << {
}
// re-add old tasks for jenkins compat
// should be remvoed, and the jenkisn fixed when no longer building with FG 1.2
task setupForge { dependsOn 'setup' }
task setupForge { dependsOn 'setup', 'ciWriteBuildNumber' }
task buildPackages { dependsOn 'build' }
//Temporary hack to fix compile errors caused by mappings shading in Bootstrap