Run jarjar on gwt-dev-platform.jar, for all three platforms, so that
a large number of internal dependencies are renamed to go under
com.google.gwt.thirdparty.

Review by: fabbott



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4419 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common.ant.xml b/common.ant.xml
index 4f76a90..2b19d63 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -39,6 +39,7 @@
   <property name="gwt.build.dist" location="${gwt.build}/dist" />
   <property name="project.build" location="${gwt.build.out}/${project.tail}" />
   <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" />
+  <property name="project.lib.raw" location="${gwt.build.lib}/gwt-${ant.project.name}-raw.jar" />
   <property name="project.jni" location="${gwt.build}/${project.tail}" />
   <property name="javac.out" location="${project.build}/bin" />
   <property name="javac.junit.out" location="${project.build}/bin-test" />
diff --git a/dev/common.ant.xml b/dev/common.ant.xml
index 4353204..931f030 100755
--- a/dev/common.ant.xml
+++ b/dev/common.ant.xml
@@ -4,6 +4,9 @@
 
   <property.ensure name="gwt.core.root" location="../core" />
   <property.ensure name="gwt.core.build" location="${project.build}/../core" />
+	
+  <taskdef name="jarjar"   
+	classname="com.tonicsystems.jarjar.JarJarTask" classpath="${gwt.tools.lib}/tonicsystems/jarjar-1.0rc8.jar"/>  
 
   <target name="compile" description="Compile all java files">
     <mkdir dir="${javac.out}" />
@@ -18,7 +21,8 @@
 
   <target name="build" depends="compile" description="Build and package this project">
     <mkdir dir="${gwt.build.lib}" />
-    <gwt.jar>
+    <!-- Use jar instead of gwt.jar here because gwt.jar fixes the destfile -->
+    <jar destfile="${project.lib.raw}" update="true" duplicate="preserve" index="true" >
       <fileset dir="src" excludes="**/package.html"/>
       <fileset dir="${gwt.core.root}/src">
         <exclude name="**/package.html"/>
@@ -32,12 +36,40 @@
       <manifest>
         <attribute name="Main-Class" value="com.google.gwt.dev.GWTMain" />
       </manifest>
-    </gwt.jar>
+    </jar>
+ 
+    <outofdate>
+      <sourcefiles>
+        <fileset file="${project.lib.raw}" />
+      </sourcefiles>
+      <targetfiles path="${project.lib}" />
+      <sequential>
+        <jarjar destfile="${project.lib}">
+          <zipfileset src="${project.lib.raw}" />
+          <!-- Don't rename these packages, because they are actually supplied by external jars -->
+          <rule pattern="org.xml.**" result="@0" />
+          <rule pattern="org.w3c.**" result="@0" />
+          <rule pattern="org.omg.**" result="@0" />
+          <rule pattern="org.ietf.**" result="@0" />
+
+          <!-- Don't rename SWT, because it includes native methods -->
+          <rule pattern="org.eclipse.swt.**" result="@0" />
+            
+          <!-- Don't rename tapestry, because it ends up broken.  The problem is
+               that it computes class names throuh string operations in a way that
+               jarjar does not understand.  -->
+          <rule pattern="org.apache.tapestry.**" result="@0" />
+            
+          <!-- Put all other org.* packages under com.google.gwt.thirdparty -->
+          <rule pattern="org.**" result="com.google.gwt.thirdparty.@0" />
+        </jarjar>
+      </sequential>
+    </outofdate>
   </target>
 
   <target name="clean" description="Cleans this project's intermediate and output files">
     <delete dir="${project.build}" failonerror="false" />
+    <delete file="${project.lib.raw}" failonerror="false" />
     <delete file="${project.lib}" failonerror="false" />
   </target>
-
 </project>