Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Run pub global activate before pub global run #3502

Merged
merged 3 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should extract this from the locations it's repeated to a common.sh utility that returns the pub name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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