Get the JarJar system running to build a shaded Jar

Unfortunately means I can't just copy the ivy.xml from jSword.
But I do have excludes="" that I didn't with maven previously.
This commit is contained in:
Bradlee Speice 2014-04-19 00:17:05 -04:00
parent 08f179b0c3
commit bfe6eeda0c
3 changed files with 43 additions and 11 deletions

View File

@ -4,4 +4,3 @@
/ivy /ivy
/libs /libs
/tools /tools
/ivy.xml

View File

@ -26,7 +26,6 @@
<delete dir="${build.src}" /> <delete dir="${build.src}" />
<delete dir="${build.class}" /> <delete dir="${build.class}" />
<delete dir="${distribution}" /> <delete dir="${distribution}" />
<!-- Forces us to redownload dependencies, but I'm OK with that -->
<delete dir="${jsword-dependencydir}" /> <delete dir="${jsword-dependencydir}" />
</target> </target>
@ -36,9 +35,6 @@
<mkdir dir="${build.class}" /> <mkdir dir="${build.class}" />
<mkdir dir="${distribution}" /> <mkdir dir="${distribution}" />
<mkdir dir="${jsword-dependencydir}" /> <mkdir dir="${jsword-dependencydir}" />
<copy todir="${jsword-tweaks.home}">
<fileset file="${jsword.project}/ivy.xml" />
</copy>
</target> </target>
<target name="mergeCode" depends="init"> <target name="mergeCode" depends="init">
@ -82,14 +78,21 @@
</target> </target>
<target name="jar" depends="compile"> <target name="jar" depends="compile">
<jar jarfile="${distribution}/jsword.jar"> <!-- And use JarJar to shade the HttpClient -->
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${jsword-dependencydir}/jarjar-1.3.jar" />
<jarjar jarfile="${distribution}/jsword.jar">
<fileset dir="${build.class}" /> <fileset dir="${build.class}" />
<!-- need to include the .properties and .plugin files --> <!-- need to include the .properties and .plugin files -->
<fileset dir="${build.src}"> <fileset dir="${build.src}">
<exclude name="**/*.java" /> <exclude name="**/*.java" />
<exclude name="**/*.html" /> <exclude name="**/*.html" />
</fileset> </fileset>
</jar> <zipgroupfileset dir="${jsword-dependencydir}" includes="*.jar" excludes="junit-*.jar, hamcrest-*.jar, jarjar-*.jar" />
<rule pattern="org.apache.http.**" result="org.apache.shaded.http.@1" />
</jarjar>
<!-- We can use regular jar to build the src -->
<jar jarfile="${distribution}/jsword-src.jar" basedir="${build.src}" /> <jar jarfile="${distribution}/jsword-src.jar" basedir="${build.src}" />
</target> </target>
@ -97,7 +100,7 @@
description="Copy generated jars to And Bible for use"> description="Copy generated jars to And Bible for use">
<copy todir="${MinimalBible}/libs"> <copy todir="${MinimalBible}/libs">
<fileset dir="${distribution}" includes="*.jar" excludes="*-src.jar" /> <fileset dir="${distribution}" includes="*.jar" excludes="*-src.jar" />
<fileset dir="${jsword-dependencydir}" includes="*.jar" /> <!-- We only need to include jsword.jar, the jarjar already included dependencies. -->
</copy> </copy>
<copy todir="${MinimalBible}/libs-src"> <copy todir="${MinimalBible}/libs-src">
<fileset dir="${distribution}" includes="*-src.jar" /> <fileset dir="${distribution}" includes="*-src.jar" />

View File

@ -0,0 +1,30 @@
<ivy-module version="2.0">
<info organisation="org.crosswire" module="jsword"/>
<dependencies>
<dependency org="commons-codec" name="commons-codec" rev="1.9" conf="default->master,sources" />
<dependency org="commons-net" name="commons-net" rev="3.3" conf="default->master,sources" />
<dependency org="org.apache.commons" name="commons-compress" rev="1.7" conf="default->master,sources" />
<dependency org="org.tukaani" name="xz" rev="1.4" conf="default->master,sources" />
<dependency org="org.apache.httpcomponents" name="httpcore" rev="4.3.2" conf="default->master,sources" />
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.3.2" conf="default->master,sources" />
<dependency org="org.jdom" name="jdom2" rev="2.0.5" conf="default->master,sources" />
<dependency org="org.apache.lucene" name="lucene-core" rev="3.0.3" conf="default->master,sources" />
<dependency org="org.apache.lucene" name="lucene-analyzers" rev="3.0.3" conf="default->master,sources" />
<dependency org="org.apache.lucene" name="lucene-smartcn" rev="3.0.3" conf="default->master,sources" />
<dependency org="org.apache.lucene" name="lucene-snowball" rev="3.0.3" conf="default->master,sources" />
<dependency org="junit" name="junit" rev="4.11" conf="default->master,sources" />
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3"/>
<dependency org="com.ibm.icu" name="icu4j" rev="52.1" conf="default->master,sources" />
<dependency org="org.slf4j" name="slf4j-api" rev="1.7.6" conf="default->master,sources" />
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.7.6" conf="default->master,sources" />
<dependency org="org.slf4j" name="slf4j-jdk14" rev="1.7.6" conf="default->master,sources" />
<!-- dependency org="xalan" name="xalan" rev="2.7.1" conf="default->master,sources" / -->
<!-- dependency org="xalan" name="serializer" rev="2.7.1" conf="default->master,sources" / -->
<!-- dependency org="xerces" name="xercesImpl" rev="2.11.0" conf="default->master,sources" / -->
<!-- And to fix the HttpClient shenanigans...
http://stackoverflow.com/questions/20238421/java-lang-nosuchfielderror-org-apache-http-message-basiclineformatter-instance -->
<dependency org="com.googlecode.jarjar" name="jarjar" rev="1.3" />
</dependencies>
</ivy-module>