/* * Mantle * Master build file * Based on TConstruct's master build file * Authors: Sunstrike, ProgWML6 * Help from AbrarSyed */ buildscript { repositories { mavenCentral() mavenLocal() maven { name = 'ForgeFS' url = 'http://files.minecraftforge.net/maven' } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT' } } repositories { mavenLocal() maven { name 'ForgeFS' url 'http://files.minecraftforge.net/maven' } } apply plugin: 'forge' group = 'mantle' // define the properties file ext.configFile = file "build.properties" configFile.withReader { // read config. it shall from now on be referenced as simply config or as project.config def prop = new Properties() prop.load(it) project.ext.config = new ConfigSlurper().parse prop } ext.artifact_version_override = 'NotUsed' //gitignored config file -- if this has the entry for override it will override the version for local builds //create a file called version.properties with the line artifact_version_override=NotUsed //replace NotUsed w/ version #'s for manual local overrides ext.configFile2 = file "version.properties" if (configFile2.exists()){ configFile2.withReader { def prop2 = new Properties() prop2.load(it) ext.GIVersionFL = new ConfigSlurper().parse prop2 if (GIVersionFL != null){ project.artifact_version_override = GIVersionFL.artifact_version_override } } } // sets version to the slimeKnights default version format task buildInfo { def cmd = "git rev-parse --short HEAD" def proc = cmd.execute() proc.waitFor() if (proc.exitValue() == 0) { ext.revision = proc.text.trim() } else { ext.revision = "GITBORK" } if (System.getenv().BUILD_NUMBER != null) { ext.buildNum = System.getenv().BUILD_NUMBER } else { ext.buildNum = "DEV" } } ext.artifact_version = 'NFG' if (System.getenv().ARTIFACT_VERSION == null && artifact_version_override == 'NotUsed') { artifact_version = "${project.buildInfo.buildNum}.${project.buildInfo.revision}" } if (System.getenv().ARTIFACT_VERSION != null && artifact_version_override == 'NotUsed') { artifact_version = "${system.getenv().ARTIFACT_VERSION}" } if (artifact_version_override != 'NotUsed') { artifact_version = "${artifact_version_override}" } version = "${config.minecraft_version}-${artifact_version}" minecraft { version = config.minecraft_version + "-" + config.forge_version assetDir = 'run/assets' replace '${version}', project.version } sourceSets { main { resources { srcDir 'resources' } java { srcDir 'src' } } } processResources { // replace stuff in text files, not binary ones. from(sourceSets.main.resources.srcDirs) { include '**/*.info' // replace version and MCVersion expand 'version':artifact_version,'MCversion':config.minecraft_version } // copy everything else, thats not text from(sourceSets.main.resources.srcDirs) { exclude '**/*.info' } } // because the normal output has been made to be obfuscated task deobfJar(type: Jar) { from sourceSets.main.output classifier = 'deobf' } artifacts { archives deobfJar } task("uploadJars", dependsOn:"build") { description = "uploads JARs" if (project.hasProperty("local_maven")) { apply plugin: 'maven' uploadArchives { repositories { mavenDeployer { repository(url: "file://${local_maven}") } } } } }