forked from WebKit/JetStream
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·33 lines (29 loc) · 1.53 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·33 lines (29 loc) · 1.53 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
#!/bin/bash
J2CL_REV=fbbe1e6db2928179f5e747ae382266beb3d2db38
set -eo pipefail
# Cleanup old files.
rm -rf build/
rm -rf j2cl/
BUILD_LOG="$(realpath build.log)"
echo -e "Built on $(date --rfc-3339=seconds)" | tee "$BUILD_LOG"
# Build the benchmark from source.
git clone https://github.com/google/j2cl.git |& tee -a "$BUILD_LOG"
pushd j2cl/
git checkout $J2CL_REV
git log -1 --oneline | tee -a "$BUILD_LOG"
git apply ../add-fixed-run-count-api.patch | tee -a "$BUILD_LOG"
BUILD_SRC_DIR="benchmarking/java/com/google/j2cl/benchmarks/octane/"
pushd "$BUILD_SRC_DIR"
bazel build //benchmarking/java/com/google/j2cl/benchmarks/octane:Box2dBenchmark_local-j2wasm-v8
popd
popd
echo "Copying generated files into build/" | tee -a "$BUILD_LOG"
mkdir -p build/ | tee -a "$BUILD_LOG"
BUILD_OUT_DIR="j2cl/bazel-bin/$BUILD_SRC_DIR"
cp $BUILD_OUT_DIR/Box2dBenchmark_j2wasm_entry.js build/ | tee -a "$BUILD_LOG"
# FIXME: Remove this workaround, once Safari/JSC implements JS-string builtins.
# Since these imports/builtins are never called in the workload, they should not have any effect on runtime.
sed -i 's/imports:/"wasm:js-string":{fromCharCodeArray:unused_import,concat:unused_import,equals:unused_import,compare:unused_import,length:unused_import,charCodeAt:unused_import,substring:unused_import},imports:/g' build/Box2dBenchmark_j2wasm_entry.js
cp $BUILD_OUT_DIR/Box2dBenchmark_j2wasm_binary.wasm build/ | tee -a "$BUILD_LOG"
cp $BUILD_OUT_DIR/Box2dBenchmark_j2wasm_binary.binaryen.symbolmap build/ | tee -a "$BUILD_LOG"
echo "Build success" | tee -a "$BUILD_LOG"