Skip to content
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

[file_selector] Add support for SPM #6672

Merged
merged 11 commits into from
May 6, 2024
Merged
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
4 changes: 4 additions & 0 deletions packages/file_selector/file_selector_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.2

* Adds Swift Package Manager compatibility.

## 0.5.1+9

* Adjusts implementation for testabiity.
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Displays the native iOS document picker.
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios' }
s.source_files = 'Classes/**/*.{h,m}'
s.module_map = 'Classes/FileSelectorPlugin.modulemap'
s.source_files = 'file_selector_ios/Sources/file_selector_ios/**/*.{h,m}'
s.module_map = 'file_selector_ios/Sources/file_selector_ios/include/cocoapods_file_selector_ios.modulemap'
s.dependency 'Flutter'
s.platform = :ios, '12.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.0'
s.resource_bundles = {'file_selector_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
s.resource_bundles = {'file_selector_ios_privacy' => ['file_selector_ios/Sources/file_selector_ios/Resources/PrivacyInfo.xcprivacy']}
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

// 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.

import PackageDescription

let package = Package(
name: "file_selector_ios",
platforms: [
.iOS("12.0")
],
products: [
.library(name: "file-selector-ios", targets: ["file_selector_ios"])
],
dependencies: [],
targets: [
.target(
name: "file_selector_ios",
dependencies: [],
exclude: ["include/cocoapods_file_selector_ios.modulemap"],
resources: [
.process("Resources")
],
cSettings: [
.headerSearchPath("include/file_selector_ios")
]
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// found in the LICENSE file.

#import "FFSFileSelectorPlugin.h"

#import "./include/file_selector_ios/messages.g.h"
Copy link
Member

Choose a reason for hiding this comment

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

Why was adding the relative path to the #import necessary, if it's in the header search path?

Copy link
Contributor

Choose a reason for hiding this comment

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

So for most of the headers, include paths is sufficient. However, messages.g.h is a problem when there's multiple plugins that also have a messages.g.h. Seems like it can't resolve which to use. This appeared to also be a problem with CocoaPods, more context here: flutter/flutter#147587 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Should this instead wait until #6600 is done then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with manually doing include path fixup in advance of the fix landing, since we know the generator will catch up with it and it's not changing anything that could have runtime effects.

#import "FFSFileSelectorPlugin_Test.h"
#import "messages.g.h"

#import <objc/runtime.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module file_selector_ios {
umbrella header "file_selector_ios/file_selector_ios-umbrella.h"

export *
module * { export * }

explicit module Test {
header "file_selector_ios/FFSFileSelectorPlugin_Test.h"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "messages.g.h"
#import "./include/file_selector_ios/messages.g.h"

#if TARGET_OS_OSX
#import <FlutterMacOS/FlutterMacOS.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/messages.g.dart',
dartTestOut: 'test/test_api.g.dart',
objcHeaderOut: 'ios/Classes/messages.g.h',
objcSourceOut: 'ios/Classes/messages.g.m',
objcHeaderOut:
'ios/file_selector_ios/Sources/file_selector_ios/include/file_selector_ios/messages.g.h',
objcSourceOut: 'ios/file_selector_ios/Sources/file_selector_ios/messages.g.m',
objcOptions: ObjcOptions(
prefix: 'FFS',
headerIncludePath: './include/file_selector_ios/messages.g.h',
),
copyrightHeader: 'pigeons/copyright.txt',
))
Expand Down
2 changes: 1 addition & 1 deletion 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.1+9
version: 0.5.2

environment:
sdk: ^3.2.3
Expand Down
3 changes: 2 additions & 1 deletion packages/file_selector/file_selector_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.4

* Adds Swift Package Manager compatibility.
* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.

## 0.9.3+3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Displays native macOS open and save panels.
s.homepage = 'https://github.com/flutter/packages/tree/main/packages/file_selector'
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos' }
s.source_files = 'Classes/**/*'
s.source_files = 'file_selector_macos/Sources/file_selector_macos/**/*.swift'
s.dependency 'FlutterMacOS'

s.platform = :osx, '10.14'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

// 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.

import PackageDescription

let package = Package(
name: "file_selector_macos",
platforms: [
.macOS("10.14")
],
products: [
.library(name: "file-selector-macos", targets: ["file_selector_macos"])
],
dependencies: [],
targets: [
.target(
name: "file_selector_macos",
dependencies: []
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import 'package:pigeon/pigeon.dart';

@ConfigurePigeon(PigeonOptions(
input: 'pigeons/messages.dart',
swiftOut: 'macos/Classes/messages.g.swift',
swiftOut:
'macos/file_selector_macos/Sources/file_selector_macos/messages.g.swift',
dartOut: 'lib/src/messages.g.dart',
dartTestOut: 'test/messages_test.g.dart',
copyrightHeader: 'pigeons/copyright.txt',
Expand Down
2 changes: 1 addition & 1 deletion packages/file_selector/file_selector_macos/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: file_selector_macos
description: macOS implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.9.3+3
version: 0.9.4

environment:
sdk: ^3.1.0
Expand Down