Skip to content

Instantly share code, notes, and snippets.

@tterrag1098
Last active August 29, 2015 14:01
Show Gist options
  • Save tterrag1098/e66bf09fa79c97590fef to your computer and use it in GitHub Desktop.
Save tterrag1098/e66bf09fa79c97590fef to your computer and use it in GitHub Desktop.
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
task build
task clean
task setup
task eclipse
task idea
ext.configFile = file "build.properties"
configFile.withReader {
// Load config. It shall from now be referenced as simply config or project.config
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
// Finds and sets version data
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.${project.buildInfo.revision}"
}
}
ext.artifact_version = 'NFG'
if (System.getenv().ARTIFACT_VERSION == null) {
artifact_version = "${config.mod_version}"
}
if (System.getenv().ARTIFACT_VERSION != null) {
artifact_version = "${system.getenv().ARTIFACT_VERSION}"
}
version = "MC${config.minecraft_version}-${artifact_version}-${System.getenv().BUILD_NUMBER}"
subprojects {
apply plugin: "forge"
rootProject.build.dependsOn build
rootProject.clean.dependsOn clean
rootProject.setup.dependsOn setupDecompWorkspace
rootProject.tasks.eclipse.dependsOn eclipse
rootProject.tasks.idea.dependsOn idea
// stuff specific to my mod
group = 'org.wyldmods.kitchencraft'
archivesBaseName = rootProject.name + "-" + project.name
version = "${minecraft.version}-$version.${System.getenv().BUILD_NUMBER}"
minecraft {
version = "1.7.2-10.12.1.1082"
assetDir = "eclipse/assets"
}
processResources
{
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
version = rootProject.version
jar.destinationDir = new File(rootProject.projectDir, "output")
it.sourceSets {
main {
java {
srcDir rootProject.projectDir.path + "/src/main/java"
}
resources {
srcDir rootProject.projectDir.path + "/src/main/resources"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment