-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·36 lines (27 loc) · 1.04 KB
/
build.sh
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
#!/bin/bash
set -eu -o pipefail
echo Adventure
echo =========
echo
echo Build target: ./build/
mkdir -p build || true
echo Running Java tests...
mvn test > /dev/null
echo Building GWT output...
mvn package > /dev/null
rm -rf build/web/ || true
cp -R com.grack.adventure.web/war/ build/web/
echo Building JSR package...
rm -rf build/jsr/ || true
cp -R package/ build/jsr/
cp com.grack.adventure.web/war/adventure/*.cache.js /tmp/__adventure.js
deno eval 'const adventure={ onScriptDownloaded: (x) => Deno.writeTextFileSync("/tmp/__adventure.js", x.join("\n")) }; eval(Deno.readTextFileSync("/tmp/__adventure.js"))'
cat <(awk '/__DEV_MODE__/ {exit} {print}' package/acode.js) /tmp/__adventure.js > build/jsr/acode.js
echo '// base64-encoded ADVENTURE.ACODE' > build/jsr/script.js
echo 'export const defaultScriptText = atob(`' >> build/jsr/script.js
base64 < com.grack.adventure.web/war/ADVENTURE.ACODE >> build/jsr/script.js
echo '`);' >> build/jsr/script.js
echo Testing JSR package...
deno test -A build/jsr/ 2>/dev/null > /dev/null
echo
echo Done\!