MineLittlePony/build.gradle
2019-04-14 13:56:09 +02:00

158 lines
3.8 KiB
Groovy

buildscript {
repositories {
jcenter()
maven {
name 'forge'
url 'http://files.minecraftforge.net/maven'
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven'
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
}
}
plugins {
id 'org.ajoberstar.grgit' version '1.7.2'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
compileJava.sourceCompatibility = '1.8'
compileJava.targetCompatibility = '1.8'
ext {
revision = grgit.log().size()
hash = grgit.head().abbreviatedId
if (file('.git/shallow').exists()) {
// don't clone with --depth
revision = -1
hash += " shallow"
}
}
version = "${project.minecraft_version}.${project.version}"
if (project.release != 'RELEASE') {
version += "-${project.release}"
}
if (project.release == 'SNAPSHOT') {
version += "-${project.revision}-${project.hash}"
}
group = project.group
description = project.displayname
archivesBaseName = project.name
sourceSets {
client {
// Client-only code
compileClasspath += main.compileClasspath
compileClasspath += main.output
}
main {
}
fml {
compileClasspath += main.compileClasspath
compileClasspath += main.output
compileClasspath += client.output
}
// TODO: Disable the hidden "test" sourceset
// TODO: Disable the resources folders for sourcesets that don't need them
}
minecraft {
mappings channel: project.mappings_channel, version: project.mappings_version + "-" + project.minecraft_version
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN'
property 'forge.logging.console.level', 'debug'
mods {
minelittlepony {
// TODO: Remember to add /bin/default to the Environment configs
// minelittlepony%%C:/.../bin/default
source sourceSets.common
source sourceSets.client
source sourceSets.main
source sourceSets.fml
}
}
}
}
}
repositories {
maven {
url = 'https://repo.spongepowered.org/maven'
}
}
dependencies {
// TODO: Add HDSkins as a dependency. It won't compile without it.
// TODO: Add KirinUI as a dependency.
minecraft "net.minecraftforge:forge:" + project.minecraft_version + "-" + project.forge_version
compile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
transitive = false
}
}
manifest {
attributes(
"Implementation-Version": "${version} (git-${project.hash})",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
)
}
jar {
from sourceSets.main.output
from sourceSets.client.output
from sourceSets.fml.output
classifier 'base'
extension 'jar'
}
//
// Imports the Background Ponies from the MLP Community Skin Pack
//
task copyBGPones(type: Copy) {
def illegals = /[^a-z0-9_\/.-]/
from "skins/Background Ponies"
into temporaryDir
eachFile {
if (it.name =~ illegals){
logger.warn("Sanitizing file with illegal characters: ${it.path}")
it.name = it.name.replaceAll(/\s/, '_').replaceAll(illegals, '')
}
}
}
//
// Creates HorseLib
// A common library for mods to load MineLP features on the server without
// any client components
task horseLib(type: Jar) {
// TODO: Add KirinUI as a dependency.
from sourceSets.main.output
baseName = "HorseLib"
}