forked from blesslee/MCMS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lein.bat
98 lines (75 loc) · 2.78 KB
/
lein.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@echo off
rem this script works after downloading Leiningen standalone jar
rem from http://repo.technomancy.us/
rem and copying it on %LEIN_JAR% path
rem There is needed also Clojure jar from http://build.clojure.org/
rem and it should be copied on %CLOJURE_JAR% path
set CLOJURE_VERSION=1.1.0
set LEIN_VERSION=1.1.0
set RUNPATH=%~dp0
rem uncomment this and set paths explicitly
set LEIN_JAR=%RUNPATH%\lib\leiningen-%LEIN_VERSION%-standalone.jar
set CLOJURE_JAR=%RUNPATH%\lib\clojure-%CLOJURE_VERSION%.jar
if "x%1" == "xself-install" goto NO_SELF_INSTALL
rem it is possible to set LEIN_JAR and CLOJURE_JAR variables manually
rem so we don't overwrite them
if "x%LEIN_JAR%" == "x" goto SET_LEIN
goto ARGS_HANDLING
if "x%CLOJURE_JAR%" == "x" goto SET_CLOJURE
goto ARGS_HANDLING
:SET_LEIN
set LEIN_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\leiningen\leiningen\%LEIN_VERSION%\leiningen-%LEIN_VERSION%-standalone.jar
:SET_CLOJURE
set CLOJURE_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\org\clojure\clojure\%CLOJURE_VERSION%\clojure-%CLOJURE_VERSION%.jar
:ARGS_HANDLING
if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
rem ##################################################
rem count number of command line arguments
rem
set ARGCOUNT=0
for %%a in (%*) do set /a ARGCOUNT+=1
rem ##################################################
rem ##################################################
rem add jars found under "lib" directory to CLASSPATH
rem
setLocal EnableDelayedExpansion
set CLASSPATH="
for /R ./lib %%a in (*.jar) do (
set CLASSPATH=!CLASSPATH!;%%a
)
set CLASSPATH=!CLASSPATH!"
set CLASSPATH=%CLASSPATH%;"%LEIN_JAR%"
if "x%DEBUG%" == "x" goto RUN
echo CLASSPATH=%CLASSPATH%
rem ##################################################
:RUN
if "x%1" == "xrepl" goto RUN_REPL
if "%ARGCOUNT%" == "2" goto RUN_ARG2
if "%ARGCOUNT%" == "3" goto RUN_ARG3
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
goto EOF
:RUN_ARG2
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
goto EOF
:RUN_ARG3
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
goto EOF
:RUN_REPL
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp src;classes;%CLASSPATH% clojure.main %2 %3 %4
goto EOF
:NO_LEIN_JAR
echo.
echo "%LEIN_JAR%" can not be found.
echo Please change LEIN_JAR environment variable
echo or edit lein.bat to set appropriate LEIN_JAR path.
echo.
goto EOF
:NO_SELF_INSTALL
echo.
echo SELF_INSTALL functionality is not available on Windows
echo Please download needed JARs manually:
echo 1. leiningen-%LEIN_VERSION%-standalone.jar from http://repo.technomancy.us/
echo 2. clojure.jar from http://build.clojure.org/
echo.
goto EOF
:EOF