Skip to content

Commit 111ceb7

Browse files
[tool] Use swift-format from Xcode (#9460)
As of Xcode 16, `swift-format` is part of the Xcode distribution. Since CI now uses Xcode 16, we can just always use that version. This: - Removes the `swift-format-path` logic. - Removes the check for `swift-format` being available - Defaults Swift formatting to true only on macOS - Removes the `swift-format` CIPD package from .ci.yaml - Updates Pigeon in packages using Swift Pigeon generation to pick up a fix for a lint issue picked up by the latest version of `swift-format` (which was already fixed in Pigeon). Fixes flutter/flutter#153803 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 3ea3c6a commit 111ceb7

File tree

33 files changed

+709
-260
lines changed

33 files changed

+709
-260
lines changed

.ci.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,6 @@ targets:
10431043
properties:
10441044
version_file: flutter_master.version
10451045
target_file: macos_repo_checks.yaml
1046-
dependencies: >
1047-
[
1048-
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
1049-
]
10501046

10511047
### macOS desktop tasks ###
10521048
# macos-platform_tests builds all the packages on ARM, so this build is run
@@ -1116,10 +1112,6 @@ targets:
11161112
{
11171113
"CHANNEL": "master"
11181114
}
1119-
dependencies: >
1120-
[
1121-
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
1122-
]
11231115
11241116
- name: Mac_arm64 custom_package_tests stable
11251117
recipe: packages/packages
@@ -1132,10 +1124,6 @@ targets:
11321124
{
11331125
"CHANNEL": "stable"
11341126
}
1135-
dependencies: >
1136-
[
1137-
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
1138-
]
11391127
11401128
### iOS tasks ###
11411129
# ios_platform_tests builds all the packages on ARM, so this build is run

packages/file_selector/file_selector_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 0.5.3+2
22

3+
* Updates to Pigeon 25.5.0.
34
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.
45

56
## 0.5.3+1

packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/messages.g.swift

Lines changed: 80 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
4+
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66

77
import Foundation
@@ -18,9 +18,9 @@ import Foundation
1818
final class PigeonError: Error {
1919
let code: String
2020
let message: String?
21-
let details: Any?
21+
let details: Sendable?
2222

23-
init(code: String, message: String?, details: Any?) {
23+
init(code: String, message: String?, details: Sendable?) {
2424
self.code = code
2525
self.message = message
2626
self.details = details
@@ -67,8 +67,70 @@ private func nilOrValue<T>(_ value: Any?) -> T? {
6767
return value as! T?
6868
}
6969

70+
func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool {
71+
let cleanLhs = nilOrValue(lhs) as Any?
72+
let cleanRhs = nilOrValue(rhs) as Any?
73+
switch (cleanLhs, cleanRhs) {
74+
case (nil, nil):
75+
return true
76+
77+
case (nil, _), (_, nil):
78+
return false
79+
80+
case is (Void, Void):
81+
return true
82+
83+
case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable):
84+
return cleanLhsHashable == cleanRhsHashable
85+
86+
case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]):
87+
guard cleanLhsArray.count == cleanRhsArray.count else { return false }
88+
for (index, element) in cleanLhsArray.enumerated() {
89+
if !deepEqualsmessages(element, cleanRhsArray[index]) {
90+
return false
91+
}
92+
}
93+
return true
94+
95+
case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]):
96+
guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false }
97+
for (key, cleanLhsValue) in cleanLhsDictionary {
98+
guard cleanRhsDictionary.index(forKey: key) != nil else { return false }
99+
if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) {
100+
return false
101+
}
102+
}
103+
return true
104+
105+
default:
106+
// Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue.
107+
return false
108+
}
109+
}
110+
111+
func deepHashmessages(value: Any?, hasher: inout Hasher) {
112+
if let valueList = value as? [AnyHashable] {
113+
for item in valueList { deepHashmessages(value: item, hasher: &hasher) }
114+
return
115+
}
116+
117+
if let valueDict = value as? [AnyHashable: AnyHashable] {
118+
for key in valueDict.keys {
119+
hasher.combine(key)
120+
deepHashmessages(value: valueDict[key]!, hasher: &hasher)
121+
}
122+
return
123+
}
124+
125+
if let hashableValue = value as? AnyHashable {
126+
hasher.combine(hashableValue.hashValue)
127+
}
128+
129+
return hasher.combine(String(describing: value))
130+
}
131+
70132
/// Generated class from Pigeon that represents data sent in messages.
71-
struct FileSelectorConfig {
133+
struct FileSelectorConfig: Hashable {
72134
var utis: [String]
73135
var allowMultiSelection: Bool
74136

@@ -88,9 +150,15 @@ struct FileSelectorConfig {
88150
allowMultiSelection,
89151
]
90152
}
153+
static func == (lhs: FileSelectorConfig, rhs: FileSelectorConfig) -> Bool {
154+
return deepEqualsmessages(lhs.toList(), rhs.toList())
155+
}
156+
func hash(into hasher: inout Hasher) {
157+
deepHashmessages(value: toList(), hasher: &hasher)
158+
}
91159
}
92160

