Manually build ReplayStudio dep

This commit is contained in:
Jonas Herzig
2017-08-28 21:30:39 +02:00
parent c44de2b22a
commit 6ef61f0878
6 changed files with 119 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
import java.util.jar.JarEntry
import java.util.jar.JarFile
import java.util.jar.JarOutputStream
def convertRepoToHttp = { repo ->
if (repo instanceof MavenArtifactRepository && repo.url.toString().startsWith('https://')) {
URL url = repo.url.toURL()
@@ -17,4 +21,23 @@ allprojects {
dirMode = 0775
fileMode = 0664
}
// The shadow plugin doesn't seem to support the above
def shadowJar = tasks.findByPath ':shadowJar'
if (shadowJar != null) {
shadowJar.doLast {
File newFile = new File(archivePath.parent, 'tmp-' + archiveName)
newFile.withOutputStream { fout ->
JarOutputStream out = new JarOutputStream(fout)
JarFile jf = new JarFile(archivePath)
jf.entries().unique {it.name}.sort {it.name}.each {
def copy = new JarEntry(it.name)
copy.time = 0
out.putNextEntry(copy)
out << jf.getInputStream(it)
}
out.finish()
}
newFile.renameTo archivePath
}
}
}

View File

@@ -0,0 +1,42 @@
From 2acc7a8cbfcafa23671b669ba4ae50539cf11872 Mon Sep 17 00:00:00 2001
From: Jonas Herzig <me@johni0702.de>
Date: Mon, 28 Aug 2017 20:56:39 +0200
Subject: [PATCH] Replace ReplayStudio dep with manually built one
---
build.gradle | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/build.gradle b/build.gradle
index 2104fb8..fb02c7f 100755
--- a/build.gradle
+++ b/build.gradle
@@ -53,24 +53,20 @@ dependencies {
shade 'org.aspectj:aspectjrt:1.8.2'
- compile project(':ReplayStudio')
+ shade files('gradle/reprod/deps/replaystudio.jar')
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")
--
2.5.5

View File

@@ -0,0 +1,25 @@
From 5e4d9a2f79250283004c4398498fd17006bad219 Mon Sep 17 00:00:00 2001
From: Jonas Herzig <me@johni0702.de>
Date: Mon, 28 Aug 2017 21:14:10 +0200
Subject: [PATCH 1/2] Replace custom preshadow with upstream version
---
build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index c2f496e..dc84f48 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,7 +23,7 @@ apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'license'
apply plugin: 'maven'
-apply from: 'gradle/preshadow.gradle'
+apply plugin: 'ch.raffael.preshadow'
// Methods to determine detailed version string
def gitDescribe() {
--
2.5.5

View File

@@ -0,0 +1,24 @@
From ba15c05e6afa05948c30b53b49baaff9211e9abe Mon Sep 17 00:00:00 2001
From: Jonas Herzig <me@johni0702.de>
Date: Mon, 28 Aug 2017 21:17:16 +0200
Subject: [PATCH 2/2] Make sure shadowJar is run before build task
---
build.gradle | 1 +
1 file changed, 1 insertion(+)
diff --git a/build.gradle b/build.gradle
index dc84f48..d99f39b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -101,6 +101,7 @@ shadowJar {
append('META-INF/NOTICE.txt')
from(tasks.findByName('preshadowJar').outputs.files.collect {it.isDirectory() ? it : zipTree(it)})
}
+build.dependsOn shadowJar
eclipse.project {
name = 'ReplayStudio'
--
2.5.5

View File

@@ -57,7 +57,8 @@ setup_dep () {
exit 1
fi
cp "$jar" "../$dep.jar"
# Subshell to allow for expansion of *
cp "$(echo $jar)" "../$dep.jar"
popd
}
@@ -83,6 +84,7 @@ setup_dep "srg2source" "https://github.com/MinecraftForge/Srg2Source.git" "ea4ea
setup_dep "mixingradle" "https://github.com/SpongePowered/MixinGradle.git" "3d81c8e202ec435056fb2068fdc34cfefa99be2d" "build/libs/mixingradle-0.4-SNAPSHOT.jar" "8b3508867128a5d564631635dff898a36f9aca8db54b7bb3af6f4924e3f4bead"
setup_dep "forgegradle" "https://github.com/MinecraftForge/ForgeGradle.git" "a228a836a2dc5ce546d2d53c48760f52f082d7ad" "build/libs/ForgeGradle-2.3-SNAPSHOT.jar" "94bf0d8be7e68a3d9828c8208024c21f2c171663dd7d56b95b3459bfc67273c0"
setup_dep "mixin" "https://github.com/SpongePowered/Mixin.git" "b558323da3bd6ce94aeb442bfd7357f6c40d2fd4" "build/libs/mixin-0.6.11-SNAPSHOT.jar" "8ec6ce24b8192f043976344305ba6afbc35b052056f1559ca5914a77c5eae71d"
setup_dep "replaystudio" "https://github.com/ReplayMod/ReplayStudio.git" "82bd8aa34e0ddb04d179299b582e960dc19a66f8" "build/libs/ReplayStudio-*all.jar" "c416c52ea3470d34dd2f9e26fb67836cef717b2c033ca0637af30d9f5e3bb31b"
rm -rf tmp
mkdir tmp