0d6c1caMerge branch 1.11.2 into 1.1213bb0bdMerge branch 1.11-staging into 1.11.2-staging5257a41Merge branch 1.10.2 into 1.11689f897Merge branch 1.9.4 into 1.10.20aed9c3Merge branch 1.8.9 into 1.9.4f36ebf1Merge branch 1.8 into 1.8.908170b3Downgrade FG to 2.1 because FG 2.2 is 1.9+ only41d2547Update translations00e999fFix replay not being closed when opened via URI scheme handler (fixes #92)767ea29Fix book gui not being suppressed during replay (fixes #90)5b04edbHide ReplayMod app entry from menus on Linux6aff99dFix livelock during netty write to embedded channel (fixes #85)703805fFix infinite loop in mc.scheduledTasks (fixes #86)922c039Fix server with RM installed refusing clients without RM (fixes #76)7a4440cUpdate ReplayStudio0b9c56cFix resource packs not working after first time jumping back in time933ee5f[Compat] Fix camera entity with BetterSprinting prior to 2.0.0 (fixes #78)83b1090Fix hotbar being visible while spectating player (fixes #83)5c73117[Compat] Fix invisible entities with Orange's 1.7 Animations (fixes #78)4704b29Replace the RenderPlayer hook (used subclassing) with a mixin (fixes #79)0c226b0Fix path at end of replay resulting in constant reloading (fixes #56)1b9b13eRename render success sound to all lowercase (required for 1.11) (fixes #66)c2000b3Fix only front-facing chunks visible for ODS rendering (fixes #67)aafeeccFix initial login gui not closing on success (fixes #68)9292addUse percent-encoding for replay file names (fixes #71)8499c0fFix name of invis armor stand with CustomNameVisible not rendering (fixes #72)b9ea572Try to handle invalid ffmpeg arguments more gracefully (fixes #77)a2f8c88Fix compression packets being recorded (fixes #80)19629c3Replace usages of System.out with loggerfe1d9b8Stop Forge from allowing the mod to load on other MC versions (fixes #82)d56fa9bUpdate ReplayStudio/MCProtocolLib (Fixes missing ARMOR_STAND MobType)7c719e0Update ReplayStudio/MCProtocolLib (Fixes missing ARMOR_STAND MobType)1a1e96cFix server with RM installed refusing clients without RM (fixes #76)35eb9caReplace usage of FMLLog with the mod logger
345 lines
11 KiB
Groovy
Executable File
345 lines
11 KiB
Groovy
Executable File
import groovy.json.JsonOutput
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "forge"
|
|
url = "http://files.minecraftforge.net/maven"
|
|
}
|
|
maven {
|
|
name = "sponge"
|
|
url = "https://repo.spongepowered.org/maven"
|
|
}
|
|
maven {
|
|
name = "sonatype"
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
|
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
version = gitDescribe()
|
|
group= "com.replaymod"
|
|
archivesBaseName = "replaymod"
|
|
|
|
minecraft {
|
|
coreMod = 'com.replaymod.core.LoadingPlugin'
|
|
version = '1.12.1-14.22.0.2444'
|
|
runDir = "eclipse"
|
|
mappings = "snapshot_20170615"
|
|
replace '@MOD_VERSION@', project.version
|
|
// Includes intentional whitespace to stop Forge from declaring the mod to be compatible with
|
|
// a newer srg-compatible MC version (that may be using a different protocol version)
|
|
replace '@MC_VERSION@', "[ ${project.minecraft.version} ]"
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "SpongePowered Repo"
|
|
url = "http://repo.spongepowered.org/maven/"
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
shade
|
|
compile.extendsFrom shade
|
|
}
|
|
|
|
dependencies {
|
|
compile 'org.projectlombok:lombok:1.16.4'
|
|
|
|
compile('org.spongepowered:mixin:0.6.11-SNAPSHOT') {
|
|
exclude group: 'org.apache.logging.log4j'
|
|
}
|
|
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
|
|
shade 'org.apache.commons:commons-exec:1.3'
|
|
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
|
|
shade 'com.google.api-client:google-api-client-gson:1.20.0'
|
|
shade 'com.google.api-client:google-api-client-java6:1.20.0'
|
|
shade 'com.google.oauth-client:google-oauth-client-jetty:1.20.0'
|
|
|
|
shade 'org.aspectj:aspectjrt:1.8.2'
|
|
|
|
compile project(':ReplayStudio')
|
|
|
|
testCompile 'junit:junit:4.11'
|
|
}
|
|
|
|
tasks['idea'].dependsOn ':ReplayStudio:preshadowJar'
|
|
|
|
jar {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
dependsOn configurations.compile
|
|
dependsOn configurations.shade
|
|
dependsOn ':ReplayStudio:shadowJar'
|
|
|
|
def shade = {files(
|
|
configurations.compile.findAll {it.name.startsWith 'mixin-'}
|
|
+ configurations.shade
|
|
+ getTasks().getByPath(':ReplayStudio:shadowJar').outputs.files
|
|
)}
|
|
|
|
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
|
|
|
|
from ({shade().collect { it.isDirectory() ? it : zipTree(it) }}) {
|
|
exclude '**/NOTICE*'
|
|
// exclude everything taken in from jGui for running the mod in a dev environment
|
|
exclude { new File(file('jGui/src/main/resources'), it.relativePath.pathString).exists() }
|
|
eachFile {
|
|
if (getName() == 'LICENSE.txt') {
|
|
setName(getFile().getParentFile().getName().split('-')[0] + '-LICENSE.txt')
|
|
}
|
|
}
|
|
}
|
|
|
|
manifest {
|
|
attributes 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
|
|
'TweakOrder': '0',
|
|
'FMLCorePluginContainsFMLMod': 'true',
|
|
'FMLAT': 'replaymod_at.cfg'
|
|
}
|
|
}
|
|
|
|
def gitDescribe() {
|
|
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, 'mcversion': project.minecraft.version
|
|
}
|
|
|
|
// copy everything else, thats not the mcmod.info
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
// Directly include jGui into main build
|
|
// This could also be done by including it as a gradle subproject, however
|
|
// doing so caused classpath issues on some IntelliJ versions.
|
|
java {
|
|
srcDir 'jGui/src/main/java'
|
|
}
|
|
resources {
|
|
srcDir 'jGui/src/main/resources'
|
|
}
|
|
refMap = "mixins.replaymod.refmap.json"
|
|
}
|
|
integrationTest {
|
|
compileClasspath += main.runtimeClasspath + main.output
|
|
java {
|
|
srcDir file('src/integration-test/java')
|
|
}
|
|
resources.srcDir file('src/integration-test/resources')
|
|
}
|
|
}
|
|
|
|
task copySrg(type: Copy, dependsOn: 'genSrgs') {
|
|
from {project.tasks.genSrgs.mcpToSrg}
|
|
into 'build'
|
|
}
|
|
|
|
setupDecompWorkspace.dependsOn copySrg
|
|
setupDevWorkspace.dependsOn copySrg
|
|
project.tasks.idea.dependsOn copySrg
|
|
|
|
|
|
import org.objectweb.asm.*
|
|
|
|
import java.util.zip.ZipEntry
|
|
import java.util.zip.ZipFile
|
|
import java.util.zip.ZipOutputStream
|
|
|
|
import static org.objectweb.asm.Opcodes.ASM5
|
|
|
|
// MC binaries were complied with a java version that produces invalid class files under certain circumstances
|
|
// This causes setupCIWorkspace to be insufficient for compiling.
|
|
// Related JDK bug: https://bugs.openjdk.java.net/browse/JDK-8066725
|
|
// As a workaround, to use setupCIWorkspace on Drone, we modify the bin jar in-place and remove all parameter annotations.
|
|
// WARNING: This piece of code ignores any and all gradle conventions and will probably fail horribly when run outside
|
|
// of a single-use environment (e.g. Drone). Use setupDecompWorkspace for normal use.
|
|
tasks.deobfMcMCP.doLast {
|
|
println "Applying RuntimeInvisibleParameterAnnotations workaround..."
|
|
File jar = getOutJar()
|
|
File tmp = new File((File) getTemporaryDir(), "workaround.jar")
|
|
tmp.withOutputStream {
|
|
new ZipOutputStream(it).withStream { dst ->
|
|
new ZipFile(jar).withCloseable { src ->
|
|
src.entries().each {
|
|
if (it.name.startsWith("net/minecraft/") && it.name.endsWith(".class")) {
|
|
def cw = new ClassWriter(0)
|
|
def cv = new ClassVisitor(ASM5, cw) {
|
|
@Override
|
|
MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
|
return new MethodVisitor(ASM5, cv.visitMethod(access, name, desc, signature, exceptions)) {
|
|
@Override
|
|
AnnotationVisitor visitParameterAnnotation(int parameter, String pdesc, boolean visible) {
|
|
return null // Strip all parameter annotations
|
|
}
|
|
}
|
|
}
|
|
}
|
|
new ClassReader(src.getInputStream(it)).accept(cv, 0)
|
|
dst.putNextEntry(new ZipEntry(it.name))
|
|
dst.write(cw.toByteArray())
|
|
} else {
|
|
dst.putNextEntry(it)
|
|
dst.write(src.getInputStream(it).bytes)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
jar.delete()
|
|
tmp.renameTo(jar)
|
|
}
|
|
|
|
task runIntegrationTest(type: JavaExec, dependsOn: ["makeStart", "jar"]) {
|
|
main = 'GradleStart'
|
|
standardOutput = System.out
|
|
errorOutput = System.err
|
|
workingDir file(minecraft.runDir)
|
|
|
|
def testDir = new File(minecraft.runDir, "integration-test")
|
|
doFirst {
|
|
testDir.deleteDir()
|
|
testDir.mkdirs()
|
|
}
|
|
|
|
doLast {
|
|
testDir.deleteDir()
|
|
}
|
|
|
|
afterEvaluate {
|
|
def runClient = tasks.getByName("runClient")
|
|
runIntegrationTest.jvmArgs = runClient.jvmArgs + "-Dfml.noGrab=true"
|
|
runIntegrationTest.args = runClient.args + "--gameDir" + testDir.canonicalPath
|
|
runIntegrationTest.classpath runClient.classpath + sourceSets.integrationTest.output
|
|
}
|
|
}
|
|
|
|
def generateVersionsJson() {
|
|
// List all tags
|
|
def stdout = new ByteArrayOutputStream()
|
|
project.exec {
|
|
commandLine 'git', 'for-each-ref', '--sort=taggerdate', '--format=%(refname:short)', 'refs/tags'
|
|
standardOutput = stdout
|
|
}
|
|
def versions = stdout.toString().tokenize('\n').reverse()
|
|
def mcVersions = versions.collect {it.substring(0, it.indexOf('-'))}.unique().reverse()
|
|
|
|
def root = [
|
|
homepage: 'https://www.replaymod.com/download/',
|
|
promos: [:]
|
|
]
|
|
mcVersions.forEach { mcVersion ->
|
|
def mcVersionRoot = [:]
|
|
def latest
|
|
def recommended
|
|
versions.forEach {
|
|
def (thisMcVersion, modVersion, preVersion) = it.tokenize('-')
|
|
if (thisMcVersion == mcVersion) {
|
|
mcVersionRoot[it] = "See https://github.com/ReplayMod/ReplayMod/releases/$it"
|
|
if (latest == null) latest = it
|
|
if (preVersion == null) {
|
|
if (recommended == null) recommended = it
|
|
}
|
|
}
|
|
}
|
|
root[mcVersion] = mcVersionRoot
|
|
root.promos[mcVersion + '-latest'] = latest
|
|
if (recommended != null) {
|
|
root.promos[mcVersion + '-recommended'] = recommended
|
|
}
|
|
}
|
|
root
|
|
}
|
|
|
|
task doRelease() {
|
|
doLast {
|
|
// Parse version
|
|
def version = project.releaseVersion as String
|
|
if (project.version.endsWith('*')) {
|
|
throw new InvalidUserDataException('Git working tree is dirty. Make sure to commit all changes.')
|
|
}
|
|
def (mcVersion, modVersion, preVersion) = version.tokenize('-')
|
|
preVersion = preVersion != null && preVersion.startsWith('b') ? preVersion.substring(1) : null
|
|
|
|
// Create new tag
|
|
if (preVersion != null) {
|
|
project.exec {
|
|
commandLine 'git', 'tag',
|
|
'-m', "Pre-release $preVersion of $modVersion for Minecraft $mcVersion",
|
|
"$mcVersion-$modVersion-b$preVersion"
|
|
}
|
|
} else {
|
|
project.exec {
|
|
commandLine 'git', 'tag',
|
|
'-m', "Release $modVersion for Minecraft $mcVersion",
|
|
"$mcVersion-$modVersion"
|
|
}
|
|
}
|
|
|
|
// Switch to master branch to update versions.json
|
|
project.exec { commandLine 'git', 'checkout', 'master' }
|
|
|
|
// Generate versions.json content
|
|
def versionsRoot = generateVersionsJson()
|
|
def versionsJson = JsonOutput.prettyPrint(JsonOutput.toJson(versionsRoot))
|
|
|
|
// Write versions.json
|
|
new File('versions.json').write(versionsJson)
|
|
|
|
// Commit changes
|
|
project.exec { commandLine 'git', 'add', 'versions.json' }
|
|
project.exec { commandLine 'git', 'commit', '-m', "Update versions.json for $version" }
|
|
|
|
// Return to previous branch
|
|
project.exec { commandLine 'git', 'checkout', '-' }
|
|
}
|
|
}
|
|
|
|
defaultTasks 'build'
|