93-
private class messagesPigeonCodecReader: FlutterStandardReader {
161+
private class MessagesPigeonCodecReader: FlutterStandardReader {
94162
override func readValue(ofType type: UInt8) -> Any? {
95163
switch type {
96164
case 129:
@@ -101,7 +169,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader {
101169
}
102170
}
103171

104-
private class messagesPigeonCodecWriter: FlutterStandardWriter {
172+
private class MessagesPigeonCodecWriter: FlutterStandardWriter {
105173
override func writeValue(_ value: Any) {
106174
if let value = value as? FileSelectorConfig {
107175
super.writeByte(129)
@@ -112,18 +180,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter {
112180
}
113181
}
114182

115-
private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
183+
private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
116184
override func reader(with data: Data) -> FlutterStandardReader {
117-
return messagesPigeonCodecReader(data: data)
185+
return MessagesPigeonCodecReader(data: data)
118186
}
119187

120188
override func writer(with data: NSMutableData) -> FlutterStandardWriter {
121-
return messagesPigeonCodecWriter(data: data)
189+
return MessagesPigeonCodecWriter(data: data)
122190
}
123191
}
124192

125-
class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
126-
static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter())
193+
class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
194+
static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter())
127195
}
128196

129197
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
@@ -133,7 +201,7 @@ protocol FileSelectorApi {
133201

134202
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
135203
class FileSelectorApiSetup {
136-
static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared }
204+
static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared }
137205
/// Sets up an instance of `FileSelectorApi` to handle messages through the `binaryMessenger`.
138206
static func setUp(
139207
binaryMessenger: FlutterBinaryMessenger, api: FileSelectorApi?,

packages/file_selector/file_selector_ios/lib/src/messages.g.dart

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
4+
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
77

@@ -29,6 +29,21 @@ List<Object?> wrapResponse(
2929
return <Object?>[error.code, error.message, error.details];
3030
}
3131

32+
bool _deepEquals(Object? a, Object? b) {
33+
if (a is List && b is List) {
34+
return a.length == b.length &&
35+
a.indexed
36+
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
37+
}
38+
if (a is Map && b is Map) {
39+
return a.length == b.length &&
40+
a.entries.every((MapEntry<Object?, Object?> entry) =>
41+
(b as Map<Object?, Object?>).containsKey(entry.key) &&
42+
_deepEquals(entry.value, b[entry.key]));
43+
}
44+
return a == b;
45+
}
46+
3247
class FileSelectorConfig {
3348
FileSelectorConfig({
3449
this.utis = const <String>[],
@@ -39,20 +54,40 @@ class FileSelectorConfig {
3954

4055
bool allowMultiSelection;
4156

42-
Object encode() {
57+
List<Object?> _toList() {
4358
return <Object?>[
4459
utis,
4560
allowMultiSelection,
4661
];
4762
}
4863

64+
Object encode() {
65+
return _toList();
66+
}
67+
4968
static FileSelectorConfig decode(Object result) {
5069
result as List<Object?>;
5170
return FileSelectorConfig(
5271
utis: (result[0] as List<Object?>?)!.cast<String>(),
5372
allowMultiSelection: result[1]! as bool,
5473
);
5574
}
75+
76+
@override
77+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
78+
bool operator ==(Object other) {
79+
if (other is! FileSelectorConfig || other.runtimeType != runtimeType) {
80+
return false;
81+
}
82+
if (identical(this, other)) {
83+
return true;
84+
}
85+
return _deepEquals(encode(), other.encode());
86+
}
87+
88+
@override
89+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
90+
int get hashCode => Object.hashAll(_toList());
5691
}
5792

5893
class _PigeonCodec extends StandardMessageCodec {
@@ -105,8 +140,10 @@ class FileSelectorApi {
105140
pigeonChannelCodec,
106141
binaryMessenger: pigeonVar_binaryMessenger,
107142
);
143+
final Future<Object?> pigeonVar_sendFuture =
144+
pigeonVar_channel.send(<Object?>[config]);
108145
final List<Object?>? pigeonVar_replyList =
109-
await pigeonVar_channel.send(<Object?>[config]) as List<Object?>?;
146+
await pigeonVar_sendFuture as List<Object?>?;
110147
if (pigeonVar_replyList == null) {
111148
throw _createConnectionError(pigeonVar_channelName);
112149
} else if (pigeonVar_replyList.length > 1) {

packages/file_selector/file_selector_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: file_selector_ios
22
description: iOS implementation of the file_selector plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
5-
version: 0.5.3+1
5+
version: 0.5.3+2
66

77
environment:
88
sdk: ^3.6.0
@@ -26,7 +26,7 @@ dev_dependencies:
2626
flutter_test:
2727
sdk: flutter
2828
mockito: ^5.4.4
29-
pigeon: ^22.4.1
29+
pigeon: ^25.5.0
3030

3131
topics:
3232
- files

packages/file_selector/file_selector_ios/test/test_api.g.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
4+
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers
77
// ignore_for_file: avoid_relative_lib_imports

packages/file_selector/file_selector_macos/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.4+4
2+
3+
* Updates to Pigeon 25.5.0.
4+
15
## 0.9.4+3
26

37
* Updates configuration to not set `nameFieldStringValue` for `NSOpenPanel`.

0 commit comments

Comments
 (0)