Fix hosted engine Rust and web SDK setup

This commit is contained in:
Tony
2026-06-26 02:50:49 +08:00
parent 6804b8e9a8
commit 228a23fa6b
4 changed files with 106 additions and 13 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HOST_CONFIG="${1:-linux-x64}"
DART_SDK_SOURCE="${DART_SDK_SOURCE:-$ROOT/dart-sdk/tools/sdks/dart-sdk}"
TARGET="$ROOT/flutter/engine/src/flutter/prebuilts/$HOST_CONFIG/dart-sdk"
relative_path() {
python3 - "$1" "$2" <<'PY'
import os
import sys
print(os.path.relpath(sys.argv[2], os.path.dirname(sys.argv[1])))
PY
}
real_path() {
python3 - "$1" <<'PY'
import os
import sys
print(os.path.realpath(sys.argv[1]))
PY
}
case "$HOST_CONFIG" in
linux-x64|macos-x64|macos-arm64)
;;
*)
echo "unsupported Flutter prebuilt Dart SDK host config: $HOST_CONFIG" >&2
exit 64
;;
esac
if [[ ! -d "$DART_SDK_SOURCE" ]]; then
echo "missing Dart tool SDK source: $DART_SDK_SOURCE" >&2
exit 66
fi
for required in \
bin/dart \
bin/dartaotruntime \
bin/snapshots/dartdevc_aot.dart.snapshot \
bin/snapshots/kernel_worker_aot.dart.snapshot
do
if [[ ! -e "$DART_SDK_SOURCE/$required" ]]; then
echo "Dart tool SDK is missing $required: $DART_SDK_SOURCE" >&2
exit 66
fi
done
mkdir -p "$(dirname "$TARGET")"
if [[ -L "$TARGET" ]]; then
source_real="$(real_path "$DART_SDK_SOURCE")"
target_real="$(real_path "$TARGET")"
if [[ "$source_real" != "$target_real" ]]; then
echo "Flutter prebuilt Dart SDK link points at $target_real, expected $source_real" >&2
exit 70
fi
elif [[ -e "$TARGET" ]]; then
echo "Flutter prebuilt Dart SDK target exists but is not the workspace Dart tool SDK symlink: $TARGET" >&2
exit 70
else
ln -s "$(relative_path "$TARGET" "$DART_SDK_SOURCE")" "$TARGET"
fi
echo "[open-source-sync] Flutter $HOST_CONFIG prebuilt Dart SDK uses $DART_SDK_SOURCE"
+18 -2
View File
@@ -136,6 +136,7 @@ required_files = %w[
scripts/linux_runtime_patch_smoke.sh
scripts/verify_open_infrastructure_defaults.sh
scripts/safe_extract_tar.py
scripts/sync_flutter_prebuilt_dart_sdk.sh
scripts/sync_open_sources.sh
scripts/validate_artifact_mirror.py
scripts/validate_release_manifest.py
@@ -1023,6 +1024,10 @@ platform_test_common = read_repo_file(repo_root, 'scripts/platform_test_common.s
bootstrap_linux = read_repo_file(repo_root, 'scripts/bootstrap_linux.sh')
bootstrap_macos = read_repo_file(repo_root, 'scripts/bootstrap_macos.sh')
sync_open_sources = read_repo_file(repo_root, 'scripts/sync_open_sources.sh')
sync_flutter_prebuilt_dart_sdk = read_repo_file(
repo_root,
'scripts/sync_flutter_prebuilt_dart_sdk.sh'
)
verify_sync_open_sources = read_repo_file(
repo_root,
'scripts/verify_sync_open_sources.sh'
@@ -1133,6 +1138,15 @@ assert!(
verify_sync_open_sources.include?('expected forbidden explicit UPDATER_URL to fail'),
'source sync smoke test must reject upstream Dart SDK and official Shorebird updater remotes'
)
assert!(
sync_flutter_prebuilt_dart_sdk.include?('dart-sdk/tools/sdks/dart-sdk') &&
sync_flutter_prebuilt_dart_sdk.include?('flutter/engine/src/flutter/prebuilts/$HOST_CONFIG/dart-sdk') &&
sync_flutter_prebuilt_dart_sdk.include?('bin/dartaotruntime') &&
sync_flutter_prebuilt_dart_sdk.include?('bin/snapshots/kernel_worker_aot.dart.snapshot') &&
sync_flutter_prebuilt_dart_sdk.include?('ln -s') &&
!sync_flutter_prebuilt_dart_sdk.include?('shorebird-dart-sdk-prebuilt'),
'Flutter web prebuilt Dart SDK sync must link the open Dart tool SDK into Flutter prebuilts'
)
assert!(
job_runs(jobs.fetch('source-checks')).join("\n").include?('./scripts/verify_release_manifest.sh'),
'source-checks must smoke-test release manifest validation'
@@ -1941,6 +1955,7 @@ end
assert!(
run_text_by_job.fetch('ios-engine').include?('--shorebird-interpreter') &&
run_text_by_job.fetch('ios-engine').include?('rustup target add aarch64-apple-ios aarch64-apple-darwin') &&
run_text_by_job.fetch('ios-engine').include?('--no-prebuilt-dart-sdk') &&
run_text_by_job.fetch('ios-engine').include?("--gn-args='dart_dynamic_modules=false dart_enable_aot_patching=true dart_enable_shorebird_interpreter=true shorebird_use_interpreter=true flutter_prebuilt_dart_sdk=false'") &&
run_text_by_job.fetch('ios-engine').include?("--gn-args='flutter_prebuilt_dart_sdk=false'") &&
@@ -2008,6 +2023,7 @@ assert!(
)
assert!(
run_text_by_job.fetch('android-engine').include?('verify_engine_args.sh') &&
run_text_by_job.fetch('android-engine').include?('rustup target add aarch64-linux-android') &&
run_text_by_job.fetch('android-engine').include?('--no-prebuilt-dart-sdk') &&
run_text_by_job.fetch('android-engine').include?('flutter/engine/src/out/android_release_arm64/args.gn') &&
run_text_by_job.fetch('android-engine').include?('dart_enable_aot_patching=true') &&
@@ -2021,10 +2037,10 @@ assert!(
)
assert!(
run_text_by_job.fetch('web-sdk').include?('verify_engine_args.sh') &&
run_text_by_job.fetch('web-sdk').include?('--no-prebuilt-dart-sdk') &&
run_text_by_job.fetch('web-sdk').include?('sync_flutter_prebuilt_dart_sdk.sh linux-x64') &&
run_text_by_job.fetch('web-sdk').include?('flutter/engine/src/out/wasm_release/args.gn') &&
run_text_by_job.fetch('web-sdk').include?('dart_dynamic_modules=false') &&
run_text_by_job.fetch('web-sdk').include?('flutter_prebuilt_dart_sdk=false') &&
run_text_by_job.fetch('web-sdk').include?('flutter_prebuilt_dart_sdk=true') &&
run_text_by_job.fetch('web-sdk').include?('mirror/shorebird/flutter_infra_release/flutter/${engine_revision}/flutter-web-sdk.zip'),
'web SDK job must explicitly disable and verify DDM'
)