buildscript { repositories { jcenter() mavenCentral() maven { url "https://files.minecraftforge.net/maven" } } dependencies { classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "3.+", changing: true } } apply plugin: "net.minecraftforge.gradle" apply plugin: "maven-publish" apply plugin: "eclipse" sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 group = "com.terraforged" version = "${mc_version}-${mod_version}${getClassifier()}" allprojects { apply plugin: "java" } configurations { lib compile.extendsFrom lib } repositories { jcenter() mavenCentral() maven { url "https://io.terraforged.com/repository/maven/" } } dependencies { minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" lib(project(":FeatureManager")) { transitive false } lib(project(":Engine")) } minecraft { mappings channel: mcp_channel, version: mcp_version runs { client { workingDirectory project.file("run/client") property "forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP" property "forge.logging.console.level", "debug" jvmArgs "-Xmx8G", "-Xms6G", "-Ddev" mods { terraforged { source sourceSets.main } } } server { workingDirectory project.file("run/server") property "forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP" property "forge.logging.console.level", "debug" jvmArgs "-Xmx8G", "-Xms6G", "-Ddev" mods { terraforged { source sourceSets.main } } } data { workingDirectory project.file("run/data") property "forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP" property "forge.logging.console.level", "debug" property "fml.earlyprogresswindow", "false" args "--mod", "terraforged", "--server", "--output", file("generated/resources/") jvmArgs "-Xmx4G", "-Xms2G" mods { terraforged { source sourceSets.main } } } } } sourceSets { // add resources for the runData task to path main.resources { srcDirs += "generated/resources/" exclude ".cache" } } task collectLibs(type: Copy) { // require upstream projects to be jar'd first dependsOn(dependsOn: subprojects.tasks["jar"]) // copy contents to build dir ignoring dupes from { configurations.lib.collect { it.isDirectory() ? it : zipTree(it) } } into("build/classes/java/main") duplicatesStrategy = "EXCLUDE" } processResources { filesMatching("**/mods.toml") { // replaces the version string in the mods.toml expand("version": "${mod_version}${getClassifier()}", "mc_version": mc_version) } } classes { // collect all dependency classes first dependsOn(collectLibs) } jar { finalizedBy("reobfJar") } publishing { publications { // publish the mod jar & api jar mavenJava(MavenPublication) { artifact jar } } if (System.getenv("MAVEN_USER") != null && System.getenv("MAVEN_PASS") != null) { repositories { maven { credentials { username System.getenv("MAVEN_USER") password System.getenv("MAVEN_PASS") } name = "nexus" url = "https://io.terraforged.com/repository/maven/" } } } } static def getClassifier() { if (System.getenv("GIT_TAG_NAME") != null) { return "" } def buildNumber = System.getenv("BUILD_NUMBER") if (buildNumber != null) { return "-${buildNumber}" } return "" }