-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.bat
More file actions
118 lines (101 loc) · 2.87 KB
/
make.bat
File metadata and controls
118 lines (101 loc) · 2.87 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@echo off
setlocal EnableDelayedExpansion
if "%~1"=="" goto help
if "%~1"=="help" goto help
if "%~1"=="all" goto help
if "%~1"=="install_base" goto install_base
if "%~1"=="install_deps" goto install_deps
if "%~1"=="build_wasm" goto build_wasm
if "%~1"=="build_docker" goto build_docker
if "%~1"=="run_docker" goto run_docker
if "%~1"=="build_docs" (
if not "%~2"=="" (
call :build_docs "%~2"
) else (
call :build_docs docs
)
goto :eof
)
if "%~1"=="build" (
if not "%~2"=="" (
call :build "%~2"
) else (
call :build bin
)
goto :eof
)
if "%~1"=="test" goto test
if "%~1"=="run" goto run
echo Unknown target: %1
goto help
:help
echo Available targets:
echo install_base : install language runtime (Java JDK)
echo install_deps : install local dependencies
echo build_docs : build the API docs (specify dir as second arg, e.g. make.bat build_docs custom_dir)
echo build : build the CLI binary (specify dir as second arg, e.g. make.bat build custom_dir)
echo build_wasm : build WASM variant (Not implemented)
echo build_docker : build Docker images
echo run_docker : run Docker images
echo test : run tests locally
echo run : run the CLI (e.g. make.bat run --version)
echo help : show this help text
echo all : show this help text
goto :eof
:install_base
echo Installing Java runtime...
echo Please ensure winget is installed or install Java manually.
winget install Microsoft.OpenJDK.17
goto :eof
:install_deps
echo Dependencies already in lib/
goto :eof
:build_docs
set "DOCS_DIR=%~1"
echo Building API docs to %DOCS_DIR%...
if not exist "%DOCS_DIR%" mkdir "%DOCS_DIR%"
dir /s /B "src\main\java\*.java" > doc_sources.txt
javadoc -d "%DOCS_DIR%" -cp "lib/*;src/main/java" @doc_sources.txt
del doc_sources.txt
goto :eof
:build
set "BIN_DIR=%~1"
echo Building CLI to %BIN_DIR%...
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%"
dir /s /B "src\main\java\*.java" > sources.txt
javac -d "%BIN_DIR%" -cp "lib/*;src/main/java" @sources.txt
del sources.txt
goto :eof
:test
echo Running tests...
dir /s /B "src\main\java\*.java" > sources.txt
dir /s /B "src\test\java\*.java" >> sources.txt
javac -cp "lib/*;src/main/java;src/test/java" @sources.txt
java -cp "lib/*;src/main/java;src/test/java" TestRunner
del sources.txt
goto :eof
:run
set "BIN_DIR=bin"
if not exist "%BIN_DIR%\cli\Main.class" call :build bin
shift
set "RUN_ARGS="
:run_loop
if "%~1"=="" goto run_exec
set "RUN_ARGS=%RUN_ARGS% %1"
shift
goto run_loop
:run_exec
java -cp "lib/*;%BIN_DIR%" cli.Main %RUN_ARGS%
goto :eof
:build_wasm
echo WASM Support is not implemented for cdd-java. See WASM.md
goto :eof
:build_docker
echo Building docker images...
docker build -t cdd-java-alpine -f alpine.Dockerfile .
docker build -t cdd-java-debian -f debian.Dockerfile .
goto :eof
:run_docker
echo Testing docker images...
python test_docker.py
goto :eof