-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.tofu
72 lines (59 loc) · 1.74 KB
/
build.tofu
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
function build-scalacli
exec scala-cli --power package src --assembly --preamble=false -f --jvm 11 -o build/tofu.jar
exec 7z d build/tofu.jar scala LICENSE NOTICE library.properties rootdoc.txt
end
function build-scala
exec bash build.sh
end
function build-bootstrap
print Building bootstrap JAR
exec scala-cli --power package src -f -o build/tofu-bootstrap.jar
end
function build-java
print Building assembly JARs
exec scala-cli --power package src --assembly --preamble=false -f --jvm 8 -o build/tofu-java.jar
exec scala-cli --power package src --assembly --preamble=false -f --jvm 19 -o build/tofu-java-19.jar
end
function fullbuild
call build-scala
call build-java
call build-bootstrap
print Building native binary (Linux x86_64) (GraalVM)
exec native-image --no-fallback --static -O3 -jar build/tofu-java.jar -o build/tofu
print Packaging native binary
exec 7z a -mx5 -mmt0 build/tofu-linux-x86_64.zip build/tofu
end
if $0 == help
print Available options: light, scala, full, java, bootstrap
print " "
print light - lightweight JAR (requires Scala) (Uses Scala-CLI and 7zip instead of scalac)
print scala - lightweight JAR (requires Scala)
print java - assembly JAR (requires Java only)
print bootstrap - lightweight JAR with shell preamble (requires Scala) (is executed directly)
print full - portable executable (requires GraalVM to build)
print " "
print In absence of an option, a lightweight JAR and assembly JAR are built
stop
endif
if $0 == scala
call build-scala
stop
endif
if $0 == light
call build-scalacli
stop
endif
if $0 == full
call fullbuild
stop
endif
if $0 == java
call build-java
stop
endif
if $0 == bootstrap
call build-bootstrap
stop
endif
call build-scala
call build-java