Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Review edits
  • Loading branch information
jmagman committed Jan 19, 2024
commit 8a4da67574625c06e128e53190bfcb62e7afdad3
8 changes: 8 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,10 @@ targets:
{
"CHANNEL": "master"
}
dependencies: >
[
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
Copy link
Member Author

@jmagman jmagman Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

]

- name: Mac_arm64 custom_package_tests stable
recipe: packages/packages
Expand All @@ -1160,6 +1164,10 @@ targets:
{
"CHANNEL": "stable"
}
dependencies: >
[
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
]

### iOS tasks ###
# ios_platform_tests builds all the packages on ARM, so this build is run
Expand Down
3 changes: 2 additions & 1 deletion .ci/targets/repo_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ tasks:
infra_step: true # Note infra steps failing prevents "always" from running.
- name: format
script: script/tool_runner.sh
args: ["format", "--fail-on-change"]
# Skip Swift formatting on Linux builders.
args: ["format", "--fail-on-change", "--no-swift"]
always: true
- name: license validation
script: script/tool_runner.sh
Expand Down
6 changes: 3 additions & 3 deletions script/tool/lib/src/format_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class FormatCommand extends PackageCommand {
argParser.addFlag(_kotlinArg,
help: 'Format Kotlin files', defaultsTo: true);
argParser.addFlag(_javaArg, help: 'Format Java files', defaultsTo: true);
argParser.addFlag(_swiftArg, help: 'Format and lint Swift files');
argParser.addFlag(_swiftArg,
help: 'Format and lint Swift files', defaultsTo: true);
argParser.addOption(_clangFormatPathArg,
defaultsTo: 'clang-format', help: 'Path to "clang-format" executable.');
argParser.addOption(_javaPathArg,
Expand Down Expand Up @@ -178,8 +179,7 @@ class FormatCommand extends PackageCommand {
}

Future<void> _formatAndLintSwift(Iterable<String> files) async {
// Do not format generated files. Consider removing this filter
// when pigeon Swift generation matches swift-format.
// TODO(jmagman): Remove generated file filter when pigeon Swift generation matches swift-format.
// https://github.com/flutter/flutter/issues/141799
final Iterable<String> swiftFiles = _filterGeneratedFiles(
_getPathsWithExtensions(files, <String>{'.swift'}));
Expand Down
4 changes: 2 additions & 2 deletions script/tool/test/format_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void main() {
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
});

test('skips Swift if --swift flag is not provided', () async {
test('skips Swift if --no-swift flag is provided', () async {
const List<String> files = <String>[
'macos/foo.swift',
];
Expand All @@ -599,7 +599,7 @@ void main() {
extraFiles: files,
);

await runCapturingPrint(runner, <String>['format']);
await runCapturingPrint(runner, <String>['format', '--no-swift']);

expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
});
Expand Down