Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] prepare web bundle data separately from build #71886

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ jobs:

- uses: mymindstorm/setup-emsdk@v14

- name: Prepare web data
run: ./build-scripts/prepare-web-data.sh

- name: Install ccache
run: |
emsdk install ccache-git-emscripten-64bit
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ jobs:
- name: Build CDDA (WebAssembly)
if: matrix.wasm
run: |
./build-scripts/prepare-web-data.sh
./build-scripts/build-emscripten.sh
./build-scripts/prepare-web.sh
(cd build && zip ../cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }} *)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ ifeq ($(NATIVE), emscripten)
CXXFLAGS += $(EMCC_COMMON_FLAGS)
LDFLAGS += $(EMCC_COMMON_FLAGS)

LDFLAGS += --preload-file web_bundle@/
LDFLAGS += -sFORCE_FILESYSTEM
LDFLAGS += -sEXPORTED_RUNTIME_METHODS=['FS','stackTrace','jsStackTrace']
LDFLAGS += -sINITIAL_MEMORY=512MB
LDFLAGS += -sMAXIMUM_MEMORY=4GB
Expand Down
1 change: 1 addition & 0 deletions build-data/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
e.preventDefault();
}
</script>
<script async type="text/javascript" src="cataclysm-tiles.data.js"></script>
<script async type="text/javascript" src="cataclysm-tiles.js"></script>
</body>
</html>
22 changes: 0 additions & 22 deletions build-scripts/prepare-web-data.sh

This file was deleted.

24 changes: 23 additions & 1 deletion build-scripts/prepare-web.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
#!/bin/bash
set -exo pipefail

rm -rf web_bundle

BUNDLE_DIR=web_bundle
DATA_DIR=$BUNDLE_DIR/data
mkdir -p $DATA_DIR
cp -R data/{core,font,fontdata.json,json,mods,names,raw,motd,credits,title,help} $DATA_DIR/
cp -R gfx $BUNDLE_DIR/

# Remove .DS_Store files.
find web_bundle -name ".DS_Store" -type f -exec rm {} \;

# Remove obsolete mods.
echo "Removing obsolete mods..."
for MOD_DIR in $DATA_DIR/mods/*/ ; do
if jq -e '.[] | select(.type == "MOD_INFO") | .obsolete' "$MOD_DIR/modinfo.json" >/dev/null; then
echo "$MOD_DIR is obsolete, excluding from web_bundle..."
rm -rf $MOD_DIR
fi
done

$EMSDK/upstream/emscripten/tools/file_packager cataclysm-tiles.data --js-output=cataclysm-tiles.data.js --no-node --preload "$BUNDLE_DIR""@/"

mkdir -p build/
cp \
build-data/web/index.html \
cataclysm-tiles.{data,js,wasm} \
cataclysm-tiles.{data,data.js,js,wasm} \
data/font/Terminus.ttf \
build
cp data/cataicon.ico build/favicon.ico
Loading