From ed7ee79e4c90cf54b8ab175d87365e4bfab05257 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 30 Oct 2024 16:10:15 -0700 Subject: [PATCH] [ci] Ensure repo tool is autoformatted (#7963) Currently the autoformatter check is run per-package, so doesn't include script/tool. This adds a new CI step to check the formatting of the repo tooling, just as we have for running its unit tests. --- .ci/scripts/plugin_tools_format.sh | 8 ++++++++ .ci/targets/repo_checks.yaml | 2 ++ script/tool/lib/src/fetch_deps_command.dart | 6 ++---- script/tool/test/build_examples_command_test.dart | 1 - 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .ci/scripts/plugin_tools_format.sh diff --git a/.ci/scripts/plugin_tools_format.sh b/.ci/scripts/plugin_tools_format.sh new file mode 100644 index 000000000000..6effea097c43 --- /dev/null +++ b/.ci/scripts/plugin_tools_format.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +set -e + +cd script/tool +dart format --set-exit-if-changed . diff --git a/.ci/targets/repo_checks.yaml b/.ci/targets/repo_checks.yaml index 6c643f51d1fa..be48143733f0 100644 --- a/.ci/targets/repo_checks.yaml +++ b/.ci/targets/repo_checks.yaml @@ -4,6 +4,8 @@ tasks: infra_step: true # Note infra steps failing prevents "always" from running. - name: tool unit tests script: .ci/scripts/plugin_tools_tests.sh + - name: tool format + script: .ci/scripts/plugin_tools_format.sh - name: format script: .ci/scripts/tool_runner.sh # Skip Swift formatting on Linux builders. diff --git a/script/tool/lib/src/fetch_deps_command.dart b/script/tool/lib/src/fetch_deps_command.dart index f9bdd1beae7f..61a82487c0f1 100644 --- a/script/tool/lib/src/fetch_deps_command.dart +++ b/script/tool/lib/src/fetch_deps_command.dart @@ -87,10 +87,8 @@ class FetchDepsCommand extends PackageLoopingCommand { flutterCommand, [ 'precache', - if (precacheIOS) - '--ios', - if (precacheMacOS) - '--macos', + if (precacheIOS) '--ios', + if (precacheMacOS) '--macos', ], ); if (precacheExitCode != 0) { diff --git a/script/tool/test/build_examples_command_test.dart b/script/tool/test/build_examples_command_test.dart index 53f1aeb7f196..e2f78fcdc5b4 100644 --- a/script/tool/test/build_examples_command_test.dart +++ b/script/tool/test/build_examples_command_test.dart @@ -485,7 +485,6 @@ void main() { ); }); - test('building for macOS with Swift Package Manager on master channel', () async { mockPlatform.isMacOS = true;