Skip to content

Commit

Permalink
Add an env var to force devtools_tool to use SDKs from PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed Nov 23, 2023
1 parent f21229b commit a5103ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion tool/bin/devtools_tool
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/bin/bash -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
"$SCRIPT_DIR/../flutter-sdk/bin/dart" run "$SCRIPT_DIR/devtools_tool.dart" "$@"

if [ ! -z "$DEVTOOLS_TOOL_FLUTTER_FROM_PATH" ]
then
echo Running devtools_tool using Dart/Flutter from PATH because DEVTOOLS_TOOL_FLUTTER_FROM_PATH is set
dart run "$SCRIPT_DIR/devtools_tool.dart" "$@"
else
"$SCRIPT_DIR/../flutter-sdk/bin/dart" run "$SCRIPT_DIR/devtools_tool.dart" "$@"
fi
7 changes: 6 additions & 1 deletion tool/bin/devtools_tool.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@echo off

%~dp0/../flutter-sdk/bin/dart run %~dp0/devtools_tool.dart %*
IF DEFINED DEVTOOLS_TOOL_FLUTTER_FROM_PATH (
echo Running devtools_tool using Dart/Flutter from PATH because DEVTOOLS_TOOL_FLUTTER_FROM_PATH is set
dart run %~dp0/devtools_tool.dart %*
) ELSE (
%~dp0/../flutter-sdk/bin/dart run %~dp0/devtools_tool.dart %*
)

EXIT /B %errorlevel%
2 changes: 2 additions & 0 deletions tool/flutter_customer_tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
root_dir=$(pwd)
tool_dir="$root_dir/tool/bin"
export PATH=$PATH:$tool_dir
# Force devtools_tool to use the current Flutter (which is available on PATH).
export DEVTOOLS_TOOL_FLUTTER_FROM_PATH=true
cd tool
flutter pub get
devtools_tool pub-get
Expand Down

0 comments on commit a5103ad

Please sign in to comment.