MineLittlePony/build.gradle
2019-06-01 21:15:48 +02:00

119 lines
2.9 KiB
Groovy

// Frabric build script
// 24/05/2019
// https://github.com/FabricMC/fabric-example-mod/blob/master/build.gradle
buildscript {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
}
dependencies {
classpath 'fabric-loom:fabric-loom.gradle.plugin:0.2.2-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
classpath 'org.ajoberstar.grgit:grgit-gradle:3.1.1'
}
}
repositories {
maven {
name = 'Jit'
url = 'https://jitpack.io'
}
}
apply plugin: 'fabric-loom'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.ajoberstar.grgit'
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
ext {
if (grgit == null) {
revision = "nogit"
} else {
revision = "${grgit.log().size()}-${grgit.head().abbreviatedId}"
if (file('.git/shallow').exists()) {
// don't clone with --depth
revision = "-1-shallow"
}
}
}
version = "${project.minecraft_version}.${project.version}"
if (project.release != 'RELEASE') {
version += "-${project.release}"
}
if (project.release == 'SNAPSHOT') {
version += "-${project.revision}"
}
group = project.group
description = project.displayname
archivesBaseName = project.name
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompile "com.github.MineLittlePony:Kirin:${project.kirin_version}"
include "com.github.MineLittlePony:Kirin:${project.kirin_version}"
// TODO: HD Skins can be made optional later
modCompile "com.github.MineLittlePony:HDSkins:${project.hd_skins_version}"
include "com.github.MineLittlePony:HDSkins:${project.hd_skins_version}"
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = "sources"
from sourceSets.main.allSource
}
jar {
from "LICENSE"
}
//
// 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, '')
}
}
}