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

Incremental Build Script #422

Merged
merged 1 commit into from
Mar 16, 2018
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
8 changes: 4 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ task:
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
format_script: ./script/plugin_tools.sh format --travis --clang-format=clang-format-5.0
test_script: ./script/plugin_tools.sh test
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
test_script: ./script/incremental_build.sh test
- name: analyze
script: ./script/plugin_tools.sh analyze
script: ./script/incremental_build.sh analyze
- name: build-apks
script: ./script/plugin_tools.sh build-examples --apk
script: ./script/incremental_build.sh build-examples --apk
24 changes: 24 additions & 0 deletions script/incremental_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -ev

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

if [ "${BRANCH_NAME}" = "master" ]; then
echo "Running for all packages"
pub global run flutter_plugin_tools "$@"
else
# Make sure there is up-to-date master.
git fetch origin master
BRANCH_BASE_SHA=$(git merge-base --fork-point FETCH_HEAD HEAD)
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, -`
if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
echo "Running for all packages"
pub global run flutter_plugin_tools "$@"
else
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
fi
fi