Skip to content

Commit

Permalink
[ci] Move tool_runner.sh (#6038)
Browse files Browse the repository at this point in the history
`script/tool_runner.sh` has only been intended for CI usage for quite a while, but it still lives in a prominent non-CI location which has been a source of confusion for developers (e.g., people looking at how CI is running things, and reasonably assuming that since the script isn't in a CI-specific location, it's for general use). While running it for simple cases works, it conflicts with any package selection, which is common thing to want to control when running locally.

This makes the following changes:
- Move the script into the .ci directory
- Adds explicit comments that it's not designed for local use, with a pointer to the corresponding local command
- Removes a stale reference to external-to-the-repo use of tool_runner.sh, as that usage no longer exists
  - Also consolidates and updates the links to the external scripts
- Updates a couple of CONTRIBUTING.md comments that still said to run tool_runner.sh
- Opportunistically cleans up some tooling references to .cirrus.yml, found while cleaning up comments in tool_runner.sh and checking for other references.
  • Loading branch information
stuartmorgan authored Feb 6, 2024
1 parent ef765f1 commit 9382257
Show file tree
Hide file tree
Showing 30 changed files with 81 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .ci/scripts/analyze_legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ set -e
# work in legacy versions.
#
# This requires the --lib-only flag below.
./script/tool_runner.sh remove-dev-dependencies
.ci/scripts/tool_runner.sh remove-dev-dependencies

# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# re-checked.
./script/tool_runner.sh analyze --lib-only \
.ci/scripts/tool_runner.sh analyze --lib-only \
--skip-if-not-supporting-flutter-version="$CHANNEL" \
--custom-analysis=script/configs/custom_analysis.yaml

Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/analyze_pathified.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e

# Pathify the dependencies on changed packages (excluding major version
# changes, which won't affect clients).
./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
.ci/scripts/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# re-checked.
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/check_federated_safety.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ set -e
if [[ $LUCI_PR == "" ]]; then
echo "This check is only run in presubmit"
else
./script/tool_runner.sh federation-safety-check
.ci/scripts/tool_runner.sh federation-safety-check
fi
4 changes: 2 additions & 2 deletions .ci/scripts/check_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -e
# missing version/CHANGELOG detection since PR-level overrides aren't available
# in post-submit.
if [[ $LUCI_PR == "" ]]; then
./script/tool_runner.sh version-check --ignore-platform-interface-breaks
.ci/scripts/tool_runner.sh version-check --ignore-platform-interface-breaks
else
./script/tool_runner.sh version-check --check-for-missing-changes --pr-labels="$PR_OVERRIDE_LABELS"
.ci/scripts/tool_runner.sh version-check --check-for-missing-changes --pr-labels="$PR_OVERRIDE_LABELS"
fi
2 changes: 1 addition & 1 deletion .ci/scripts/dart_unit_tests_pathified.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e

# Pathify the dependencies on changed packages (excluding major version
# changes, which won't affect clients).
./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
.ci/scripts/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# re-checked.
Expand Down
12 changes: 7 additions & 5 deletions script/tool_runner.sh → .ci/scripts/tool_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

set -e

# WARNING! Do not remove this script, or change its behavior, unless you have
# verified that it will not break the flutter/flutter analysis run of this
# repository: https://github.com/flutter/flutter/blob/master/dev/bots/test.dart
# This file runs the repo tooling (see TOOL_PATH) in a configuration that's
# common to almost all of the CI usage, avoiding the need to pass the same
# flags (e.g., --packages-for-branch) in every CI invocation.
#
# For local use, directly run `dart run <tool path>`.

readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"
readonly REPO_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
readonly TOOL_PATH="$REPO_DIR/script/tool/bin/flutter_plugin_tools.dart"

# Ensure that the tool dependencies have been fetched.
Expand All @@ -19,5 +21,5 @@ readonly TOOL_PATH="$REPO_DIR/script/tool/bin/flutter_plugin_tools.dart"
# The tool expects to be run from the repo root.
cd "$REPO_DIR"
# Run from the in-tree source.
# PACKAGE_SHARDING is (optionally) set from Cirrus. See .cirrus.yml
# PACKAGE_SHARDING is (optionally) set in CI configuration. See .ci.yaml
dart run "$TOOL_PATH" "$@" --packages-for-branch --log-timing $PACKAGE_SHARDING
2 changes: 1 addition & 1 deletion .ci/scripts/xvfb_tool_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# found in the LICENSE file.
set -e

xvfb-run ./script/tool_runner.sh "$@"
xvfb-run .ci/scripts/tool_runner.sh "$@"
4 changes: 2 additions & 2 deletions .ci/targets/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ tasks:
- name: analyze repo tools
script: .ci/scripts/analyze_repo_tools.sh
- name: download Dart deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps"]
infra_step: true
- name: analyze
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
# DO NOT change the custom-analysis argument here without changing the Dart repo.
# See the comment in script/configs/custom_analysis.yaml for details.
args: ["analyze", "--custom-analysis=script/configs/custom_analysis.yaml"]
Expand Down
2 changes: 1 addition & 1 deletion .ci/targets/analyze_downgraded.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ tasks:
# new APIs but forget to update minimum versions of dependencies to where
# those APIs are introduced.
- name: analyze - downgraded
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["analyze", "--downgrade", "--custom-analysis=script/configs/custom_analysis.yaml"]
4 changes: 2 additions & 2 deletions .ci/targets/android_device_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and Android deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
infra_step: true
args: ["fetch-deps", "--android", "--supporting-target-platforms-only"]
- name: Firebase Test Lab
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args:
- "firebase-test-lab"
- "--device"
Expand Down
6 changes: 3 additions & 3 deletions .ci/targets/android_legacy_emulator_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and Android deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
infra_step: true
args: ["fetch-deps", "--android", "--supporting-target-platforms-only", "--exclude=script/configs/exclude_integration_android_legacy_emulator.yaml"]
# Only these two tests are run because they are the only ones that use the
# emulator. Other tests would just duplicate android_platform_test.yaml tests.
- name: native integration tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--android", "--no-unit", "--exclude=script/configs/exclude_integration_android_legacy_emulator.yaml"]
- name: drive examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["drive-examples", "--android", "--exclude=script/configs/exclude_integration_android_legacy_emulator.yaml,script/configs/exclude_integration_android.yaml,script/configs/exclude_integration_android_emulator.yaml"]
12 changes: 6 additions & 6 deletions .ci/targets/android_platform_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and Android deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
infra_step: true
args: ["fetch-deps", "--android", "--supporting-target-platforms-only", "--exclude=script/configs/still_requires_api_33_avd.yaml"]
- name: build examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["build-examples", "--apk", "--exclude=script/configs/still_requires_api_33_avd.yaml"]
- name: lint
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["lint-android", "--exclude=script/configs/still_requires_api_33_avd.yaml"]
# Native unit and native integration are split into two steps to allow for
# different exclusions.
# TODO(stuartmorgan): Eliminate the native unit test exclusion, and combine
# these steps.
- name: native unit tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--android", "--no-integration", "--exclude=script/configs/exclude_native_unit_android.yaml,script/configs/still_requires_api_33_avd.yaml"]
- name: native integration tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--android", "--no-unit", "--exclude=script/configs/still_requires_api_33_avd.yaml"]
- name: drive examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["drive-examples", "--android", "--exclude=script/configs/exclude_integration_android.yaml,script/configs/exclude_integration_android_emulator.yaml,script/configs/still_requires_api_33_avd.yaml"]
13 changes: 6 additions & 7 deletions .ci/targets/android_platform_tests_api_33_avd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and Android deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
infra_step: true
args: ["fetch-deps", "--android", "--supporting-target-platforms-only", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]
- name: build examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["build-examples", "--apk", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]
- name: lint
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["lint-android", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]
# Native unit and native integration are split into two steps to allow for
# different exclusions.
# TODO(stuartmorgan): Eliminate the native unit test exclusion, and combine
# these steps.
- name: native unit tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--android", "--no-integration", "--exclude=script/configs/exclude_native_unit_android.yaml", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]
- name: native integration tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--android", "--no-unit", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]
- name: drive examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["drive-examples", "--android", "--exclude=script/configs/exclude_integration_android.yaml,script/configs/exclude_integration_android_emulator.yaml", "--filter-packages-to=script/configs/still_requires_api_33_avd.yaml"]

2 changes: 1 addition & 1 deletion .ci/targets/dart_unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: Dart unit tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["dart-test", "--exclude=script/configs/dart_unit_tests_exceptions.yaml", "--platform=vm"]
# Re-run tests with path-based dependencies to ensure that publishing
# the changes won't break tests of other packages in the respository
Expand Down
12 changes: 6 additions & 6 deletions .ci/targets/ios_platform_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ tasks:
script: .ci/scripts/create_simulator.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and iOS deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps", "--ios", "--supporting-target-platforms-only"]
infra_step: true
- name: build examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["build-examples", "--ios"]
- name: xcode analyze
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["xcode-analyze", "--ios"]
- name: xcode analyze deprecation
# Ensure we don't accidentally introduce deprecated code.
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["xcode-analyze", "--ios", "--ios-min-version=13.0"]
- name: native test
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
# Simulator name and version must match name and version in create_simulator.sh
args: ["native-test", "--ios", "--ios-destination", "platform=iOS Simulator,name=Flutter-iPhone,OS=17.0"]
- name: boot simulator
Expand All @@ -31,7 +31,7 @@ tasks:
# `drive-examples` contains integration tests, which changes the UI of the application.
# This UI change sometimes affects `xctest`.
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["drive-examples", "--ios", "--exclude=script/configs/exclude_integration_ios.yaml"]
- name: remove simulator
script: .ci/scripts/remove_simulator.sh
Expand Down
2 changes: 1 addition & 1 deletion .ci/targets/linux_custom_package_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: custom tests
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["custom-test"]
4 changes: 2 additions & 2 deletions .ci/targets/linux_platform_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ tasks:
script: .ci/scripts/set_default_linux_apps.sh
infra_step: true
- name: download Dart deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps", "--linux", "--supporting-target-platforms-only"]
infra_step: true
- name: build examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["build-examples", "--linux"]
- name: native test
script: .ci/scripts/xvfb_tool_runner.sh
Expand Down
12 changes: 6 additions & 6 deletions .ci/targets/macos_platform_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and macOS deps
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps", "--macos", "--supporting-target-platforms-only"]
infra_step: true
- name: build examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["build-examples", "--macos"]
- name: xcode analyze
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["xcode-analyze", "--macos"]
- name: xcode analyze deprecation
# Ensure we don't accidentally introduce deprecated code.
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["xcode-analyze", "--macos", "--macos-min-version=12.3"]
- name: native test
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["native-test", "--macos"]
- name: drive examples
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["drive-examples", "--macos", "--exclude=script/configs/exclude_integration_macos.yaml"]
4 changes: 2 additions & 2 deletions .ci/targets/macos_repo_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ tasks:
script: .ci/scripts/update_pods.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: Swift format
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
# Non-Swift languages are formatted on Linux builders.
# Skip them on Mac builder to avoid duplication.
args: ["format", "--fail-on-change", "--no-dart", "--no-clang-format", "--no-kotlin", "--no-java" ]
always: true
- name: validate iOS and macOS podspecs
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["podspec-check"]
always: true
20 changes: 10 additions & 10 deletions .ci/targets/repo_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,50 @@ tasks:
- name: tool unit tests
script: .ci/scripts/plugin_tools_tests.sh
- name: format
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
# Skip Swift formatting on Linux builders.
args: ["format", "--fail-on-change", "--no-swift"]
always: true
- name: license validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["license-check"]
always: true
# The major and minor version here should match the lowest version analyzed
# in legacy version analysis (.ci.yaml analyze_legacy).
- name: pubspec validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args:
- "pubspec-check"
- "--min-min-flutter-version=3.10.0"
- "--allow-dependencies=script/configs/allowed_unpinned_deps.yaml"
- "--allow-pinned-dependencies=script/configs/allowed_pinned_deps.yaml"
always: true
- name: README validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["readme-check"]
always: true
# Re-run with --require-excerpts, skipping packages that still need
# to be converted. Once https://github.com/flutter/flutter/issues/102679
# has been fixed, this can be removed --require-excerpts added to the
# run above.
- name: README snippet configuration validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["readme-check", "--require-excerpts", "--exclude=script/configs/temp_exclude_excerpt.yaml"]
always: true
- name: README snippet validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["update-excerpts", "--fail-on-change"]
always: true
- name: Gradle validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["gradle-check"]
always: true
- name: Repository-level package metadata validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["check-repo-package-info"]
always: true
- name: Dependabot coverage validation
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["dependabot-check"]
always: true
- name: CHANGELOG and version validation
Expand All @@ -59,6 +59,6 @@ tasks:
always: true
# This is the slowest test, so prefer keeping it last.
- name: publishability
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["publish-check", "--allow-pre-release"]
always: true
2 changes: 1 addition & 1 deletion .ci/targets/web_dart_unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ tasks:
script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running.
- name: Dart unit tests - web
script: script/tool_runner.sh
script: .ci/scripts/tool_runner.sh
args: ["dart-test", "--exclude=script/configs/dart_unit_tests_exceptions.yaml", "--platform=chrome"]
Loading

0 comments on commit 9382257

Please sign in to comment.