diff --git a/.cirrus.yml b/.cirrus.yml index b6a9c4884a22..a4815ec2489e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,6 @@ task: - flutter channel master - flutter upgrade - git fetch origin master - activate_script: pub global activate flutter_plugin_tools matrix: - name: publishable script: @@ -122,7 +121,6 @@ task: - flutter channel master - flutter upgrade - git fetch origin master - activate_script: pub global activate flutter_plugin_tools matrix: - name: build-linux+drive-examples install_script: @@ -147,7 +145,6 @@ task: - flutter channel master - flutter upgrade - git fetch origin master - activate_script: pub global activate flutter_plugin_tools create_simulator_script: - xcrun simctl list - xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot @@ -201,7 +198,6 @@ task: - flutter channel master - flutter upgrade - git fetch origin master - activate_script: pub global activate flutter_plugin_tools create_simulator_script: - xcrun simctl list - xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-13-3 | xargs xcrun simctl boot @@ -231,7 +227,6 @@ task: - flutter channel master - flutter upgrade - git fetch origin master - activate_script: pub global activate flutter_plugin_tools matrix: - name: build_all_plugins_app script: diff --git a/script/build_all_plugins_app.sh b/script/build_all_plugins_app.sh index 3e08b914ff86..9d9e38550ed5 100755 --- a/script/build_all_plugins_app.sh +++ b/script/build_all_plugins_app.sh @@ -64,7 +64,7 @@ fi echo "Excluding the following plugins: $ALL_EXCLUDED" -(cd "$REPO_DIR" && pub global run flutter_plugin_tools all-plugins-app --exclude $ALL_EXCLUDED) +(cd "$REPO_DIR" && plugin_tools all-plugins-app --exclude $ALL_EXCLUDED) function error() { echo "$@" 1>&2 diff --git a/script/check_publish.sh b/script/check_publish.sh index 2e53fc80cb47..5584fc601916 100755 --- a/script/check_publish.sh +++ b/script/check_publish.sh @@ -12,7 +12,7 @@ source "$SCRIPT_DIR/common.sh" function check_publish() { local failures=() - for dir in $(pub global run flutter_plugin_tools list --plugins="$1"); do + for dir in $(plugin_tools list --plugins="$1"); do local package_name=$(basename "$dir") echo "Checking that $package_name can be published." diff --git a/script/common.sh b/script/common.sh index 7950a3ea71cd..7e419c24a80a 100644 --- a/script/common.sh +++ b/script/common.sh @@ -45,3 +45,19 @@ function check_changed_packages() { fi return 0 } + +# Normalizes the call to the pub command. +function pub_command() { + if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then + pub.bat "$@" + else + pub "$@" + fi +} + +# Activates the Flutter plugin tool to ensures that the plugin tools dependencies +# are resolved using the current Dart SDK. +# Finally, runs the tool with the parameters. +function plugins_tools() { + pub_command global activate flutter_plugin_tools && pub_command global run flutter_plugin_tools "$@" +} diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 693e0e873565..98313500cac6 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -7,18 +7,6 @@ readonly REPO_DIR="$(dirname "$SCRIPT_DIR")" source "$SCRIPT_DIR/common.sh" source "$SCRIPT_DIR/nnbd_plugins.sh" -if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then - PUB=pub.bat -else - PUB=pub -fi - -echo "Debugging PUB" -$PUB --version -which $PUB - -$PUB global activate flutter_plugin_tools - # Plugins that are excluded from this task. ALL_EXCLUDED=("") # Exclude nnbd plugins from stable. @@ -55,7 +43,7 @@ PLUGIN_SHARDING=($PLUGIN_SHARDING) if [[ "${BRANCH_NAME}" == "master" ]]; then echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) + (cd "$REPO_DIR" && plugins_tools "${ACTIONS[@]}" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) else # Sets CHANGED_PACKAGES check_changed_packages @@ -63,10 +51,10 @@ else if [[ "$CHANGED_PACKAGES" == "" ]]; then echo "No changes detected in packages." echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) + (cd "$REPO_DIR" && plugins_tools "${ACTIONS[@]}" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) else echo running "${ACTIONS[@]}" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) + (cd "$REPO_DIR" && plugins_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) echo "Running version check for changed packages" # TODO(egarciad): Enable this check once in master. # (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)")