MinimalBible.github.io/_posts/2014-04-22-a-star-wars-reference-and-practical-scale-builds.md
2015-01-13 19:09:25 -05:00

3.5 KiB
Raw Blame History

layout title modified tags image comments share
post A Star Wars reference, and practical-scale builds 2014-04-29 17:35:35 -0400
shade
ant
jsword
and-bible
maven
xml
jarjar
feature credit creditlink
true

Also some really cool build logic

So Ive covered in another post how I got to create a build.xml file for the MinimalBible. The actual process of writing the build.xml file is another story entirely.

First, a few disclaimers. Googles version of the Apache HttpClient is old and outdated. You cant just include the httpclient library in your project, as it produces errors. Also, I wanted an entirely automated, one-click build. That meant no copying in a new library by hand. Especially since said new library would not be compatible with code expecting a vanilla HttpClient (see Compatibility notes number 2). Its possible there would be no compatibility issues, but I never followed this path. Finally, I had run into this problem when I was using Maven to build the jSword library. The solution I used then was to do a shaded build, which basically manipulated the bytecode to look for the library in a different path. Thus, all the code referencing org.apache.http could instead reference org.apache.shaded.http, or something similar.

So, knowing that I was going to write a build script using Ant, I now had to figure out how to do something similar to the Maven shaded build. Very long story short, JarJar was the plugin I found to do the trick (ironically, searching “JarJar” on Google yielded the library and not the character as the first result. Im OK with this). I had a couple of reservations since the most recent version of jarjar was released November 2012, but so far its panned out all right.

Now I needed to edit the jar task in Ant to use the new JarJar plugin. The existing jar task that I copied from And-bible did most of the work, but did not include the shaded build. The JarJar Getting Started page had most of the information I needed on getting this set up for MinimalBible. Honestly, the only thing I really needed that wasnt documented was including multiple jars at a time. I didnt want to manually list out a ]7 for every jar file that needed to get built in with jSword, so after a lot of digging around, I found the . It doesnt seem to be officially documented, so using some information found on Stack Overflow, I hacked together a solution that allowed me to include the jSword dependencies, while excluding the libraries used for testing.

So at this point, Ive now got a shaded build for jSword working as expected. Im now ready to start focusing on MinimalBible code exclusively, and I can easily include building jSword as a part of building MinimalBible. In the future Ill need to work on stripping out more of the code that goes into jSword that isnt needed (its currently an 18MB library), but for now Ive got a stable, consistent, one-click build working. Ill call that good.