同步主站 Cocos 当前工程:关卡资源、运行脚本与打包工具。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# 将运行时包同步到 scratch-gui/static/unity/
|
||||
# 与 OSS unitycdndir 内容完全一致:Build/ + StreamingAssets/ + levels-database.*
|
||||
# 与 OSS unitycdndir 内容完全一致:Build/ + StreamingAssets/ + levels-db-index.*
|
||||
#
|
||||
# bash tools/sync-unity-package-to-static.sh <packDir> <staticUnityDir>
|
||||
set -euo pipefail
|
||||
@@ -13,8 +13,8 @@ if [[ ! -f "$PACK_DIR/Build/mstest5.loader.js" ]]; then
|
||||
echo "错误: 缺少 $PACK_DIR/Build/mstest5.loader.js" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$PACK_DIR/StreamingAssets/aa/catalog.json" ]]; then
|
||||
echo "错误: 缺少 $PACK_DIR/StreamingAssets/aa/catalog.json" >&2
|
||||
if [[ ! -f "$PACK_DIR/StreamingAssets/aa/catalog.json" && ! -f "$PACK_DIR/StreamingAssets/aa/catalog.json.br" ]]; then
|
||||
echo "错误: 缺少 $PACK_DIR/StreamingAssets/aa/catalog.json(.br)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -30,7 +30,7 @@ echo " 目标: $UNITY_STATIC"
|
||||
rsync "${RSYNC_FLAGS[@]}" "$PACK_DIR/Build/" "$UNITY_STATIC/Build/"
|
||||
rsync "${RSYNC_FLAGS[@]}" "$PACK_DIR/StreamingAssets/" "$UNITY_STATIC/StreamingAssets/"
|
||||
|
||||
for db in levels-database.json levels-database.json.br; do
|
||||
for db in levels-db-index.json levels-db-index.json.br levels-database.json levels-database.json.br; do
|
||||
if [[ -f "$PACK_DIR/$db" ]]; then
|
||||
if [[ "$DRY_RUN" -eq 1 ]]; then
|
||||
echo " [dry-run] cp $PACK_DIR/$db → $UNITY_STATIC/"
|
||||
@@ -40,6 +40,15 @@ for db in levels-database.json levels-database.json.br; do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# 全量库已默认不打进包;清掉 static 里旧的大文件
|
||||
if [[ "$DRY_RUN" -eq 0 ]]; then
|
||||
for stale in levels-database.json levels-database.json.br; do
|
||||
if [[ ! -f "$PACK_DIR/$stale" && -f "$UNITY_STATIC/$stale" ]]; then
|
||||
rm -f "$UNITY_STATIC/$stale"
|
||||
echo " removed stale $stale"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$DRY_RUN" -eq 0 ]]; then
|
||||
for legacy in index.js application.js cocos-bridge.js assets cocos-js src index.html TemplateData; do
|
||||
|
||||
Reference in New Issue
Block a user