Fix version conflicts, verify publishability of packages in CI, Remove Travis (#729)
This fixes a number of version resolution errors that would prevent these packages from building, and turn off Travis, since Cirrus now works.
I also fixed a number of errors that would have prevented these packages from being published without warnings, and establishes a CI script that will verify publishability for any changed packages in a PR.
For some examples, we were depending upon versions of other 1st-party plugins by using path: ../../<package>, which really isn't the right way to do things, so for those examples, they now depend on a published version.
I bumped the version number of any packages that were modified, and updated their CHANGELOGs since the dependencies have changed.
Also fixed a number of analyzer errors that somehow snuck in.
diff --git a/script/incremental_build.sh b/script/incremental_build.sh
index 788a24c..c3a3941 100755
--- a/script/incremental_build.sh
+++ b/script/incremental_build.sh
@@ -1,35 +1,29 @@
#!/bin/bash
+set -e
-set -ev
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
+REPO_DIR="$(dirname "$SCRIPT_DIR")"
-BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
+source "$SCRIPT_DIR/common.sh"
-if [ "${BRANCH_NAME}" = "master" ]; then
+# Set some default actions if run without arguments.
+ACTIONS=("$@")
+if [[ "${#ACTIONS[@]}" == 0 ]]; then
+ ACTIONS=("test" "analyze" "java-test")
+fi
+
+BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}"
+if [[ "${BRANCH_NAME}" == "master" ]]; then
echo "Running for all packages"
- pub global run flutter_plugin_tools "$@" $PLUGIN_SHARDING
+ (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING)
else
- # Make sure there is up-to-date master.
- git fetch origin master
+ # Sets CHANGED_PACKAGES
+ check_changed_packages
- FLUTTER_CHANGED_GLOBAL=0
- FLUTTER_CHANGED_PACKAGES=""
-
- # Try get a merge base for the branch and calculate affected packages.
- # We need this check because some CIs can do a single branch clones with a limited history of commits.
- if BRANCH_BASE_SHA=$(git merge-base --fork-point FETCH_HEAD HEAD); then
- echo "Checking changes from $BRANCH_BASE_SHA..."
- FLUTTER_CHANGED_GLOBAL=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -v packages | wc -l`
- FLUTTER_CHANGED_PACKAGES=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq | paste -s -d, -`
- else
- echo "Cannot find a merge base for the current branch to run an incremental build..."
- echo "Please rebase your branch onto the latest master!"
- fi
-
- if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
+ if [[ "$CHANGED_PACKAGES" == "" ]]; then
echo "Running for all packages"
- pub global run flutter_plugin_tools "$@" $PLUGIN_SHARDING
+ (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING)
else
- echo "Running only for $FLUTTER_CHANGED_PACKAGES"
- pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
+ (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING)
fi
fi