Skip to content

Commit 0c99a3b

Browse files
Simplify the tooling bash scripts (flutter#3865)
- Rename incremental_build.sh to tool_runner.sh since it has been used for things other than building for a while, and also isn't always incremental. - Replace check_publish.sh with tool_runner.sh to reduce the number of special-case scripts. This is a small behavioral change in that now PRs that don't change any packages will test all packages, as with our other scripts. - Eliminate check_changed_packages. All critical uses have now been replaced by the Dart version of the logic, and the one remaining use was purely for an error message that says something that should be relatively easy to figure out from context anyway. This means we have less bash code to maintain (without unit tests) and understand.
1 parent 7765fa0 commit 0c99a3b

File tree

6 files changed

+23
-97
lines changed

6 files changed

+23
-97
lines changed

.cirrus.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ task:
4848
- CIRRUS_BUILD_ID=null pub run test
4949
- name: publishable
5050
script:
51-
- ./script/incremental_build.sh version-check
52-
- ./script/check_publish.sh
51+
- ./script/tool_runner.sh version-check
52+
- ./script/tool_runner.sh publish-check
5353
- name: format
54-
format_script: ./script/incremental_build.sh format --fail-on-change
54+
format_script: ./script/tool_runner.sh format --fail-on-change
5555
license_script:
5656
- dart script/tool/lib/src/main.dart license-check
5757
- name: test
@@ -60,16 +60,16 @@ task:
6060
CHANNEL: "master"
6161
CHANNEL: "stable"
6262
test_script:
63-
- ./script/incremental_build.sh test
63+
- ./script/tool_runner.sh test
6464
- name: analyze_master
6565
env:
6666
matrix:
6767
CHANNEL: "master"
6868
tool_script:
6969
- cd script/tool
7070
- dart analyze --fatal-infos
71-
plugins_script:
72-
- ./script/incremental_build.sh analyze
71+
script:
72+
- ./script/tool_runner.sh analyze
7373
## TODO(cyanglaz):
7474
## Combing stable and master analyze jobs when integration test null safety is ready on flutter stable.
7575
- name: analyze_stable
@@ -78,7 +78,7 @@ task:
7878
CHANNEL: "stable"
7979
script:
8080
- find . -depth -type d -wholename '*_web/example' -exec rm -rf {} \;
81-
- ./script/incremental_build.sh analyze
81+
- ./script/tool_runner.sh analyze
8282
### Android tasks ###
8383
- name: build_all_plugins_apk
8484
env:
@@ -111,9 +111,9 @@ task:
111111
CHANNEL: "stable"
112112
build_script:
113113
- flutter config --enable-linux-desktop
114-
- ./script/incremental_build.sh build-examples --linux
114+
- ./script/tool_runner.sh build-examples --linux
115115
test_script:
116-
- xvfb-run ./script/incremental_build.sh drive-examples --linux
116+
- xvfb-run ./script/tool_runner.sh drive-examples --linux
117117

118118
# Heavy-workload Linux tasks.
119119
# These use machines with more CPUs and memory, so will reduce parallelization
@@ -154,11 +154,11 @@ task:
154154
- echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt
155155
- export CIRRUS_CHANGE_MESSAGE=""
156156
- export CIRRUS_COMMIT_MESSAGE=""
157-
- ./script/incremental_build.sh build-examples --apk
158-
- ./script/incremental_build.sh java-test # must come after apk build
157+
- ./script/tool_runner.sh build-examples --apk
158+
- ./script/tool_runner.sh java-test # must come after apk build
159159
- if [[ -n "$GCLOUD_FIREBASE_TESTLAB_KEY" ]]; then
160160
- echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json
161-
- ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26
161+
- ./script/tool_runner.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26
162162
- else
163163
- echo "This user does not have permission to run Firebase Test Lab tests."
164164
- fi
@@ -177,11 +177,11 @@ task:
177177
- dart lib/web_driver_installer.dart chromedriver --install-only
178178
- ./chromedriver/chromedriver --port=4444 &
179179
build_script:
180-
- ./script/incremental_build.sh build-examples --web
180+
- ./script/tool_runner.sh build-examples --web
181181
test_script:
182182
# TODO(stuartmorgan): Eliminate this check once 2.1 reaches stable.
183183
- if [[ "$CHANNEL" == "master" ]]; then
184-
- ./script/incremental_build.sh drive-examples --web
184+
- ./script/tool_runner.sh drive-examples --web
185185
- else
186186
- echo "Requires null-safe integration_test; skipping."
187187
- fi
@@ -216,13 +216,13 @@ task:
216216
- xcrun simctl list
217217
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot
218218
build_script:
219-
- ./script/incremental_build.sh build-examples --ipa
219+
- ./script/tool_runner.sh build-examples --ipa
220220
test_script:
221-
- ./script/incremental_build.sh xctest --skip $PLUGINS_TO_SKIP_XCTESTS --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
221+
- ./script/tool_runner.sh xctest --skip $PLUGINS_TO_SKIP_XCTESTS --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
222222
# `drive-examples` contains integration tests, which changes the UI of the application.
223223
# This UI change sometimes affects `xctest`.
224224
# So we run `drive-examples` after `xctest`, changing the order will result ci failure.
225-
- ./script/incremental_build.sh drive-examples --ios
225+
- ./script/tool_runner.sh drive-examples --ios
226226
### macOS desktop tasks ###
227227
- name: build_all_plugins_macos
228228
env:
@@ -240,9 +240,9 @@ task:
240240
PATH: $PATH:/usr/local/bin
241241
build_script:
242242
- flutter config --enable-macos-desktop
243-
- ./script/incremental_build.sh build-examples --macos --no-ipa
243+
- ./script/tool_runner.sh build-examples --macos --no-ipa
244244
test_script:
245-
- ./script/incremental_build.sh drive-examples --macos
245+
- ./script/tool_runner.sh drive-examples --macos
246246

247247
task:
248248
# Don't use FLUTTER_UPGRADE_TEMPLATE, Flutter tooling not needed.
@@ -253,4 +253,4 @@ task:
253253
script:
254254
# TODO(jmagman): Lint macOS podspecs but skip any that fail library validation.
255255
- find . -name "*.podspec" | xargs grep -l "osx" | xargs rm
256-
- ./script/incremental_build.sh podspecs
256+
- ./script/tool_runner.sh podspecs

packages/video_player/video_player/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies in the examples directory):
88
flutter pub upgrade
99
flutter pub run pigeon --dart_null_safety --input pigeons/messages.dart
1010
# git commit your changes so that your working environment is clean
11-
(cd ../../../; ./script/incremental_build.sh format --travis --clang-format=clang-format-7)
11+
(cd ../../../; ./script/tool_runner.sh format --clang-format=clang-format-7)
1212
```
1313

1414
If you update pigeon itself and want to test the changes here,

script/build_all_plugins_app.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"
1818

1919
source "$SCRIPT_DIR/common.sh"
2020

21-
check_changed_packages > /dev/null
22-
2321
# This list should be kept as short as possible, and things should remain here
2422
# only as long as necessary, since in general the goal is for all of the latest
2523
# versions of plugins to be mutually compatible.
@@ -63,18 +61,10 @@ for version in "${BUILD_MODES[@]}"; do
6361

6462
if [ $? -eq 0 ]; then
6563
echo "Successfully built $version all_plugins app."
66-
echo "All first party plugins compile together."
64+
echo "All first-party plugins compile together."
6765
else
6866
error "Failed to build $version all_plugins app."
69-
if [[ "${#CHANGED_PACKAGE_LIST[@]}" == 0 ]]; then
70-
error "There was a failure to compile all first party plugins together, but there were no changes detected in packages."
71-
else
72-
error "Changes to the following packages may prevent all first party plugins from compiling together:"
73-
for package in "${CHANGED_PACKAGE_LIST[@]}"; do
74-
error "$package"
75-
done
76-
echo ""
77-
fi
67+
error "This indicates a conflict between two or more first-party plugins."
7868
failures=$(($failures + 1))
7969
fi
8070
done

script/check_publish.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

script/common.sh

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,6 @@ function error() {
77
echo "$@" 1>&2
88
}
99

10-
function get_branch_base_sha() {
11-
local branch_base_sha="$(git merge-base --fork-point FETCH_HEAD HEAD || git merge-base FETCH_HEAD HEAD)"
12-
echo "$branch_base_sha"
13-
}
14-
15-
function check_changed_packages() {
16-
# Try get a merge base for the branch and calculate affected packages.
17-
# We need this check because some CIs can do a single branch clones with a limited history of commits.
18-
local packages
19-
local branch_base_sha="$(get_branch_base_sha)"
20-
if [[ "$branch_base_sha" != "" ]]; then
21-
echo "Checking for changed packages from $branch_base_sha"
22-
IFS=$'\n' packages=( $(git diff --name-only "$branch_base_sha" HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq) )
23-
else
24-
error "Cannot find a merge base for the current branch to run an incremental build..."
25-
error "Please rebase your branch onto the latest master!"
26-
return 1
27-
fi
28-
29-
CHANGED_PACKAGES=""
30-
CHANGED_PACKAGE_LIST=()
31-
32-
# Filter out packages that have been deleted.
33-
for package in "${packages[@]}"; do
34-
if [ -d "$REPO_DIR/packages/$package" ]; then
35-
CHANGED_PACKAGES="${CHANGED_PACKAGES},$package"
36-
CHANGED_PACKAGE_LIST=("${CHANGED_PACKAGE_LIST[@]}" "$package")
37-
fi
38-
done
39-
40-
if [[ "${#CHANGED_PACKAGE_LIST[@]}" == 0 ]]; then
41-
echo "No changes detected in packages."
42-
else
43-
echo "Detected changes in the following ${#CHANGED_PACKAGE_LIST[@]} package(s):"
44-
for package in "${CHANGED_PACKAGE_LIST[@]}"; do
45-
echo "$package"
46-
done
47-
echo ""
48-
fi
49-
return 0
50-
}
51-
5210
# Runs the plugin tools from the plugin_tools git submodule.
5311
function plugin_tools() {
5412
(pushd "$REPO_DIR/script/tool" && dart pub get && popd) >/dev/null
File renamed without changes.

0 commit comments

Comments
 (0)