TerraForged/build.gradle

147 lines
3.9 KiB
Groovy
Raw Permalink Normal View History

2020-05-13 18:22:34 +02:00
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"
2020-06-26 18:52:04 +02:00
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
2020-06-26 20:37:55 +02:00
group = "com.terraforged"
2020-05-13 18:22:34 +02:00
version = "${mc_version}-${mod_version}${getClassifier()}"
2020-01-16 10:56:57 +01:00
allprojects {
apply plugin: "java"
}
2020-05-13 18:22:34 +02:00
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"))
2020-05-13 18:22:34 +02:00
}
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 {
2020-06-26 20:37:55 +02:00
// add resources for the runData task to path
2020-05-13 18:22:34 +02:00
main.resources {
srcDirs += "generated/resources/"
exclude ".cache"
}
}
task collectLibs(type: Copy) {
2020-06-26 20:37:55 +02:00
// require upstream projects to be jar'd first
2020-05-13 18:22:34 +02:00
dependsOn(dependsOn: subprojects.tasks["jar"])
2020-06-26 20:37:55 +02:00
// copy contents to build dir ignoring dupes
2020-05-13 18:22:34 +02:00
from { configurations.lib.collect { it.isDirectory() ? it : zipTree(it) } }
into("build/classes/java/main")
duplicatesStrategy = "EXCLUDE"
}
processResources {
filesMatching("**/mods.toml") {
2020-06-26 20:37:55 +02:00
// replaces the version string in the mods.toml
2020-05-13 18:22:34 +02:00
expand("version": "${mod_version}${getClassifier()}", "mc_version": mc_version)
}
}
classes {
2020-06-26 20:37:55 +02:00
// collect all dependency classes first
2020-05-13 18:22:34 +02:00
dependsOn(collectLibs)
}
2020-06-27 10:39:54 +02:00
jar {
finalizedBy("reobfJar")
}
2020-06-26 20:37:55 +02:00
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/"
}
}
}
2020-05-14 20:56:57 +02:00
}
2020-05-13 18:22:34 +02:00
static def getClassifier() {
if (System.getenv("GIT_TAG_NAME") != null) {
return ""
}
def buildNumber = System.getenv("BUILD_NUMBER")
if (buildNumber != null) {
return "-${buildNumber}"
}
return ""
}