Add and make use of Lombok Remove Mojang API Remove ZipFileUtils Remove StreamTools in favor of Apache IOUtils Keyframe should be abstract all derivatives final Replace clone in Keyframe with copy Move some constants from GuiReplaySetttings to GuiConstants
143 lines
4.1 KiB
Groovy
Executable File
143 lines
4.1 KiB
Groovy
Executable File
import java.util.zip.ZipInputStream
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "forge"
|
|
url = "http://files.minecraftforge.net/maven"
|
|
}
|
|
maven {
|
|
name = "sonatype"
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'forge'
|
|
|
|
version = "0.6"
|
|
group= "eu.crushedpixel.replaymod"
|
|
archivesBaseName = "replaymod"
|
|
|
|
minecraft {
|
|
version = "1.8-11.14.1.1402"
|
|
runDir = "eclipse"
|
|
|
|
// the mappings can be changed at any time, and must be in the following format.
|
|
// snapshot_YYYYMMDD snapshot are built nightly.
|
|
// stable_# stables are built at the discretion of the MCP team.
|
|
// Use non-default mappings at your own risk. they may not allways work.
|
|
// simply re-run your setup task after changing the mappings to update your workspace.
|
|
mappings = "snapshot_nodoc_20141130"
|
|
}
|
|
|
|
configurations {
|
|
shade
|
|
compile.extendsFrom shade
|
|
}
|
|
|
|
dependencies {
|
|
compile 'org.projectlombok:lombok:1.16.4'
|
|
|
|
shade fileTree(dir: 'libs', includes: ['*.jar'])
|
|
// you may put jars on which you depend on in ./libs
|
|
// or you may define them like so..
|
|
//compile "some.group:artifact:version:classifier"
|
|
//compile "some.group:artifact:version"
|
|
|
|
// real examples
|
|
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
|
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
|
|
|
// for more info...
|
|
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
|
|
|
}
|
|
|
|
jar {
|
|
dependsOn configurations.shade
|
|
def noticeDir = file("$buildDir/NOTICE")
|
|
doFirst {
|
|
noticeDir.deleteDir()
|
|
noticeDir.mkdirs()
|
|
configurations.shade.collect { it.isDirectory() ? fileTree(it) : zipTree(it) }.each {
|
|
it.matching { include '**/NOTICE*' }.each {
|
|
new File(noticeDir, 'NOTICE.txt') << it.getText('UTF-8') + '\n'
|
|
}
|
|
}
|
|
}
|
|
from noticeDir
|
|
|
|
def langDir = file("$buildDir/languages")
|
|
doFirst {
|
|
try {
|
|
langDir.deleteDir()
|
|
langDir.mkdirs()
|
|
def dir = new File(langDir, 'assets/replaymod/lang/')
|
|
dir.mkdirs()
|
|
def zip = new ZipInputStream(new URL('http://replaymod.com/api/grab_languages').openStream())
|
|
def e;
|
|
while ((e = zip.nextEntry) != null) {
|
|
new File(dir, e.getName()) << zip
|
|
zip.closeEntry()
|
|
}
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
from langDir
|
|
|
|
from (configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }) {
|
|
exclude '**/NOTICE*'
|
|
}
|
|
|
|
manifest {
|
|
attributes 'FMLCorePlugin': 'eu.crushedpixel.replaymod.coremod.LoadingPlugin',
|
|
'FMLCorePluginContainsFMLMod': 'false',
|
|
'FMLAT': 'replaymod_at.cfg'
|
|
}
|
|
}
|
|
|
|
def getGitCommitHash() {
|
|
try {
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'describe', '--always', '--dirty=*'
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
} catch (e) {
|
|
return "unknown"
|
|
}
|
|
}
|
|
|
|
processResources
|
|
{
|
|
// this will ensure that this task is redone when the versions change.
|
|
inputs.property "version", project.version
|
|
inputs.property "mcversion", project.minecraft.version
|
|
|
|
// replace stuff in mcmod.info, nothing else
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
include 'mcmod.info'
|
|
|
|
// replace version and mcversion
|
|
expand 'version':project.version + '-' + getGitCommitHash(), 'mcversion':project.minecraft.version
|
|
}
|
|
|
|
// copy everything else, thats not the mcmod.info
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main { output.resourcesDir = output.classesDir }
|
|
}
|
|
|
|
defaultTasks 'build' |