feat: 支持 Linux 客户端打包与跨平台运行
This commit is contained in:
+26
-2
@@ -6,14 +6,20 @@
|
||||
脚本列表:
|
||||
|
||||
1. package-sdk.ps1
|
||||
生成给其他软件接入用的 UpdateClientSDK 包。
|
||||
在 Windows 上生成给其他软件接入用的 UpdateClientSDK 包。
|
||||
|
||||
2. package-client.ps1
|
||||
生成某个具体产品的最终客户端发布包。
|
||||
在 Windows 上生成某个具体产品的最终客户端发布包。
|
||||
|
||||
3. install-sdk.ps1
|
||||
将 SDK 运行时复制到业务软件 Release 目录。
|
||||
|
||||
4. package-sdk.sh
|
||||
在 Linux 上生成给其他软件接入用的 UpdateClientSDK 包,输出 tar.gz。
|
||||
|
||||
5. package-client.sh
|
||||
在 Linux 上生成某个具体产品的最终客户端发布包,输出 tar.gz。
|
||||
|
||||
推荐在 update-client 根目录执行:
|
||||
|
||||
```powershell
|
||||
@@ -31,3 +37,21 @@
|
||||
-OutputDir .\dist\UpdateClient `
|
||||
-ZipFile .\dist\UpdateClient.zip
|
||||
```
|
||||
|
||||
Linux 示例:
|
||||
|
||||
```bash
|
||||
bash ./scripts/package-sdk.sh \
|
||||
--source-dir ./out/linux/bin \
|
||||
--output-dir ./dist/UpdateClientSDK-linux \
|
||||
--archive ./dist/UpdateClientSDK-linux.tar.gz \
|
||||
--sdk-version 0.1.0
|
||||
```
|
||||
|
||||
```bash
|
||||
bash ./scripts/package-client.sh \
|
||||
--source-dir /path/to/SimCAE \
|
||||
--config-file /path/to/SimCAE/bin/config/app_config.json \
|
||||
--output-dir ./dist/UpdateClient-linux \
|
||||
--archive ./dist/UpdateClient-linux.tar.gz
|
||||
```
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
SOURCE_DIR="$REPO_ROOT/out/linux/bin"
|
||||
CONFIG_FILE=""
|
||||
OUTPUT_DIR="$REPO_ROOT/dist/UpdateClient-linux"
|
||||
ARCHIVE_FILE="$REPO_ROOT/dist/UpdateClient-linux.tar.gz"
|
||||
SKIP_MANIFEST_CHECK=0
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: package-client.sh --config-file FILE [options]
|
||||
|
||||
Options:
|
||||
--source-dir DIR Release/install root to package. Default: ./out/linux/bin
|
||||
--config-file FILE app_config.json used by this client package. Required.
|
||||
--output-dir DIR Output directory. Default: ./dist/UpdateClient-linux
|
||||
--archive FILE Output tar.gz. Default: ./dist/UpdateClient-linux.tar.gz
|
||||
--skip-manifest-check Skip current-version manifest cache check.
|
||||
-h, --help Show this help.
|
||||
EOF
|
||||
}
|
||||
|
||||
normalize_relative_path() {
|
||||
local value="${1:-}"
|
||||
value="${value//\\//}"
|
||||
value="${value#/}"
|
||||
value="${value%/}"
|
||||
printf '%s' "$value"
|
||||
}
|
||||
|
||||
join_relative_path() {
|
||||
local base
|
||||
local child
|
||||
base="$(normalize_relative_path "${1:-}")"
|
||||
child="$(normalize_relative_path "${2:-}")"
|
||||
if [[ -z "$base" ]]; then printf '%s' "$child"; return; fi
|
||||
if [[ -z "$child" ]]; then printf '%s' "$base"; return; fi
|
||||
printf '%s/%s' "$base" "$child"
|
||||
}
|
||||
|
||||
json_value() {
|
||||
python3 - "$CONFIG_FILE" "$1" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
with open(sys.argv[1], "r", encoding="utf-8-sig") as f:
|
||||
data = json.load(f)
|
||||
value = data.get(sys.argv[2], "")
|
||||
print("" if value is None else value)
|
||||
PY
|
||||
}
|
||||
|
||||
relative_to_source() {
|
||||
local full="$1"
|
||||
local fallback="$2"
|
||||
python3 - "$SOURCE_DIR" "$full" "$fallback" <<'PY'
|
||||
import os
|
||||
import sys
|
||||
source = os.path.realpath(sys.argv[1])
|
||||
full = os.path.realpath(sys.argv[2])
|
||||
fallback = sys.argv[3]
|
||||
try:
|
||||
rel = os.path.relpath(full, source)
|
||||
except ValueError:
|
||||
rel = fallback
|
||||
if rel.startswith(".."):
|
||||
rel = fallback
|
||||
print(rel.replace(os.sep, "/").strip("/"))
|
||||
PY
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--source-dir) SOURCE_DIR="$2"; shift 2 ;;
|
||||
--config-file) CONFIG_FILE="$2"; shift 2 ;;
|
||||
--output-dir) OUTPUT_DIR="$2"; shift 2 ;;
|
||||
--archive|--tar-file|--zip-file) ARCHIVE_FILE="$2"; shift 2 ;;
|
||||
--skip-manifest-check) SKIP_MANIFEST_CHECK=1; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) echo "Unknown option: $1" >&2; usage >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$CONFIG_FILE" ]]; then
|
||||
echo "--config-file is required." >&2
|
||||
usage >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
SOURCE_DIR="$(realpath "$SOURCE_DIR")"
|
||||
CONFIG_FILE="$(realpath "$CONFIG_FILE")"
|
||||
OUTPUT_DIR="$(realpath -m "$OUTPUT_DIR")"
|
||||
ARCHIVE_FILE="$(realpath -m "$ARCHIVE_FILE")"
|
||||
|
||||
for field in app_id channel api_base_url current_version client_token launch_token license_key main_executable launcher_executable updater_executable bootstrap_executable; do
|
||||
if [[ -z "$(json_value "$field")" ]]; then
|
||||
echo "Config file is missing required field: $field" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
CONFIG_RELATIVE_PATH="$(relative_to_source "$CONFIG_FILE" "config/app_config.json")"
|
||||
CONFIG_RELATIVE_PARENT="$(dirname "$CONFIG_RELATIVE_PATH")"
|
||||
[[ "$CONFIG_RELATIVE_PARENT" == "." ]] && CONFIG_RELATIVE_PARENT=""
|
||||
RUNTIME_DIR_RELATIVE="$(normalize_relative_path "$(dirname "$CONFIG_RELATIVE_PARENT")")"
|
||||
[[ "$RUNTIME_DIR_RELATIVE" == "." ]] && RUNTIME_DIR_RELATIVE=""
|
||||
|
||||
MAIN_EXECUTABLE="$(normalize_relative_path "$(json_value main_executable)")"
|
||||
LAUNCHER_EXECUTABLE="$(normalize_relative_path "$(json_value launcher_executable)")"
|
||||
UPDATER_EXECUTABLE="$(normalize_relative_path "$(json_value updater_executable)")"
|
||||
BOOTSTRAP_EXECUTABLE="$(normalize_relative_path "$(json_value bootstrap_executable)")"
|
||||
CURRENT_VERSION="$(json_value current_version)"
|
||||
|
||||
for required in \
|
||||
"$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$MAIN_EXECUTABLE")" \
|
||||
"$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$LAUNCHER_EXECUTABLE")" \
|
||||
"$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$UPDATER_EXECUTABLE")" \
|
||||
"$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$BOOTSTRAP_EXECUTABLE")"; do
|
||||
if [[ ! -f "$SOURCE_DIR/$required" ]]; then
|
||||
echo "Source directory is missing required file: $required" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
DEBUG_ARTIFACT="$(find "$SOURCE_DIR" -type f \( -name '*.pdb' -o -name '*.ilk' -o -name '*d.dll' \) -print -quit)"
|
||||
if [[ -n "$DEBUG_ARTIFACT" ]]; then
|
||||
echo "Source directory contains Debug artifacts. Use a clean Release root directory." >&2
|
||||
echo "Example: $DEBUG_ARTIFACT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EXPECTED_MAIN_PATH="$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$MAIN_EXECUTABLE")"
|
||||
MAIN_LEAF="$(basename "$MAIN_EXECUTABLE")"
|
||||
DUPLICATE_MAIN="$({ find "$SOURCE_DIR" -type f -name "$MAIN_LEAF" | while read -r item; do
|
||||
rel="$(python3 - "$SOURCE_DIR" "$item" <<'PY'
|
||||
import os, sys
|
||||
print(os.path.relpath(os.path.realpath(sys.argv[2]), os.path.realpath(sys.argv[1])).replace(os.sep, "/"))
|
||||
PY
|
||||
)"
|
||||
[[ "$rel" != "$EXPECTED_MAIN_PATH" ]] && { echo "$item"; break; }
|
||||
done; } || true)"
|
||||
if [[ -n "$DUPLICATE_MAIN" ]]; then
|
||||
echo "Source directory contains a duplicate main executable outside $EXPECTED_MAIN_PATH: $DUPLICATE_MAIN" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MANIFEST_NAME="manifest_${CURRENT_VERSION}.json"
|
||||
SOURCE_MANIFEST="$SOURCE_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "update/manifest_cache/$MANIFEST_NAME")"
|
||||
if [[ ! -f "$SOURCE_MANIFEST" && -f "$SOURCE_DIR/update/manifest_cache/$MANIFEST_NAME" ]]; then
|
||||
SOURCE_MANIFEST="$SOURCE_DIR/update/manifest_cache/$MANIFEST_NAME"
|
||||
fi
|
||||
if [[ "$SKIP_MANIFEST_CHECK" -eq 0 && ! -f "$SOURCE_MANIFEST" ]]; then
|
||||
echo "Missing signed Manifest cache for current version: $SOURCE_MANIFEST. Complete online update/verification for this version before packaging." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$OUTPUT_DIR"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
shopt -s dotglob nullglob
|
||||
for item in "$SOURCE_DIR"/*; do
|
||||
base="$(basename "$item")"
|
||||
case "$base" in
|
||||
update|update_temp) ;;
|
||||
*) cp -a "$item" "$OUTPUT_DIR/" ;;
|
||||
esac
|
||||
done
|
||||
shopt -u dotglob nullglob
|
||||
|
||||
rm -rf "$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "update")"
|
||||
rm -rf "$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "update_temp")"
|
||||
|
||||
OUTPUT_CONFIG_PATH="$OUTPUT_DIR/$CONFIG_RELATIVE_PATH"
|
||||
mkdir -p "$(dirname "$OUTPUT_CONFIG_PATH")"
|
||||
cp "$CONFIG_FILE" "$OUTPUT_CONFIG_PATH"
|
||||
rm -f "$(dirname "$OUTPUT_CONFIG_PATH")/client_identity.dat" \
|
||||
"$(dirname "$OUTPUT_CONFIG_PATH")/local_state.json" \
|
||||
"$(dirname "$OUTPUT_CONFIG_PATH")/version_policy.dat"
|
||||
|
||||
if [[ -f "$SOURCE_MANIFEST" ]]; then
|
||||
MANIFEST_DIR="$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "update/manifest_cache")"
|
||||
mkdir -p "$MANIFEST_DIR"
|
||||
cp "$SOURCE_MANIFEST" "$MANIFEST_DIR/$MANIFEST_NAME"
|
||||
fi
|
||||
|
||||
chmod +x "$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$LAUNCHER_EXECUTABLE")" \
|
||||
"$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$UPDATER_EXECUTABLE")" \
|
||||
"$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$BOOTSTRAP_EXECUTABLE")" \
|
||||
"$OUTPUT_DIR/$(join_relative_path "$RUNTIME_DIR_RELATIVE" "$MAIN_EXECUTABLE")" 2>/dev/null || true
|
||||
|
||||
mkdir -p "$(dirname "$ARCHIVE_FILE")"
|
||||
rm -f "$ARCHIVE_FILE"
|
||||
tar -C "$OUTPUT_DIR" -czf "$ARCHIVE_FILE" .
|
||||
|
||||
echo "Package directory: $OUTPUT_DIR"
|
||||
echo "Archive file: $ARCHIVE_FILE"
|
||||
+27
-10
@@ -56,10 +56,11 @@ if ($debugArtifacts) {
|
||||
if (Test-Path $OutputDir) { Remove-Item $OutputDir -Recurse -Force }
|
||||
New-Item $OutputDir -ItemType Directory -Force | Out-Null
|
||||
|
||||
$binDir = Join-Path $OutputDir "bin"
|
||||
$configDir = Join-Path $OutputDir "config"
|
||||
$scriptsDir = Join-Path $OutputDir "scripts"
|
||||
New-Item $binDir,$configDir,$scriptsDir -ItemType Directory -Force | Out-Null
|
||||
$binDir = Join-Path $OutputDir "bin"
|
||||
$configDir = Join-Path $OutputDir "config"
|
||||
$scriptsDir = Join-Path $OutputDir "scripts"
|
||||
$commonDir = Join-Path $OutputDir "Common"
|
||||
New-Item $binDir,$configDir,$scriptsDir,$commonDir -ItemType Directory -Force | Out-Null
|
||||
|
||||
$excludedTopLevel = @("config", "update", "update_temp", "manifest_public_key.pem")
|
||||
if (-not $IncludeDemoMainApp) { $excludedTopLevel += "MainApp.exe" }
|
||||
@@ -97,8 +98,23 @@ Get-ChildItem $source -Force | Where-Object {
|
||||
$_.Name -notin $excludedTopLevel -and -not (Test-IsQtRuntimeFile $_)
|
||||
} | Copy-Item -Destination $binDir -Recurse -Force
|
||||
|
||||
Copy-Item $exampleConfigPath (Join-Path $configDir "app_config.json") -Force
|
||||
Copy-Item $publicKey (Join-Path $configDir "manifest_public_key.pem") -Force
|
||||
Copy-Item $exampleConfigPath (Join-Path $configDir "app_config.json") -Force
|
||||
Copy-Item $publicKey (Join-Path $configDir "manifest_public_key.pem") -Force
|
||||
|
||||
$commonSourceDir = Join-Path $RepoRoot "Common"
|
||||
$commonSourceFiles = @(
|
||||
"ConfigHelper.h",
|
||||
"ConfigHelper.cpp",
|
||||
"TicketHelper.h",
|
||||
"TicketHelper.cpp"
|
||||
)
|
||||
foreach ($commonFile in $commonSourceFiles) {
|
||||
$commonPath = Join-Path $commonSourceDir $commonFile
|
||||
if (-not (Test-Path $commonPath)) {
|
||||
throw "SDK Common integration source is missing: $commonPath"
|
||||
}
|
||||
Copy-Item $commonPath (Join-Path $commonDir $commonFile) -Force
|
||||
}
|
||||
|
||||
$wordGuideSource = @($RepoRoot, (Join-Path $RepoRoot "Docs")) |
|
||||
Where-Object { Test-Path $_ } |
|
||||
@@ -118,10 +134,11 @@ Copy-Item (Join-Path $PSScriptRoot "install-sdk.ps1") (Join-Path $scriptsDir "in
|
||||
@{
|
||||
sdk_version = $SdkVersion
|
||||
generated_at = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
||||
sdk_type = "external-updater-runtime"
|
||||
required_entry = "Launcher.exe"
|
||||
contains_demo_main_app = [bool]$IncludeDemoMainApp
|
||||
} | ConvertTo-Json -Depth 3 | Set-Content (Join-Path $OutputDir "sdk_manifest.json") -Encoding UTF8
|
||||
sdk_type = "external-updater-runtime"
|
||||
required_entry = "Launcher.exe"
|
||||
contains_demo_main_app = [bool]$IncludeDemoMainApp
|
||||
integration_sources = $commonSourceFiles
|
||||
} | ConvertTo-Json -Depth 3 | Set-Content (Join-Path $OutputDir "sdk_manifest.json") -Encoding UTF8
|
||||
|
||||
$zipParent = Split-Path $ZipFile -Parent
|
||||
New-Item $zipParent -ItemType Directory -Force | Out-Null
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
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"
|
||||
SDK_VERSION="0.1.0"
|
||||
EXAMPLE_CONFIG="$REPO_ROOT/config/app_config.linux.example.json"
|
||||
INCLUDE_DEMO_MAIN_APP=0
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
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
|
||||
--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.
|
||||
-h, --help Show this help.
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--source-dir) SOURCE_DIR="$2"; shift 2 ;;
|
||||
--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 ;;
|
||||
-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")"
|
||||
|
||||
for name in Launcher Updater Bootstrap; do
|
||||
if [[ ! -f "$SOURCE_DIR/$name" ]]; then
|
||||
echo "SDK source directory is missing required file: $SOURCE_DIR/$name" >&2
|
||||
exit 1
|
||||
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
|
||||
echo "Example: $DEBUG_ARTIFACT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$OUTPUT_DIR"
|
||||
mkdir -p "$OUTPUT_DIR/bin" "$OUTPUT_DIR/config" "$OUTPUT_DIR/scripts" "$OUTPUT_DIR/Common"
|
||||
|
||||
shopt -s dotglob nullglob
|
||||
for item in "$SOURCE_DIR"/*; do
|
||||
base="$(basename "$item")"
|
||||
case "$base" in
|
||||
config|update|update_temp|manifest_public_key.pem|MainApp)
|
||||
if [[ "$base" == "MainApp" && "$INCLUDE_DEMO_MAIN_APP" -eq 1 ]]; then
|
||||
cp -a "$item" "$OUTPUT_DIR/bin/"
|
||||
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
|
||||
common_path="$REPO_ROOT/Common/$common_file"
|
||||
if [[ ! -f "$common_path" ]]; then
|
||||
echo "SDK Common integration source is missing: $common_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp "$common_path" "$OUTPUT_DIR/Common/$common_file"
|
||||
done
|
||||
|
||||
WORD_GUIDE="$(find "$REPO_ROOT" "$REPO_ROOT/Docs" -maxdepth 1 -type f -name '*SDK*.docx' ! -name '~$*' 2>/dev/null | sort | sed -n '1p')"
|
||||
if [[ -z "$WORD_GUIDE" ]]; then
|
||||
echo "SDK integration Word guide is missing. Expected a *SDK*.docx file in the repository root or Docs directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
cp "$WORD_GUIDE" "$OUTPUT_DIR/$(basename "$WORD_GUIDE")"
|
||||
|
||||
cp "$SCRIPT_DIR/package-sdk.sh" "$OUTPUT_DIR/scripts/package-sdk.sh"
|
||||
cp "$SCRIPT_DIR/package-client.sh" "$OUTPUT_DIR/scripts/package-client.sh"
|
||||
if [[ -f "$SCRIPT_DIR/install-sdk.ps1" ]]; then cp "$SCRIPT_DIR/install-sdk.ps1" "$OUTPUT_DIR/scripts/install-sdk.ps1"; fi
|
||||
if [[ -f "$SCRIPT_DIR/package-sdk.ps1" ]]; then cp "$SCRIPT_DIR/package-sdk.ps1" "$OUTPUT_DIR/scripts/package-sdk.ps1"; fi
|
||||
if [[ -f "$SCRIPT_DIR/package-client.ps1" ]]; then cp "$SCRIPT_DIR/package-client.ps1" "$OUTPUT_DIR/scripts/package-client.ps1"; fi
|
||||
|
||||
chmod +x "$OUTPUT_DIR/bin/Launcher" "$OUTPUT_DIR/bin/Updater" "$OUTPUT_DIR/bin/Bootstrap" 2>/dev/null || true
|
||||
chmod +x "$OUTPUT_DIR/scripts/package-sdk.sh" "$OUTPUT_DIR/scripts/package-client.sh"
|
||||
|
||||
cat > "$OUTPUT_DIR/sdk_manifest.json" <<EOF
|
||||
{
|
||||
"sdk_version": "$SDK_VERSION",
|
||||
"generated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"sdk_type": "external-updater-runtime",
|
||||
"platform": "linux",
|
||||
"required_entry": "Launcher",
|
||||
"contains_demo_main_app": $([[ "$INCLUDE_DEMO_MAIN_APP" -eq 1 ]] && echo true || echo false),
|
||||
"integration_sources": [
|
||||
"ConfigHelper.h",
|
||||
"ConfigHelper.cpp",
|
||||
"TicketHelper.h",
|
||||
"TicketHelper.cpp"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
mkdir -p "$(dirname "$ARCHIVE_FILE")"
|
||||
rm -f "$ARCHIVE_FILE"
|
||||
tar -C "$OUTPUT_DIR" -czf "$ARCHIVE_FILE" .
|
||||
|
||||
echo "SDK directory: $OUTPUT_DIR"
|
||||
echo "SDK archive: $ARCHIVE_FILE"
|
||||
echo "SDK version: $SDK_VERSION"
|
||||
Reference in New Issue
Block a user