feat(client): 迁移Hub更新客户端实现
This commit is contained in:
+33
-28
@@ -5,11 +5,11 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
SOURCE_DIR="$REPO_ROOT/out/linux/bin"
|
||||
OUTPUT_DIR="$REPO_ROOT/dist/UpdateClientSDK-linux"
|
||||
ARCHIVE_FILE="$REPO_ROOT/dist/UpdateClientSDK-linux.tar.gz"
|
||||
OUTPUT_DIR="$REPO_ROOT/dist/SimCAEHubUpdateClientSDK-linux"
|
||||
ARCHIVE_FILE="$REPO_ROOT/dist/SimCAEHubUpdateClientSDK-linux.tar.gz"
|
||||
SDK_VERSION="0.1.0"
|
||||
EXAMPLE_CONFIG="$REPO_ROOT/config/app_config.linux.example.json"
|
||||
INCLUDE_DEMO_MAIN_APP=0
|
||||
INCLUDE_QT_RUNTIME=0
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
@@ -17,11 +17,11 @@ Usage: package-sdk.sh [options]
|
||||
|
||||
Options:
|
||||
--source-dir DIR Linux Release output directory. Default: ./out/linux/bin
|
||||
--output-dir DIR SDK directory to generate. Default: ./dist/UpdateClientSDK-linux
|
||||
--archive FILE SDK tar.gz path. Default: ./dist/UpdateClientSDK-linux.tar.gz
|
||||
--output-dir DIR SDK directory to generate. Default: ./dist/SimCAEHubUpdateClientSDK-linux
|
||||
--archive FILE SDK tar.gz path. Default: ./dist/SimCAEHubUpdateClientSDK-linux.tar.gz
|
||||
--sdk-version VERSION SDK version. Default: 0.1.0
|
||||
--example-config FILE app_config template. Default: ./config/app_config.linux.example.json
|
||||
--include-demo-mainapp Include MainApp demo executable in SDK bin.
|
||||
--include-qt-runtime Include Qt runtime files from the Release output directory.
|
||||
-h, --help Show this help.
|
||||
EOF
|
||||
}
|
||||
@@ -32,15 +32,14 @@ while [[ $# -gt 0 ]]; do
|
||||
--output-dir) OUTPUT_DIR="$2"; shift 2 ;;
|
||||
--archive|--tar-file|--zip-file) ARCHIVE_FILE="$2"; shift 2 ;;
|
||||
--sdk-version) SDK_VERSION="$2"; shift 2 ;;
|
||||
--example-config) EXAMPLE_CONFIG="$2"; shift 2 ;;
|
||||
--include-demo-mainapp) INCLUDE_DEMO_MAIN_APP=1; shift ;;
|
||||
--include-qt-runtime) INCLUDE_QT_RUNTIME=1; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) echo "Unknown option: $1" >&2; usage >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
SOURCE_DIR="$(realpath "$SOURCE_DIR")"
|
||||
EXAMPLE_CONFIG="$(realpath "$EXAMPLE_CONFIG")"
|
||||
OUTPUT_DIR="$(realpath -m "$OUTPUT_DIR")"
|
||||
ARCHIVE_FILE="$(realpath -m "$ARCHIVE_FILE")"
|
||||
|
||||
@@ -51,21 +50,6 @@ for name in Launcher Updater Bootstrap; do
|
||||
fi
|
||||
done
|
||||
|
||||
PUBLIC_KEY=""
|
||||
for candidate in \
|
||||
"$SOURCE_DIR/config/manifest_public_key.pem" \
|
||||
"$SOURCE_DIR/manifest_public_key.pem" \
|
||||
"$REPO_ROOT/config/manifest_public_key.pem"; do
|
||||
if [[ -f "$candidate" ]]; then
|
||||
PUBLIC_KEY="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z "$PUBLIC_KEY" ]]; then
|
||||
echo "manifest_public_key.pem is missing. Prepare the public key that matches the server signing private key." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEBUG_ARTIFACT="$(find "$SOURCE_DIR" -type f \( -name '*.pdb' -o -name '*.ilk' -o -name '*d.dll' \) -print -quit)"
|
||||
if [[ -n "$DEBUG_ARTIFACT" ]]; then
|
||||
echo "SDK source directory contains Debug artifacts. Use a clean Release output directory." >&2
|
||||
@@ -76,6 +60,21 @@ fi
|
||||
rm -rf "$OUTPUT_DIR"
|
||||
mkdir -p "$OUTPUT_DIR/bin" "$OUTPUT_DIR/config" "$OUTPUT_DIR/scripts" "$OUTPUT_DIR/Common" "$OUTPUT_DIR/Docs"
|
||||
|
||||
is_qt_runtime_item() {
|
||||
local base="$1"
|
||||
case "$base" in
|
||||
bearer|iconengines|imageformats|platforms|styles|translations)
|
||||
return 0
|
||||
;;
|
||||
libQt5*.so*|libEGL.so*|libGLESv2.so*|libqxcb.so*|libxcb*.so*|libstdc++.so*|libgcc_s.so*|libssl.so*|libcrypto.so*|opengl32sw.dll|d3dcompiler_47.dll)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
shopt -s dotglob nullglob
|
||||
for item in "$SOURCE_DIR"/*; do
|
||||
base="$(basename "$item")"
|
||||
@@ -86,16 +85,16 @@ for item in "$SOURCE_DIR"/*; do
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [[ "$INCLUDE_QT_RUNTIME" -eq 0 ]] && is_qt_runtime_item "$base"; then
|
||||
continue
|
||||
fi
|
||||
cp -a "$item" "$OUTPUT_DIR/bin/"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shopt -u dotglob nullglob
|
||||
|
||||
cp "$EXAMPLE_CONFIG" "$OUTPUT_DIR/config/app_config.json"
|
||||
cp "$PUBLIC_KEY" "$OUTPUT_DIR/config/manifest_public_key.pem"
|
||||
|
||||
for common_file in ConfigHelper.h ConfigHelper.cpp TicketHelper.h TicketHelper.cpp; do
|
||||
for common_file in ConfigHelper.h ConfigHelper.cpp IntegrityHelper.h IntegrityHelper.cpp TicketHelper.h TicketHelper.cpp UpdatePathPolicy.h UpdatePathPolicy.cpp; do
|
||||
common_path="$REPO_ROOT/Common/$common_file"
|
||||
if [[ ! -f "$common_path" ]]; then
|
||||
echo "SDK Common integration source is missing: $common_path" >&2
|
||||
@@ -134,13 +133,19 @@ cat > "$OUTPUT_DIR/sdk_manifest.json" <<EOF
|
||||
"platform": "linux",
|
||||
"required_entry": "Launcher",
|
||||
"contains_demo_main_app": $([[ "$INCLUDE_DEMO_MAIN_APP" -eq 1 ]] && echo true || echo false),
|
||||
"contains_qt_runtime": $([[ "$INCLUDE_QT_RUNTIME" -eq 1 ]] && echo true || echo false),
|
||||
"contains_final_config": false,
|
||||
"docs_entry": "Docs/01-客户端接入打包部署指南.md",
|
||||
"word_guide_included": $WORD_GUIDE_INCLUDED,
|
||||
"integration_sources": [
|
||||
"ConfigHelper.h",
|
||||
"ConfigHelper.cpp",
|
||||
"IntegrityHelper.h",
|
||||
"IntegrityHelper.cpp",
|
||||
"TicketHelper.h",
|
||||
"TicketHelper.cpp"
|
||||
"TicketHelper.cpp",
|
||||
"UpdatePathPolicy.h",
|
||||
"UpdatePathPolicy.cpp"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user