Files
Mantle/build.gradle
T
2019-07-07 21:00:39 -04:00

222 lines
5.9 KiB
Groovy

/*
* Mantle
* Master build file
* Based on TConstruct's master build file
* Authors: Sunstrike, ProgWML6
* Help from AbrarSyed
*/
buildscript {
repositories {
mavenLocal()
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
repositories {
mavenLocal()
maven {
name 'ForgeFS'
url 'https://files.minecraftforge.net/maven'
}
maven {
name 'DVS1 Maven FS'
url 'https://dvs1.progwml6.com/files/maven'
}
}
group = 'slimeknights.mantle'
// sets version to the slimeKnights 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.${project.buildInfo.revision}"
}
}
ext.artifact_version = 'NFG'
if (System.getenv().ARTIFACT_VERSION == null) {
artifact_version = "${mod_version}.${project.buildInfo.buildNum}"
}
if (System.getenv().ARTIFACT_VERSION != null) {
artifact_version = "${system.getenv().ARTIFACT_VERSION}"
}
version = "${minecraft_version}-${artifact_version}"
minecraft {
mappings channel: 'snapshot', version: mappings_version
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP,CORE,PULSAR'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
mantle {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP,CORE,PULSAR'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
mantle {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP,CORE,PULSAR'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'mantle', '--all', '--output', file('src/generated/resources/')
mods {
mantle {
source sourceSets.main
}
}
}
}
}
configurations {
shadow
compile.extendsFrom shadow
}
dependencies {
minecraft 'net.minecraftforge:forge:' + minecraft_version + '-' + forge_version
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version_previos}:${jei_version}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version_previos}:${jei_version}")
// Configuration
shadow "ninja.leaping.configurate:configurate-hocon:${configurate_version}"
//shade "ninja.leaping.configurate:configurate-gson:${configurate_version}"
}
processResources {
inputs.property "version", artifact_version
inputs.property "MCversion", minecraft_version
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
expand 'version': artifact_version, 'MCversion': minecraft_version, 'forge_version': forge_version_toml
}
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
}
jar {
manifest {
attributes([
"Specification-Title" : "Mantle",
"Specification-Vendor" : "Slime Knights",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Vendor" : "Slime Knights",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
dependsOn shadowJar
enabled = false
}
shadowJar {
archiveName = tasks.jar.archiveName
configurations = [project.configurations.shadow]
relocate 'ninja.leaping.configurate', 'slimeknights.mantle.configurate'
relocate 'com.typesafe', 'slimeknights.mantle.typesafe'
dependencies {
exclude(dependency('com.google.guava:guava:'))
}
}
// because the normal output has been made to be obfuscated
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
artifacts {
archives deobfJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact deobfJar
artifact sourcesJar
}
}
repositories {
if (project.hasProperty('DEPLOY_DIR')) {
maven { url DEPLOY_DIR }
}
}
}