Skip to content

Instantly share code, notes, and snippets.

@RainWarrior
Last active August 29, 2015 13:56
Show Gist options
  • Save RainWarrior/9225748 to your computer and use it in GitHub Desktop.
Save RainWarrior/9225748 to your computer and use it in GitHub Desktop.
diff --git a/build.gradle b/build.gradle
index ac38343..0b827eb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -56,6 +56,12 @@ dependencies {
// stupid maven
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
+
+ compile "org.ow2.asm:asm-debug-all:4.1"
+ compile "org.scalaz:scalaz-core_2.10:7.1.0-M3"
+ compile "com.github.scopt:scopt_2.10:3.2.0"
+
+ compile files("tree_obfuscator_2.10-0.1.jar")
}
artifacts { archives jar }
diff --git a/src/main/java/net/minecraftforge/gradle/tasks/user/reobf/ObfArtifact.java b/src/main/java/net/minecraftforge/gradle/tasks/user/reobf/ObfArtifact.java
index 02901da..de8231f 100644
--- a/src/main/java/net/minecraftforge/gradle/tasks/user/reobf/ObfArtifact.java
+++ b/src/main/java/net/minecraftforge/gradle/tasks/user/reobf/ObfArtifact.java
@@ -29,6 +29,8 @@ import org.gradle.api.tasks.bundling.AbstractArchiveTask;
import COM.rl.NameProvider;
+import asmstuff.TreeObfuscator;
+
import com.google.common.base.Joiner;
import com.google.common.io.Files;
@@ -333,12 +335,25 @@ public class ObfArtifact extends AbstractPublishArtifact
writer.close();
// obfuscate!
- if (caller.getUseRetroGuard())
+ /*if (caller.getUseRetroGuard())
applyRetroGuard(excepted, output, exc.outSrg);
else
- applySpecialSource(excepted, output, exc.outSrg);
+ applySpecialSource(excepted, output, exc.outSrg);*/
+ applyTreeObfuscator(excepted, output, exc.outSrg);
}
+ private void applyTreeObfuscator(File input, File output, File srg) throws IOException {
+ String inS = input.getCanonicalPath();
+ String outS = output.getCanonicalPath();
+ String[] args = new String[] {
+ "-cf", inS,
+ "-ct", outS,
+ "-s", srg.getCanonicalPath(),
+ "-c:" + inS + "=" + outS
+ };
+ TreeObfuscator.main(args);
+ }
+
private void applySpecialSource(File input, File output, File srg) throws IOException
{
// load mapping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment