]> git.evergreen-ils.org Git - working/Hatch.git/blob - hatch.bat
LP1860187: Set .properties Permissions Appropriately
[working/Hatch.git] / hatch.bat
1 @echo off
2 REM Windows Hatch Execution Script
3 REM @echo off required for STDIO to work with the browser.
4
5 REM NOTE: Do not EVER set ERRORLEVEL for any reason; it's a passthrough variable that takes on the current value
6 REM of the errorlevel return status but if you assign to it that magic passthrough is broken and it's just set to that value.
7 REM This is necessary to do sensible comparisons against it. (such as EQU) The 'if errorlevel' construct is completely bananas.
8 REM Also: automatic path testing only looks for 'java' - if you don't have the JDK in your path you'll need to fix that yourself.
9
10 REM Assume java executables are in our path
11 SET JAVA=java
12 SET JAVAC=javac
13 SET JAR=jar
14
15 REM Optionally override the java path
16 REM SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_111"
17 REM SET JAVA=%JAVA_HOME%\bin\java
18 REM SET JAVAC=%JAVA_HOME%\bin\javac
19 REM SET JAR=%JAVA_HOME%\bin\jar
20
21 REM Is anyone there?
22 %JAVA% -version 2>nul
23
24 IF %ERRORLEVEL% EQU 0 GOTO Huzzah
25
26 REM Are you still there?
27 SET JAVA=%PROGRAMDATA%\Oracle\Java\javapath\java
28 %JAVA% -version 2>nul
29
30 IF %ERRORLEVEL% EQU 0 GOTO Huzzah
31
32 REM I don't blame you
33 EXIT /B %ERRORLEVEL%
34
35 REM There you are.
36 :Huzzah
37
38 REM %~1 means to strip %1 of any surrounding quotes.
39 REM This is necessary if you're going to use a construction like "%1" == "etc" because a quoted %1 will
40 REM cause silent failures when the batch file is run and dies because the IF command has a syntax error.
41 REM Specifically, "Files was unexpected at this time."
42
43 IF "%~1" == "compile" (
44
45     %JAVAC% -cp "lib\*" -Xdiags:verbose^
46         -d lib src\org\evergreen_ils\hatch\*.java
47
48     %JAR% cf lib\hatch.jar -C lib org
49     rd /s /q lib\org
50
51 ) ELSE (
52
53     IF "%~1" == "test" (
54
55         %JAVA% -cp "lib\*"^
56             -Djava.util.logging.config.file=logging.properties^
57             org.evergreen_ils.hatch.TestHatch | %JAVA% -cp "lib\*"^
58             -Djava.util.logging.config.file=logging.properties^
59             org.evergreen_ils.hatch.Hatch | %JAVA% -cp "lib\*"^
60             -Djava.util.logging.config.file=logging.properties^
61             org.evergreen_ils.hatch.TestHatch receive
62
63     ) ELSE ( REM No options means run Hatch
64
65         %JAVA% -cp "lib\*"^
66             -Djava.util.logging.config.file=logging.properties^
67             org.evergreen_ils.hatch.Hatch
68
69     )
70 )