-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.bat
executable file
·42 lines (33 loc) · 1.09 KB
/
build.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
@echo off
set DIST=.\classes
set ROOT=%CD%
set CLASSPATH=.;%DIST%;.\lib\*
set VERSION=0.5
echo PILOTS Build Script (v%VERSION%)
echo Please make sure the current directory is in your CLASSPATH
echo Current Path is %ROOT%
if EXIST %DIST% (
echo Removing old classes directory...
rd /s /q %DIST%
)
echo Making dir: %DIST%...
mkdir %DIST%
echo package pilots; > .\pilots\Version.java
echo public class Version { public static final String ver = "%VERSION%"; } >> .\pilots\Version.java
echo "Compiling pilots..."
setlocal EnableDelayedExpansion
(for /f "delims=" %%f in ('dir /b /s *.java ^| findstr /v "example test"') do (set "F=%%f" & set "F=!F:\=\\!" & echo "!F!")) > gen_javasrc.txt
javac -cp %CLASSPATH% -Xlint:none -d %DIST% @gen_javasrc.txt
if EXIST gen_javasrc.txt (
del /q gen_javasrc.txt
)
echo "Generating jar file..."
cd %DIST%
(for /f "delims=" %%f in ('dir *.class /b/s') do (set "F=%%f" & set "F=!F:\=\\!" & set "F=!F: =\ !" & echo "!F!")) > gen_javasrc.txt
jar cf "%ROOT%\lib\pilots.jar" @gen_javasrc.txt
if EXIST gen_javasrc.txt (
del /q gen_javasrc.txt
)
cd %ROOT%
endlocal
echo "Finished!"