-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdev_build_web.sh
More file actions
51 lines (41 loc) · 2.64 KB
/
Copy pathdev_build_web.sh
File metadata and controls
51 lines (41 loc) · 2.64 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
#!/bin/bash
# Download bob.jar as described at https://defold.com/manuals/bob/.
# Plus, the script uses https://www.npmjs.com/package/http-server to serve local files.
set -e
PLATFORM=wasm-web
LIVEUPDATE_INI="liveupdate.generated.settings"
RESZIP_INI="reszip.ini"
cleanup() {
rm -f "${RESZIP_INI}" "${LIVEUPDATE_INI}"
sed -i 's/"enabled", true/"enabled", false/' example/level2/set_alt_text.script
}
trap cleanup EXIT
mkdir -p public
# BUNDLE 1
BUNDLE_DIR=bundle-1
RESOURCES_ZIP="resources_$(date +%s).zip"
echo -e "[liveupdate]\nsettings = /${LIVEUPDATE_INI}\n\n[liveupdate_reszip]\nfilename = ${RESOURCES_ZIP}\npreload_file = ${RESOURCES_ZIP}\n\n" > "${RESZIP_INI}"
echo -e "[liveupdate]\nmode = Zip\nzip-filepath = build/liveupdate_output\nzip-filename = ${RESOURCES_ZIP}\nsave-zip-in-bundle-folder = 1\npublickey = liveupdate_public.der\nprivatekey = liveupdate_private.der\n\n" > "${LIVEUPDATE_INI}"
sed -i 's/"enabled", true/"enabled", false/' example/level2/set_alt_text.script
rm -rf build
rm -rf "dist/${BUNDLE_DIR}"
mkdir -p "dist/${BUNDLE_DIR}"
java -jar bob.jar --email f@b.com --auth 123 --texture-compression true --settings "${RESZIP_INI}" --bundle-output "dist/${BUNDLE_DIR}/${PLATFORM}" --build-report-html "dist/${BUNDLE_DIR}/build_report_${BUNDLE_DIR}.html" --platform ${PLATFORM} --architectures ${PLATFORM} --archive --liveupdate yes --variant debug resolve build bundle
mv "dist/${BUNDLE_DIR}"/*.html "public/"
rm -rf "public/${BUNDLE_DIR}"
cp -R "dist/${BUNDLE_DIR}/${PLATFORM}/liveupdate_reszip_demo" "public/${BUNDLE_DIR}"
# BUNDLE 2
BUNDLE_DIR=bundle-2
RESOURCES_ZIP="resources_$(date +%s).zip"
echo -e "[liveupdate]\nsettings = /${LIVEUPDATE_INI}\n\n[liveupdate_reszip]\nfilename = ${RESOURCES_ZIP}\npreload_file = ${RESOURCES_ZIP}\n\n" > "${RESZIP_INI}"
echo -e "[liveupdate]\nmode = Zip\nzip-filepath = build/liveupdate_output\nzip-filename = ${RESOURCES_ZIP}\nsave-zip-in-bundle-folder = 1\npublickey = liveupdate_public.der\nprivatekey = liveupdate_private.der\n\n" > "${LIVEUPDATE_INI}"
sed -i 's/"enabled", false/"enabled", true/' example/level2/set_alt_text.script
rm -rf build
rm -rf "dist/${BUNDLE_DIR}"
mkdir -p "dist/${BUNDLE_DIR}"
java -jar bob.jar --email f@b.com --auth 123 --texture-compression true --settings "${RESZIP_INI}" --bundle-output "dist/${BUNDLE_DIR}/${PLATFORM}" --build-report-html "dist/${BUNDLE_DIR}/build_report_${BUNDLE_DIR}.html" --platform ${PLATFORM} --architectures ${PLATFORM} --archive --liveupdate yes --variant debug resolve build bundle
mv "dist/${BUNDLE_DIR}"/*.html "public/"
rm -rf "public/${BUNDLE_DIR}"
cp -R "dist/${BUNDLE_DIR}/${PLATFORM}/liveupdate_reszip_demo" "public/${BUNDLE_DIR}"
# DONE
# http-server -c-