Commit c256e6d5 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Populate PUB_ENVIRONMENT for initial pub get and correctly detect APPVEYOR as bot (#9725)

* Populate PUB_ENVIRONMENT for initial pub get

* review comments

* change order
parent 49d32d35
......@@ -81,7 +81,12 @@ fi
"$FLUTTER_ROOT/bin/internal/update_dart_sdk.sh"
echo Building flutter tool...
(cd "$FLUTTER_TOOLS_DIR"; "$PUB" upgrade --verbosity=error --no-packages-dir)
LOCAL_PUB_ENV="$PUB_ENVIRONMENT"
if [ "$TRAVIS" == "true" ] || [ "$BOT" == "true" ] || [ "$CONTINUOUS_INTEGRATION" == "true" ] || [ "$CHROME_HEADLESS" == "1" ] || [ "$APPVEYOR" == "true" ] || [ "$CI" == "true" ]; then
LOCAL_PUB_ENV="$LOCAL_PUB_ENV:flutter_bot"
fi
LOCAL_PUB_ENV="$LOCAL_PUB_ENV:flutter_install"
(cd "$FLUTTER_TOOLS_DIR"; PUB_ENVIRONMENT=$LOCAL_PUB_ENV "$PUB" upgrade --verbosity=error --no-packages-dir)
"$DART" --snapshot="$SNAPSHOT_PATH" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH"
echo $REVISION > "$STAMP_PATH"
fi
......
......@@ -63,7 +63,7 @@ GOTO :after_subroutine
IF !dart_required_version! NEQ !dart_installed_version! GOTO do_sdk_update_and_snapshot
IF NOT EXIST "%snapshot_path%" GOTO do_snapshot
IF NOT EXIST "%stamp_path%" GOTO do_snapshot
SET /p stamp_value=<"%stamp_path%"
SET /P stamp_value=<"%stamp_path%"
IF !stamp_value! NEQ !revision! GOTO do_snapshot
REM Compare "last modified" timestamps
SET pubspec_yaml_path=%flutter_tools_dir%\pubspec.yaml
......@@ -90,7 +90,23 @@ GOTO :after_subroutine
ECHO: > "%cache_dir%\.dartignore"
ECHO Updating flutter tool...
PUSHD "%flutter_tools_dir%"
REM Makes changes to PUB_ENVIRONMENT only visible to commands within SETLOCAL/ENDLOCAL
SETLOCAL
IF "%TRAVIS%" == "true" GOTO on_bot
IF "%BOT%" == "true" GOTO on_bot
IF "%CONTINUOUS_INTEGRATION%" == "true" GOTO on_bot
IF "%CHROME_HEADLESS%" == "1" GOTO on_bot
IF "%APPVEYOR%" == "true" GOTO on_bot
IF "%CI%" == "true" GOTO on_bot
GOTO not_on_bot
:on_bot
SET PUB_ENVIRONMENT=%PUB_ENVIRONMENT%:flutter_bot
:not_on_bot
SET PUB_ENVIRONMENT=%PUB_ENVIRONMENT%:flutter_install
CALL "%pub%" upgrade --verbosity=error --no-packages-dir
ENDLOCAL
POPD
CALL "%dart%" --snapshot="%snapshot_path%" --packages="%flutter_tools_dir%\.packages" "%script_path%"
>"%stamp_path%" ECHO %revision%
......
......@@ -16,12 +16,15 @@ import 'platform.dart';
bool get isRunningOnBot {
// https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
// https://www.appveyor.com/docs/environment-variables/
// CHROME_HEADLESS is one property set on Flutter's Chrome Infra bots.
return
platform.environment['TRAVIS'] == 'true' ||
platform.environment['BOT'] == 'true' ||
platform.environment['CONTINUOUS_INTEGRATION'] == 'true' ||
platform.environment['CHROME_HEADLESS'] == '1';
platform.environment['CHROME_HEADLESS'] == '1' ||
platform.environment['APPVEYOR'] == 'true' ||
platform.environment['CI'] == 'true';
}
String hex(List<int> bytes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment