Skip to content

[tool] Use swift-format from Xcode #9460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 0 additions & 12 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1043,10 +1043,6 @@ targets:
properties:
version_file: flutter_master.version
target_file: macos_repo_checks.yaml
dependencies: >
[
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
]

### macOS desktop tasks ###
# macos-platform_tests builds all the packages on ARM, so this build is run
Expand Down Expand Up @@ -1116,10 +1112,6 @@ targets:
{
"CHANNEL": "master"
}
dependencies: >
[
{"dependency": "swift_format", "version": "build_id:8797338979890974865"}
]

- name: Mac_arm64 custom_package_tests stable
recipe: packages/packages
Expand All @@ -1132,10 +1124,6 @@ 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 packages/file_selector/file_selector_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.5.3+2

* Updates to Pigeon 25.5.0.
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.

## 0.5.3+1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

import Foundation
Expand All @@ -18,9 +18,9 @@ import Foundation
final class PigeonError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down Expand Up @@ -67,8 +67,70 @@ private func nilOrValue<T>(_ value: Any?) -> T? {
return value as! T?
}

func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool {
let cleanLhs = nilOrValue(lhs) as Any?
let cleanRhs = nilOrValue(rhs) as Any?
switch (cleanLhs, cleanRhs) {
case (nil, nil):
return true

case (nil, _), (_, nil):
return false

case is (Void, Void):
return true

case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable):
return cleanLhsHashable == cleanRhsHashable

case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]):
guard cleanLhsArray.count == cleanRhsArray.count else { return false }
for (index, element) in cleanLhsArray.enumerated() {
if !deepEqualsmessages(element, cleanRhsArray[index]) {
return false
}
}
return true

case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]):
guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false }
for (key, cleanLhsValue) in cleanLhsDictionary {
guard cleanRhsDictionary.index(forKey: key) != nil else { return false }
if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) {
return false
}
}
return true

default:
// Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue.
return false
}
}

func deepHashmessages(value: Any?, hasher: inout Hasher) {
if let valueList = value as? [AnyHashable] {
for item in valueList { deepHashmessages(value: item, hasher: &hasher) }
return
}

if let valueDict = value as? [AnyHashable: AnyHashable] {
for key in valueDict.keys {
hasher.combine(key)
deepHashmessages(value: valueDict[key]!, hasher: &hasher)
}
return
}

if let hashableValue = value as? AnyHashable {
hasher.combine(hashableValue.hashValue)
}

return hasher.combine(String(describing: value))
}

/// Generated class from Pigeon that represents data sent in messages.
struct FileSelectorConfig {
struct FileSelectorConfig: Hashable {
var utis: [String]
var allowMultiSelection: Bool

Expand All @@ -88,9 +150,15 @@ struct FileSelectorConfig {
allowMultiSelection,
]
}
static func == (lhs: FileSelectorConfig, rhs: FileSelectorConfig) -> Bool {
return deepEqualsmessages(lhs.toList(), rhs.toList())
}
func hash(into hasher: inout Hasher) {
deepHashmessages(value: toList(), hasher: &hasher)
}
}

private class messagesPigeonCodecReader: FlutterStandardReader {
private class MessagesPigeonCodecReader: FlutterStandardReader {
override func readValue(ofType type: UInt8) -> Any? {
switch type {
case 129:
Expand All @@ -101,7 +169,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader {
}
}

private class messagesPigeonCodecWriter: FlutterStandardWriter {
private class MessagesPigeonCodecWriter: FlutterStandardWriter {
override func writeValue(_ value: Any) {
if let value = value as? FileSelectorConfig {
super.writeByte(129)
Expand All @@ -112,18 +180,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter {
}
}

private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
override func reader(with data: Data) -> FlutterStandardReader {
return messagesPigeonCodecReader(data: data)
return MessagesPigeonCodecReader(data: data)
}

override func writer(with data: NSMutableData) -> FlutterStandardWriter {
return messagesPigeonCodecWriter(data: data)
return MessagesPigeonCodecWriter(data: data)
}
}

class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter())
class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter())
}

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

/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class FileSelectorApiSetup {
static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared }
static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared }
/// Sets up an instance of `FileSelectorApi` to handle messages through the `binaryMessenger`.
static func setUp(
binaryMessenger: FlutterBinaryMessenger, api: FileSelectorApi?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// 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

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

bool _deepEquals(Object? a, Object? b) {
if (a is List && b is List) {
return a.length == b.length &&
a.indexed
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
}
if (a is Map && b is Map) {
return a.length == b.length &&
a.entries.every((MapEntry<Object?, Object?> entry) =>
(b as Map<Object?, Object?>).containsKey(entry.key) &&
_deepEquals(entry.value, b[entry.key]));
}
return a == b;
}

class FileSelectorConfig {
FileSelectorConfig({
this.utis = const <String>[],
Expand All @@ -39,20 +54,40 @@ class FileSelectorConfig {

bool allowMultiSelection;

Object encode() {
List<Object?> _toList() {
return <Object?>[
utis,
allowMultiSelection,
];
}

Object encode() {
return _toList();
}

static FileSelectorConfig decode(Object result) {
result as List<Object?>;
return FileSelectorConfig(
utis: (result[0] as List<Object?>?)!.cast<String>(),
allowMultiSelection: result[1]! as bool,
);
}

@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) {
if (other is! FileSelectorConfig || other.runtimeType != runtimeType) {
return false;
}
if (identical(this, other)) {
return true;
}
return _deepEquals(encode(), other.encode());
}

@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => Object.hashAll(_toList());
}

class _PigeonCodec extends StandardMessageCodec {
Expand Down Expand Up @@ -105,8 +140,10 @@ class FileSelectorApi {
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture =
pigeonVar_channel.send(<Object?>[config]);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_channel.send(<Object?>[config]) as List<Object?>?;
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
Expand Down
4 changes: 2 additions & 2 deletions packages/file_selector/file_selector_ios/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: file_selector_ios
description: iOS implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.5.3+1
version: 0.5.3+2

environment:
sdk: ^3.6.0
Expand All @@ -26,7 +26,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^5.4.4
pigeon: ^22.4.1
pigeon: ^25.5.0

topics:
- files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v22.4.1), do not edit directly.
// Autogenerated from Pigeon (v25.5.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// 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
// ignore_for_file: avoid_relative_lib_imports
Expand Down
4 changes: 4 additions & 0 deletions packages/file_selector/file_selector_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.4+4

* Updates to Pigeon 25.5.0.

## 0.9.4+3

* Updates configuration to not set `nameFieldStringValue` for `NSOpenPanel`.
Expand Down
Loading