mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 16:26:38 +00:00
b493cdfc1b
Change-Id: I0f891d28419d0df55f94e0229ff33e87b791e7d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273280 Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Joshua Litt <joshualitt@google.com>
41 lines
1.3 KiB
Bash
Executable file
41 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
# Run the output of dart2wasm on d8.
|
|
|
|
function follow_links() {
|
|
file="$1"
|
|
while [ -h "$file" ]; do
|
|
# On Mac OS, readlink -f doesn't work.
|
|
file="$(readlink "$file")"
|
|
done
|
|
echo "$file"
|
|
}
|
|
|
|
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
|
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
|
|
|
# Handle the case where dart-sdk/bin has been symlinked to.
|
|
PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
|
SDK_DIR="$(cd "${PROG_DIR}/../.." ; pwd -P)"
|
|
D8_DIR="$(cd "${PROG_DIR}/../../third_party/d8" ; pwd -P)"
|
|
|
|
# Locate D8 executable. Only macos and linux are supported.
|
|
if [[ `uname` == 'Darwin' ]]; then
|
|
D8_EXEC="$D8_DIR/macos/d8"
|
|
else
|
|
D8_EXEC="$D8_DIR/linux/d8"
|
|
fi
|
|
|
|
# We allow extra d8 options to be passed in through an environment variable.
|
|
if [[ $D8_OPTIONS ]]; then
|
|
read -a OPTIONS <<< "$D8_OPTIONS"
|
|
EXTRA_D8_OPTIONS+=("${OPTIONS[@]}")
|
|
fi
|
|
|
|
exec "$D8_EXEC" --experimental-wasm-gc --experimental-wasm-stack-switching \
|
|
--experimental-wasm-type-reflection "${EXTRA_D8_OPTIONS[@]}" \
|
|
pkg/dart2wasm/bin/run_wasm.js -- "$@"
|