Permalink
Fetching contributors…
Cannot retrieve contributors at this time
125 lines (108 sloc) 5.4 KB
---------------------------------------------------------------------------------------------------
Apart from the complete rewrite of JarJarMojo, the following patches are applied to the JarJar code
---------------------------------------------------------------------------------------------------
commit 8e39d8abc8deb8eac3451f781a711c84f594301e
Author: Jason van Zyl <jason@sonatype.com>
Date: Sun Mar 18 22:41:55 2012 -0400
o eliminating javax from the rule processing causes problems with things like javax.inject.**
in the context of Maven I don't believe we're ever going to give JarJar direct access to the JRE where
everything can be pulled in.
in my case here where i am making a self-contained JSR330-based server removing the javax restricted resulted
in a working uber jar.
diff --git a/src/main/java/com/tonicsystems/jarjar/KeepProcessor.java b/src/main/java/com/tonicsystems/jarjar/KeepProcessor.java
index cce768c..b505860 100644
--- a/src/main/java/com/tonicsystems/jarjar/KeepProcessor.java
+++ b/src/main/java/com/tonicsystems/jarjar/KeepProcessor.java
@@ -75,7 +75,7 @@ class KeepProcessor extends Remapper implements JarProcessor
}
public String map(String key) {
- if (key.startsWith("java/") || key.startsWith("javax/"))
+ if (key.startsWith("java/"))
return null;
curSet.add(key);
return null;
commit 2df8dde80442150c7c061f237bf26e3617a446a4
Author: Stuart McCulloch <mcculls@Stuart-McCullochs-MacBook-Pro.local>
Date: Fri Jul 8 20:59:24 2011 +0100
Allow duplicate entries to be ignored
diff --git a/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java b/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java
index ec1ab74..f54785e 100644
--- a/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java
+++ b/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java
@@ -27,6 +27,9 @@ import java.util.*;
public class StandaloneJarProcessor
{
public static void run(File from, File to, JarProcessor proc) throws IOException {
+ run(from, to, proc, false);
+ }
+ public static void run(File from, File to, JarProcessor proc, boolean ignoreDuplicates) throws IOException {
byte[] buf = new byte[0x2000];
File tmp = null;
if (from.equals(to)) {
@@ -56,7 +59,7 @@ public class StandaloneJarProcessor
out.write(struct.data);
} else if (struct.name.endsWith("/")) {
// TODO(chrisn): log
- } else {
+ } else if (!ignoreDuplicates) {
throw new IllegalArgumentException("Duplicate jar entries: " + struct.name);
}
}
commit c963da03aba8ca8eda53ec48173cb2640815fe89
Author: Stuart McCulloch <mcculls@gmail.com>
Date: Thu Oct 4 21:20:20 2012 +0100
Remove Java6-ism
diff --git a/src/main/java/com/tonicsystems/jarjar/RulesFileParser.java b/src/main/java/com/tonicsystems/jarjar/RulesFileParser.java
index f54f3b9..268c35a 100644
--- a/src/main/java/com/tonicsystems/jarjar/RulesFileParser.java
+++ b/src/main/java/com/tonicsystems/jarjar/RulesFileParser.java
@@ -45,7 +45,7 @@ class RulesFileParser
String line;
while ((line = br.readLine()) != null) {
line = stripComment(line);
- if (line.isEmpty())
+ if (line.length()==0)
continue;
String[] parts = line.split("\\s+");
if (parts.length < 2)
commit d880def9bc0886c1cce4f39f41cbc9aa83678bd4
Author: Stuart McCulloch <mcculls@gmail.com>
Date: Wed Oct 17 16:49:32 2012 +0100
Stop package remapper from changing directories into files when applying rules that add prefixes to resources
diff --git a/src/main/java/com/tonicsystems/jarjar/PackageRemapper.java b/src/main/java/com/tonicsystems/jarjar/PackageRemapper.java
index 4d102be..4f2b2ab 100644
--- a/src/main/java/com/tonicsystems/jarjar/PackageRemapper.java
+++ b/src/main/java/com/tonicsystems/jarjar/PackageRemapper.java
@@ -76,7 +76,10 @@ class PackageRemapper extends Remapper
if (absolute) s = "/" + s;
if (s.indexOf(RESOURCE_SUFFIX) < 0)
return path;
- s = s.substring(0, s.length() - RESOURCE_SUFFIX.length()) + end;
+ if (end.length() > 0)
+ s = s.substring(0, s.length() - RESOURCE_SUFFIX.length()) + end;
+ else
+ s = s.substring(0, s.lastIndexOf('/') + 1);
pathCache.put(path, s);
}
return s;
commit d3f8e05c4330a051fe2dd75a6ce5e63d419531fb
Author: Stuart McCulloch <mcculls@gmail.com>
Date: Wed Sep 4 11:00:31 2013 +0100
Stop exceptions in finally block from hiding the original cause
diff --git a/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java b/src/main/java/com/tonicsystems/jar
index 1239a19..9eaeb10 100644
--- a/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java
+++ b/src/main/java/com/tonicsystems/jarjar/util/StandaloneJarProcessor.java
@@ -62,8 +62,12 @@ public class StandaloneJarProcessor
}
finally {
- in.close();
- out.close();
+ try {
+ in.close();
+ } catch (IOException e) {}
+ try {
+ out.close();
+ } catch (IOException e) {}
}
// delete the empty directories