Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid classpath conflict with rhino #179

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ CVS/
*~
# Ignore Emacs auto saved files
*#*#
build/classes
build/jar
build/yuicompressor*.jar
build/
.idea/
*.iml
2 changes: 1 addition & 1 deletion ant.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ lib.dir = lib
doc.dir = doc
build.dir = build
product.name = yuicompressor
version.number = 2.4.8
version.number = 3.0.0
jar.name = ${product.name}-${version.number}.jar
dist.package.name = ${product.name}-${version.number}
43 changes: 30 additions & 13 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@
</javac>
</target>

<target name="build.jar" depends="build.classes">
<target name="-shade" depends="build.classes">
<mkdir dir="${build.dir}/jar"/>
<!-- The order is important here. Rhino MUST be unjarred first!
(some of our own classes will override the Rhino classes) -->
<unjar src="${lib.dir}/jargs-1.0.jar" dest="${build.dir}/jar"/>
<unjar src="${lib.dir}/rhino-1.7R2.jar" dest="${build.dir}/jar"/>
<copy todir="${build.dir}/jar">
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
</copy>
<jar destfile="${build.dir}/${jar.name}" basedir="${build.dir}/jar">
<manifest>
<attribute name="Main-Class" value="com.yahoo.platform.yui.compressor.Bootstrap"/>
</manifest>
</jar>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${lib.dir}/jarjar-1.4.jar"/>
<jarjar jarfile="${build.dir}/${jar.name}">
<fileset dir="${build.dir}/classes" />
<zipfileset src="${lib.dir}/rhino-1.7R2.jar"
excludes="**/Decompiler.class,**/Parser.class,**/Token.class,**/TokenStream.class"/>
<zipfileset src="${lib.dir}/jargs-1.0.jar"/>
<rule pattern="org.mozilla.**" result="com.yahoo.platform.yui.compressor.rhino.@1"/>
</jarjar>
</target>

<target name="build.jar" depends="-removeemptypackages"/>


<target name="build.dist.package" depends="build.jar">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<mkdir dir="${build.dir}/${dist.package.name}/build"/>
Expand All @@ -77,4 +77,21 @@
includes="${dist.package.name}/**/*"/>
</target>

<!--
Workaround to remove empty packages. won't need this code once [1] will be resolved
https://code.google.com/p/jarjar/issues/detail?q=empty&id=32
-->
<target name="-removeemptypackages" depends="-shade">
<mkdir dir="${build.dir}/exploded"/>
<unzip src="${build.dir}/${jar.name}" dest="${build.dir}/exploded/"/>
<copy includeemptydirs="false" todir="${build.dir}/unpolluted/">
<fileset dir="${build.dir}/exploded/"/>
</copy>
<jar destfile="${build.dir}/${jar.name}">
<fileset dir="${build.dir}/unpolluted/"/>
<manifest>
<attribute name="Main-Class" value="com.yahoo.platform.yui.compressor.Bootstrap"/>
</manifest>
</jar>
</target>
</project>
Binary file added lib/jarjar-1.4.jar
Binary file not shown.