Skip to content

Commit

Permalink
Run pub global activate before pub global run (flutter#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Garcia authored Feb 3, 2021
1 parent a65d350 commit 42d5325
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
5 changes: 0 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion script/build_all_plugins_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion script/check_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
16 changes: 16 additions & 0 deletions script/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 plugin_tools() {
pub_command global activate flutter_plugin_tools && pub_command global run flutter_plugin_tools "$@"
}
12 changes: 3 additions & 9 deletions script/incremental_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +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

# Plugins that are excluded from this task.
ALL_EXCLUDED=("")
# Exclude nnbd plugins from stable.
Expand Down Expand Up @@ -49,18 +43,18 @@ 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" && plugin_tools "${ACTIONS[@]}" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]})
else
# Sets CHANGED_PACKAGES
check_changed_packages

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" && plugin_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" && plugin_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)")
Expand Down

0 comments on commit 42d5325

Please sign in to comment.