]> git.evergreen-ils.org Git - working/Hatch.git/blob - hatch.sh
LP#1708757 Add Chrome store ID to Windows installer
[working/Hatch.git] / hatch.sh
1 #!/bin/bash
2 #
3 # Linux/Mac Hatch Execution Script
4
5 # Use this for openjdk
6 JAVA_HOME=/usr
7 # Use this for local extract of Java libs
8 #JAVA_HOME=jdk1.8
9
10 JAVA=$JAVA_HOME/bin/java
11 JAVAC=$JAVA_HOME/bin/javac
12 JAR=$JAVA_HOME/bin/jar
13 LOGS=-Djava.util.logging.config.file=logging.properties
14 JSON_BUILD="20160810"
15 JSON_JAR="json-$JSON_BUILD.jar"
16 JSON_URL="https://search.maven.org/remotecontent?filepath=org/json/json/$JSON_BUILD/$JSON_JAR"
17
18 COMMAND="$1"
19
20 if [ "$COMMAND" == "compile" ]; then
21
22     mkdir -p lib
23     if [ ! -f lib/$JSON_JAR ]; then
24         echo "Fetching JSON libs..."
25         wget -O lib/$JSON_JAR $JSON_URL
26     fi;
27
28     $JAVAC -Xdiags:verbose -Xlint:unchecked \
29         -cp lib/\* -d lib src/org/evergreen_ils/hatch/*.java
30
31     # Create a JAR file from the compiled class files them remove them.
32     $JAR cf lib/hatch.jar -C lib org
33     rm -r lib/org
34
35 elif [ "$COMMAND" == "test" ]; then
36
37     # 1. Run TestHatch in (default) send mode, which emits JSON requests
38     # 2. Run Hatch and process messages emitted from #1.
39     # 3. Run TestHatch in receive mode to log the responses.
40
41     $JAVA "$LOGS" -cp lib/\* org.evergreen_ils.hatch.TestHatch \
42         | $JAVA "$LOGS" -cp lib/\* org.evergreen_ils.hatch.Hatch \
43         | $JAVA "$LOGS" -cp lib/\* org.evergreen_ils.hatch.TestHatch receive
44
45 else
46
47     # run Hatch
48     $JAVA "$LOGS" -cp lib/\* org.evergreen_ils.hatch.Hatch
49 fi;