MineLittlePony/build.gradle
2019-03-25 17:33:58 +02:00

263 lines
6.2 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 {
common {
// code shared between HDSkins and MineLP mods
// TODO: Make this into a library? I mean, it's not a lot.
compileClasspath += main.compileClasspath
}
hdskins {
// HDSkins.
// TODO: Move to a separate project
compileClasspath += main.compileClasspath
compileClasspath += common.output
ext.refMap = 'hdskins.mixin.refmap.json'
}
client {
// Client-only code
compileClasspath += main.compileClasspath
compileClasspath += main.output
compileClasspath += common.output
compileClasspath += hdskins.output
ext.refMap = 'minelp.mixin.refmap.json'
}
main {
// Non-client code. Called main because gradle calls it that
// TODO: HorseLib.java
compileClasspath += common.output
}
// Litemod stuff, separated for future removal
litemod {
compileClasspath += main.compileClasspath
compileClasspath += main.output
compileClasspath += client.output
}
hdskinslitemod {
compileClasspath += main.compileClasspath
compileClasspath += litemod.output
compileClasspath += hdskins.output
}
fml {
compileClasspath += main.compileClasspath
compileClasspath += main.output
compileClasspath += client.output
}
hdskinsfml {
compileClasspath += main.compileClasspath
compileClasspath += litemod.output
compileClasspath += hdskins.output
}
}
minecraft {
mappings channel: project.mappings_channel, version: project.mappings_version + "-" + project.minecraft_version
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
// replace '@VERSION@', project.version
mods {
minelittlepony {
source sourceSets.common
source sourceSets.hdskins
source sourceSets.client
source sourceSets.main
// replace '@VERSION@', project.version
}
// replace '@VERSION@', project.version
}
}
}
// replace '@VERSION@', project.version
}
repositories {
// jcenter()
maven {
url = 'https://repo.spongepowered.org/maven'
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.13.2-25.0.90'
// use the same version as httpclient
compile('org.apache.httpcomponents:httpmime:4.3.2') {
transitive = false
}
compile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
transitive = false
}
}
manifest {
attributes 'Implementation-Version': "${project.version} (git-${project.hash})"
}
jar {
from sourceSets.common.output
from sourceSets.main.output
from sourceSets.hdskins.output
from sourceSets.hdskinsfml.output
from sourceSets.client.output
from sourceSets.fml.output
// replace '@VERSION@', project.version
classifier 'base'
extension 'jar'
}
task copyBGPones(type: Copy) {
def illegals = /[^a-z0-9_\/.-]/
from "skins/Background Ponies"
// TODO: What is tempDir????
into temporaryDir
eachFile {
if (it.name =~ illegals){
logger.warn("Sanitizing file with illegal characters: ${it.path}")
it.name = it.name.replaceAll(/\s/, '_').replaceAll(illegals, '')
}
}
}
/*
shadowJar {
// classifier "mc$minecraft.version"
from sourceSets.common.output
from sourceSets.hdskins.output
from sourceSets.hdskinsfml.output
from sourceSets.client.output
from sourceSets.fml.output
exclude "/assets/minelittlepony/textures/entity/pony"
from(copyBGPones) {
into "/assets/minelittlepony/textures/entity/pony"
}
// replace '@VERSION@', project.version
dependencies {
exclude dependency('deobf.org.ow2.asm:')
exclude dependency('org.spongepowered:mixin:')
exclude 'META-INF/**'
}
relocate 'org.apache.http.entity.mime', 'com.voxelmodpack.repack.org.apache.http.entity.mime'
exclude 'dummyThing'
doLast {
file('build/libs/' + archivesBaseName + '-' + version + '-base.jar').delete();
}
}
task srgJar(type: Jar) {
from sourceSets.common.output
from sourceSets.hdskins.output
from sourceSets.hdskinsfml.output
from sourceSets.main.output
from sourceSets.client.output
from sourceSets.fml.output
from sourceSets.hdskins.output
// replace '@VERSION@', project.version
classifier "mc$minecraft.version-srg"
}
*/
task horseLib(type: Jar) {
from sourceSets.common.output
from sourceSets.main.output
// replace '@VERSION@', project.version
baseName = "HoarseLib"
}
//sourceJar.enabled = false
//reobf {
// srgJar {
// mappingType = 'SEARGE'
// }
//
// shadowJar{}
//}