|
1 | | -@REM ---------------------------------------------------------------------------- |
2 | | -@REM Copyright 2001-2006 The Apache Software Foundation. |
3 | | -@REM |
4 | | -@REM Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | -@REM you may not use this file except in compliance with the License. |
6 | | -@REM You may obtain a copy of the License at |
7 | | -@REM |
8 | | -@REM http://www.apache.org/licenses/LICENSE-2.0 |
9 | | -@REM |
10 | | -@REM Unless required by applicable law or agreed to in writing, software |
11 | | -@REM distributed under the License is distributed on an "AS IS" BASIS, |
12 | | -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | -@REM See the License for the specific language governing permissions and |
14 | | -@REM limitations under the License. |
15 | | -@REM ---------------------------------------------------------------------------- |
16 | | -@REM |
17 | | -@REM Copyright (c) 2001-2006 The Apache Software Foundation. All rights |
18 | | -@REM reserved. |
19 | | - |
20 | | -@echo off |
21 | | - |
22 | | -set ERROR_CODE=0 |
23 | | - |
24 | | -:init |
25 | | -@REM Decide how to startup depending on the version of windows |
26 | | - |
27 | | -@REM -- Win98ME |
28 | | -if NOT "%OS%"=="Windows_NT" goto Win9xArg |
29 | | - |
30 | | -@REM set local scope for the variables with windows NT shell |
31 | | -if "%OS%"=="Windows_NT" @setlocal |
32 | | - |
33 | | -@REM -- 4NT shell |
34 | | -if "%eval[2+2]" == "4" goto 4NTArgs |
35 | | - |
36 | | -@REM -- Regular WinNT shell |
37 | | -set CMD_LINE_ARGS=%* |
38 | | -goto WinNTGetScriptDir |
39 | | - |
40 | | -@REM The 4NT Shell from jp software |
41 | | -:4NTArgs |
42 | | -set CMD_LINE_ARGS=%$ |
43 | | -goto WinNTGetScriptDir |
44 | | - |
45 | | -:Win9xArg |
46 | | -@REM Slurp the command line arguments. This loop allows for an unlimited number |
47 | | -@REM of arguments (up to the command line limit, anyway). |
48 | | -set CMD_LINE_ARGS= |
49 | | -:Win9xApp |
50 | | -if %1a==a goto Win9xGetScriptDir |
51 | | -set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 |
52 | | -shift |
53 | | -goto Win9xApp |
54 | | - |
55 | | -:Win9xGetScriptDir |
56 | | -set SAVEDIR=%CD% |
57 | | -%0\ |
58 | | -cd %0\..\.. |
59 | | -set BASEDIR=%CD% |
60 | | -cd %SAVEDIR% |
61 | | -set SAVE_DIR= |
62 | | -goto repoSetup |
63 | | - |
64 | | -:WinNTGetScriptDir |
65 | | -set BASEDIR=%~dp0\.. |
66 | | - |
67 | | -:repoSetup |
68 | | -set REPO= |
69 | | -if exist "%BASEDIR%\bin\setup.bat" call "%BASEDIR%\bin\setup.bat" |
70 | | - |
71 | | -if "%JAVACMD%"=="" set JAVACMD=java |
72 | | - |
73 | | -if "%REPO%"=="" set REPO=%BASEDIR%\repo |
74 | | - |
75 | | -set CLASSPATH= |
76 | | - |
77 | | -set ENDORSED_DIR=foo |
78 | | -if NOT "%ENDORSED_DIR%" == "" set CLASSPATH="%BASEDIR%"\%ENDORSED_DIR%\*;%CLASSPATH% |
79 | | - |
80 | | -if NOT "%CLASSPATH_PREFIX%" == "" set CLASSPATH=%CLASSPATH_PREFIX%;%CLASSPATH% |
81 | | - |
82 | | -@REM Reaching here means variables are defined and arguments have been captured |
83 | | -:endInit |
84 | | - |
85 | | -%JAVACMD% %JAVA_OPTS% Yo dude -classpath %CLASSPATH% -Dapp.name="test-endorsed-lib" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" foo.Bar %CMD_LINE_ARGS% |
86 | | -if %ERRORLEVEL% NEQ 0 goto error |
87 | | -goto end |
88 | | - |
89 | | -:error |
90 | | -if "%OS%"=="Windows_NT" @endlocal |
91 | | -set ERROR_CODE=%ERRORLEVEL% |
92 | | - |
93 | | -:end |
94 | | -@REM set local scope for the variables with windows NT shell |
95 | | -if "%OS%"=="Windows_NT" goto endNT |
96 | | - |
97 | | -@REM For old DOS remove the set variables from ENV - we assume they were not set |
98 | | -@REM before we started - at least we don't leave any baggage around |
99 | | -set CMD_LINE_ARGS= |
100 | | -goto postExec |
101 | | - |
102 | | -:endNT |
103 | | -@REM If error code is set to 1 then the endlocal was done already in :error. |
104 | | -if %ERROR_CODE% EQU 0 @endlocal |
105 | | - |
106 | | - |
107 | | -:postExec |
108 | | - |
109 | | -if "%FORCE_EXIT_ON_ERROR%" == "on" ( |
110 | | - if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% |
111 | | -) |
112 | | - |
113 | | -exit /B %ERROR_CODE% |
| 1 | +@REM ---------------------------------------------------------------------------- |
| 2 | +@REM Copyright 2001-2006 The Apache Software Foundation. |
| 3 | +@REM |
| 4 | +@REM Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +@REM you may not use this file except in compliance with the License. |
| 6 | +@REM You may obtain a copy of the License at |
| 7 | +@REM |
| 8 | +@REM http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +@REM |
| 10 | +@REM Unless required by applicable law or agreed to in writing, software |
| 11 | +@REM distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +@REM See the License for the specific language governing permissions and |
| 14 | +@REM limitations under the License. |
| 15 | +@REM ---------------------------------------------------------------------------- |
| 16 | +@REM |
| 17 | +@REM Copyright (c) 2001-2006 The Apache Software Foundation. All rights |
| 18 | +@REM reserved. |
| 19 | + |
| 20 | +@echo off |
| 21 | + |
| 22 | +set ERROR_CODE=0 |
| 23 | + |
| 24 | +:init |
| 25 | +@REM Decide how to startup depending on the version of windows |
| 26 | + |
| 27 | +@REM -- Win98ME |
| 28 | +if NOT "%OS%"=="Windows_NT" goto Win9xArg |
| 29 | + |
| 30 | +@REM set local scope for the variables with windows NT shell |
| 31 | +if "%OS%"=="Windows_NT" @setlocal |
| 32 | + |
| 33 | +@REM -- 4NT shell |
| 34 | +if "%eval[2+2]" == "4" goto 4NTArgs |
| 35 | + |
| 36 | +@REM -- Regular WinNT shell |
| 37 | +set CMD_LINE_ARGS=%* |
| 38 | +goto WinNTGetScriptDir |
| 39 | + |
| 40 | +@REM The 4NT Shell from jp software |
| 41 | +:4NTArgs |
| 42 | +set CMD_LINE_ARGS=%$ |
| 43 | +goto WinNTGetScriptDir |
| 44 | + |
| 45 | +:Win9xArg |
| 46 | +@REM Slurp the command line arguments. This loop allows for an unlimited number |
| 47 | +@REM of arguments (up to the command line limit, anyway). |
| 48 | +set CMD_LINE_ARGS= |
| 49 | +:Win9xApp |
| 50 | +if %1a==a goto Win9xGetScriptDir |
| 51 | +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 |
| 52 | +shift |
| 53 | +goto Win9xApp |
| 54 | + |
| 55 | +:Win9xGetScriptDir |
| 56 | +set SAVEDIR=%CD% |
| 57 | +%0\ |
| 58 | +cd %0\..\.. |
| 59 | +set BASEDIR=%CD% |
| 60 | +cd %SAVEDIR% |
| 61 | +set SAVE_DIR= |
| 62 | +goto repoSetup |
| 63 | + |
| 64 | +:WinNTGetScriptDir |
| 65 | +set BASEDIR=%~dp0\.. |
| 66 | + |
| 67 | +:repoSetup |
| 68 | +set REPO= |
| 69 | +if exist "%BASEDIR%\bin\setup.bat" call "%BASEDIR%\bin\setup.bat" |
| 70 | + |
| 71 | +if "%JAVACMD%"=="" set JAVACMD=java |
| 72 | + |
| 73 | +if "%REPO%"=="" set REPO=%BASEDIR%\repo |
| 74 | + |
| 75 | +set CLASSPATH= |
| 76 | + |
| 77 | +set ENDORSED_DIR=foo |
| 78 | +if NOT "%ENDORSED_DIR%" == "" set CLASSPATH="%BASEDIR%"\%ENDORSED_DIR%\*;%CLASSPATH% |
| 79 | + |
| 80 | +if NOT "%CLASSPATH_PREFIX%" == "" set CLASSPATH=%CLASSPATH_PREFIX%;%CLASSPATH% |
| 81 | + |
| 82 | +@REM Reaching here means variables are defined and arguments have been captured |
| 83 | +:endInit |
| 84 | + |
| 85 | +%JAVACMD% %JAVA_OPTS% Yo dude -classpath %CLASSPATH% -Dapp.name="test-endorsed-lib" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" foo.Bar %CMD_LINE_ARGS% |
| 86 | +if %ERRORLEVEL% NEQ 0 goto error |
| 87 | +goto end |
| 88 | + |
| 89 | +:error |
| 90 | +if "%OS%"=="Windows_NT" @endlocal |
| 91 | +set ERROR_CODE=%ERRORLEVEL% |
| 92 | + |
| 93 | +:end |
| 94 | +@REM set local scope for the variables with windows NT shell |
| 95 | +if "%OS%"=="Windows_NT" goto endNT |
| 96 | + |
| 97 | +@REM For old DOS remove the set variables from ENV - we assume they were not set |
| 98 | +@REM before we started - at least we don't leave any baggage around |
| 99 | +set CMD_LINE_ARGS= |
| 100 | +goto postExec |
| 101 | + |
| 102 | +:endNT |
| 103 | +@REM If error code is set to 1 then the endlocal was done already in :error. |
| 104 | +if %ERROR_CODE% EQU 0 @endlocal |
| 105 | + |
| 106 | + |
| 107 | +:postExec |
| 108 | + |
| 109 | +if "%FORCE_EXIT_ON_ERROR%" == "on" ( |
| 110 | + if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% |
| 111 | +) |
| 112 | + |
| 113 | +exit /B %ERROR_CODE% |
0 commit comments