201 lines
5.6 KiB
Groovy
Executable File
201 lines
5.6 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'
|
|
|
|
sourceCompatibility = 1.7
|
|
targetCompatibility = 1.7
|
|
|
|
version = "1.0.5"
|
|
group= "eu.crushedpixel.replaymod"
|
|
archivesBaseName = "replaymod"
|
|
|
|
ext {
|
|
mixinSrg = new File(project.buildDir, 'tmp/mixins/mixins.srg')
|
|
mixinRefMap = new File(project.buildDir, 'tmp/mixins/mixins.replaymod.refmap.json')
|
|
libFiles = fileTree(dir: 'libs', includes: ['*.jar'])
|
|
}
|
|
|
|
minecraft {
|
|
version = "1.8-11.14.3.1450"
|
|
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"
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "SpongePowered Repo"
|
|
url = "http://repo.spongepowered.org/maven/"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile 'org.projectlombok:lombok:1.16.4'
|
|
|
|
compile 'org.spongepowered:mixin:0.4.3'
|
|
compile 'com.googlecode.mp4parser:isoparser:1.1.7'
|
|
compile libFiles
|
|
|
|
compile 'org.aspectj:aspectjrt:1.8.2'
|
|
|
|
compile project(':jGui')
|
|
|
|
// 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.compile
|
|
|
|
from project.mixinRefMap
|
|
|
|
def shade = {libFiles + files(configurations.compile.findAll { c ->
|
|
['mixin', 'isoparser', 'aspectjrt', 'jGui'].any {c.name.startsWith("$it-")}
|
|
})}
|
|
|
|
def noticeDir = file("$buildDir/NOTICE")
|
|
doFirst {
|
|
noticeDir.deleteDir()
|
|
noticeDir.mkdirs()
|
|
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 ({shade().collect { it.isDirectory() ? it : zipTree(it) }}) {
|
|
exclude '**/NOTICE*'
|
|
}
|
|
|
|
manifest {
|
|
attributes 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
|
|
'TweakOrder': '0',
|
|
'MixinConfigs': 'mixins.replaymod.json,mixins.recording.replaymod.json',
|
|
'FMLCorePlugin': 'eu.crushedpixel.replaymod.coremod.LoadingPlugin',
|
|
'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
|
|
resources {
|
|
srcDir 'jGui/src/main/resources'
|
|
}
|
|
}
|
|
}
|
|
|
|
reobf.doFirst {
|
|
if (project.mixinSrg.exists()) {
|
|
addExtraSrgFile project.mixinSrg
|
|
}
|
|
}
|
|
|
|
task copySrgs(type: Copy, dependsOn: 'genSrgs') {
|
|
from plugins.getPlugin('forge').delayedFile('{SRG_DIR}')
|
|
|
|
include '**/*.srg'
|
|
into 'build/srgs'
|
|
}
|
|
|
|
setupDecompWorkspace.dependsOn copySrgs
|
|
setupDevWorkspace.dependsOn copySrgs
|
|
compileJava.dependsOn copySrgs
|
|
|
|
compileJava {
|
|
options.compilerArgs += [
|
|
"-AoutSrgFile=${project.mixinSrg.canonicalPath}",
|
|
"-AoutRefMapFile=${project.mixinRefMap.canonicalPath}",
|
|
"-AreobfSrgFile=${project.file('build/srgs/mcp-srg.srg').canonicalPath}"
|
|
]
|
|
}
|
|
|
|
defaultTasks 'build'
|