LP#1646166 Linux/Mac builder fetches JSON libs
authorBill Erickson <berickxx@gmail.com>
Wed, 30 Nov 2016 17:00:43 +0000 (12:00 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 16 Feb 2017 20:26:18 +0000 (15:26 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
INSTALL.adoc
hatch.sh

index d971cc0..4b190d4 100644 (file)
@@ -26,14 +26,17 @@ for prime time as of writing.
 
 ==== Download org.json Java JSON Library ====
 
-[source,sh]
--------------------------------------------------------------------------
-$ mkdir -p lib
-$ cd lib
-$ wget -O json-20160810.jar \
-    'https://search.maven.org/remotecontent?filepath=org/json/json/20160810/json-20160810.jar'
-$ cd ../
--------------------------------------------------------------------------
+===== Linux =====
+
+The org.json jar file is retrieved automatically when running
+'hatch.sh compile' (below).
+
+===== Windows =====
+
+1. Create a directory called "lib" inside the Hatch directory.
+2. Download the JSON jar file and put it into the "lib" directory:
+
+https://search.maven.org/remotecontent?filepath=org/json/json/20160810/json-20160810.jar
 
 ==== Compile Hatch Java ====
 
index 20627e8..251ac57 100755 (executable)
--- a/hatch.sh
+++ b/hatch.sh
@@ -6,11 +6,20 @@ JAVA_HOME=jdk1.8
 JAVA=$JAVA_HOME/bin/java
 JAVAC=$JAVA_HOME/bin/javac
 LOGS=-Djava.util.logging.config.file=logging.properties
+JSON_BUILD="20160810"
+JSON_JAR="json-$JSON_BUILD.jar"
+JSON_URL="https://search.maven.org/remotecontent?filepath=org/json/json/$JSON_BUILD/$JSON_JAR"
 
 COMMAND="$1"
 
 if [ "$COMMAND" == "compile" ]; then
 
+    mkdir -p lib
+    if [ ! -f lib/$JSON_JAR ]; then
+        echo "Fetching JSON libs..."
+        wget -O lib/$JSON_JAR $JSON_URL
+    fi;
+
     $JAVAC -Xdiags:verbose -Xlint:unchecked \
         -cp lib:lib/\* -d lib src/org/evergreen_ils/hatch/*.java