[dart2wasm] Update dart2wasm script

When DART_CONFIGURATION is not provided, search in output directory for
a configuration. Code copied from the `dart` script.

Currently the script only works without DART_CONFIGURATION on X64
systems, which is inconvenient when working on macOS or others.

Change-Id: I48c3e32f8824913932aee63e220e5152931b54db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Ömer Sinan Ağacan 2023-06-21 14:15:25 +00:00 committed by Commit Queue
parent 9a6c33571f
commit 2f27fc5ddf

View file

@ -28,7 +28,34 @@ if [[ `uname` == 'Darwin' ]]; then
else
OUT_DIR="$SDK_DIR/out"
fi
DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64}
# Set DART_CONFIGURATION. Code copied from `dart` script in the same directory.
if [ -z "$DART_CONFIGURATION" ];
then
DIRS=$( ls "$OUT_DIR" )
# List of possible configurations in decreasing desirability.
CONFIGS=("ReleaseX64" "ReleaseARM64" "ReleaseIA32" "DebugX64" "DebugIA32"
"ReleaseARM" "DebugARM" "DebugARM64" )
DART_CONFIGURATION="None"
for CONFIG in ${CONFIGS[*]}
do
for DIR in $DIRS;
do
if [ "$CONFIG" = "$DIR" ];
then
# Choose most desirable configuration that is available and break.
DART_CONFIGURATION="$DIR"
break 2
fi
done
done
if [ "$DART_CONFIGURATION" = "None" ]
then
echo "No valid dart configuration found in $OUT_DIR"
exit 1
fi
fi
BIN_DIR="$OUT_DIR/$DART_CONFIGURATION"
DART_PRECOMPILED_RUNTIME="$BIN_DIR/dart_precompiled_runtime"