-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
43 lines (36 loc) · 1.08 KB
/
build.ps1
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
# Built and Tested on Powershell 6.2
param(
[Parameter(Mandatory=$true, Position=0)]
[ValidateSet("build","run","test","clean","pkg","log")]
[string]$command
)
$locaL:module = "csse.memebreaker"
$local:entryClass = "memebreaker.main.App"
# Build
if ($command.Equals("build")) {
if (-not (Test-Path -Path "build")) {
New-Item -Path "build" -ItemType "Directory"
}
javac @("-d", "build", "--module-source-path=src", "--module=$locaL:module")
}
# Run
if ($command.Equals("run")) {
if (Test-Path -Path "build/$local:module.jar") {
java @("-jar", "build/$locaL:module.jar")
} else {
java @("--module-path=build", "--module=$locaL:module/$local:entryClass")
}
}
# Clean
if ($command.Equals("clean")) {
Remove-Item -Path "build"
}
# Package
if ($command.Equals("pkg")) {
jar @("-c", "--file=build/$locaL:module.jar", "--main-class=$local:entryClass", "-C", "build/$locaL:module", ".")
}
<#
Test -> run unit tests and build tests
Package -> package the module(s) into a JAR file
Log -> read compilation/runtime warnings & logs
#>