TechReborn/build.gradle
2019-07-10 21:56:22 +01:00

259 lines
6.1 KiB
Groovy

buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
name = "CB Repo"
url = "http://chickenbones.net/maven"
}
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
}
dependencies {
classpath "net.fabricmc:fabric-loom:0.2.3-SNAPSHOT"
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
classpath 'de.undercouch:gradle-download-task:3.4.3'
//classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT'
}
}
apply plugin: net.fabricmc.loom.LoomGradlePlugin
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: net.minecrell.gradle.licenser.Licenser
apply plugin: 'de.undercouch.download'
apply plugin: 'idea'
apply plugin: 'eclipse'
//apply plugin: 'net.covers1624.contained-deps'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
maven {
// JEI
name "JEI"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven'
}
}
version = "3.0.0"
configurations {
shade
compile.extendsFrom shade
}
def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
version = version + "." + "${System.getenv().BUILD_NUMBER}"
}
license {
header file('HEADER')
include '**/*.java'
ignoreFailures = true //Stops the build from failing if a file does not have a license header
}
group = 'TechReborn'
dependencies {
minecraft "com.mojang:minecraft:1.14.3"
mappings "net.fabricmc:yarn:1.14.3+build.9"
modCompile "net.fabricmc:fabric-loader:0.4.8+build.155"
//Fabric api
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0+build.187"
modCompile "io.github.prospector.modmenu:ModMenu:1.5.4-85"
// modCompile ('RebornCore:RebornCore-1.14:4.0.0.14') {
// transitive = false
// }
compile 'RebornCore:RebornCore-1.14.3:4.0.0.14'
compileOnly "com.google.code.findbugs:jsr305:+"
}
processResources{
inputs.property 'version', project.version
inputs.property 'mcversion', '1.14'
from(sourceSets.main.resources.srcDirs) {
include 'META_INF/mods.toml'
expand 'version':project.version, 'mcversion': '1.14'
}
from(sourceSets.main.resources.srcDirs) {
exclude 'META_INF/mods.toml'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
// task deobfJar(type: Jar) {
// from sourceSets.main.output
// exclude "**/*.psd"
// classifier = 'dev'
// manifest {
// attributes 'FMLAT': 'techreborn_at.cfg'
// }
// }
// containedDeps {
// configuration = "shade"
// tasks = "jar"
// }
jar {
exclude "**/*.psd"
classifier = 'universal'
// manifest {
// attributes 'FMLAT': 'techreborn_at.cfg'
// }
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.lang"} : null}
dependsOn 'renameCrowdin'
}
//Triggers crowdin to export the latest translations
task crowdinExport() {
onlyIf {
project.hasProperty('crowdinKey')
}
doLast{
def apiKey = project.crowdinKey
def projectId = 'techreborn'
def response = new URL(sprintf('https://api.crowdin.com/api/project/%1$s/export?key=%2$s', [projectId, apiKey])).text
def metadata = new XmlParser().parseText(response)
project.logger.lifecycle("crowdin export status: " + metadata.@status)
}
}
task crowdin(type: Download, dependsOn: 'crowdinExport'){
src 'https://crowdin.com/backend/download/project/techreborn.zip'
dest file("build/translations.zip")
overwrite true
}
task cleanCrowdin(type: Delete){
delete 'build/translations'
}
//Renames the translation files to be all lower case
task renameCrowdin(type: Copy, dependsOn: ['crowdin', 'cleanCrowdin']){
mustRunAfter 'crowdin'
from zipTree(file("build/translations.zip"))
into file('build/translations')
rename {
String filename -> return filename.toLowerCase()
}
}
//import techreborn.build.GenerateResourcesTask
//task genResources(type: GenerateResourcesTask){
// outputDir = file("src/main/resources")
//}
publishing {
publications {
maven(MavenPublication) {
groupId 'TechReborn'
artifactId project.archivesBaseName
version project.version
from components.java
}
}
repositories {
maven {
url "http://mavenupload.modmuss50.me/"
if (project.hasProperty('mavenPass')) {
credentials {
username 'buildslave'
password project.getProperty('mavenPass')
}
}
}
}
}
// task signJar(type: SignJar, dependsOn: reobfJar) {
// onlyIf {
// project.hasProperty('keyStore')
// }
// if (project.hasProperty('keyStore')) {
// keyStore = project.keyStore
// alias = project.keyStoreAlias
// storePass = project.keyStorePass
// keyPass = project.keyStoreKeyPass
// inputFile = jar.archivePath
// outputFile = jar.archivePath
// }
// }
// build.dependsOn signJar
// apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
import com.google.gson.JsonArray
import groovy.util.XmlSlurper
import org.apache.commons.io.FileUtils
import java.util.function.Consumer
task curseTools {
doLast {
def cacheFiles = new File(".gradle/curseTools")
if (!cacheFiles.exists()) {
cacheFiles.mkdirs()
}
def mavenMetadata = new File(cacheFiles, "maven-metadata.xml")
logger.lifecycle(":downloading curseTools metadata")
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/CurseTools/CurseTools/maven-metadata.xml"), mavenMetadata)
def metadata = new XmlSlurper().parseText(FileUtils.readFileToString(mavenMetadata))
def curseToolsVersion = metadata.versioning.release
def curseTools = new File(cacheFiles, "${curseToolsVersion}.jar")
logger.lifecycle(":downloading CurseTools")
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/CurseTools/CurseTools/${curseToolsVersion}/CurseTools-${curseToolsVersion}.jar"), curseTools)
logger.lifecycle(":launching CurseTools")
ant.java(jar: curseTools.getAbsolutePath(), fork: true, spawn: false) {
arg(value: jar.archivePath.getAbsolutePath())
arg(value: deobfJar.archivePath.getAbsolutePath())
arg(value: apiJar.archivePath.getAbsolutePath())
}
}
}