Skip to content

Commit b3951bc

Browse files
committed
Get setupDecompWorkspace fully working
Updates Special Source to fix a ProGuard bug Fix injecting new files into the jar
1 parent 5189f0b commit b3951bc

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ dependencies {
7676
compile 'com.github.tony19:named-regexp:0.2.3' // 1.7 Named regexp features
7777
compile 'net.minecraftforge:forgeflower:1.5.380.22' // Fernflower Forge edition
7878

79-
shade 'net.md-5:SpecialSource:1.8.2' // deobf and reobf
79+
shade 'net.md-5:SpecialSource:1.8.3' // deobf and reobf
8080

8181
// because curse
8282
compile 'org.apache.httpcomponents:httpclient:4.3.3'
@@ -214,7 +214,7 @@ pluginBundle {
214214
uploadArchives {
215215
repositories.mavenDeployer {
216216

217-
dependsOn 'build'
217+
dependsOn 'jar'
218218

219219
if (project.hasProperty('forgeMavenPass'))
220220
{

src/main/java/net/minecraftforge/gradle/tasks/PostDecompileTask.java

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,23 @@ protected void postWriteEntry(JarOutputStream jarOut, String entryName) throws I
182182
protected void postWrite(JarOutputStream jarOut) throws IOException
183183
{
184184
File file = ((DelayedFile)this.injectDir).call();
185-
File info = new File(file, "package-info-template.java");
186-
if (info.exists())
187-
{
188-
String template = Resources.toString(info.toURI().toURL(), Charsets.UTF_8);
189-
getLogger().debug("Adding package-infos");
190-
for (String pkg : this.seenPackages)
191-
{
192-
jarOut.putNextEntry(new ZipEntry(pkg + "/package-info.java"));
193-
jarOut.write(template.replaceAll("\\{PACKAGE\\}", pkg.replace('/', '.')).getBytes());
194-
jarOut.closeEntry();
195-
}
196-
}
197185

198-
for (File f : this.getProject().fileTree(info))
199-
{
200-
if ("package-info-template.java".equals(f.getName())) continue;
201-
String name = f.getAbsolutePath().substring(info.getAbsolutePath().length() + 1).replace('\\', '/');
202-
jarOut.putNextEntry(new ZipEntry(name));
203-
jarOut.write(Resources.toByteArray(f.toURI().toURL()));
204-
jarOut.closeEntry();
186+
for (File f : getProject().fileTree(file)) {
187+
if ("package-info-template.java".equals(f.getName())) {
188+
String template = Files.toString(f, Charsets.UTF_8);
189+
getLogger().debug("Adding package-infos");
190+
191+
for (String pkg : seenPackages) {
192+
jarOut.putNextEntry(new ZipEntry(pkg + "/package-info.java"));
193+
jarOut.write(template.replaceAll("\\{PACKAGE\\}", pkg.replace('/', '.')).getBytes());
194+
jarOut.closeEntry();
195+
}
196+
} else {
197+
String name = f.getAbsolutePath().substring(file.getAbsolutePath().length() + 1).replace('\\', '/');
198+
jarOut.putNextEntry(new ZipEntry(name));
199+
jarOut.write(Files.asByteSource(f).read());
200+
jarOut.closeEntry();
201+
}
205202
}
206203
}
207204

0 commit comments

Comments
 (0)