TerraForged/build.gradle

147 lines
3.9 KiB
Groovy
Raw Normal View History

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