Skip to content

[video_player_avfoundation] Adds Swift Package Manager compatibility #6675

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

Conversation

vashworth
Copy link
Contributor

Makes video_player_avfoundation available as a Swift Package to Flutter. Also, remains compatible with CocoaPods.

Fixes flutter/flutter#146921.

Redo of #6634.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@@ -4,7 +4,7 @@
// Autogenerated from Pigeon (v18.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "messages.g.h"
#import "./include/video_player_avfoundation/messages.g.h"
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 changed this manually. This will get overwritten by pigeon until flutter/flutter#147587 is fixed.

@@ -5,7 +5,7 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NSApplicationMain was deprecated, tool migrated it: flutter/flutter#146848

@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
78CF8D742BC5CEA80051231B /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 78CF8D732BC5CEA80051231B /* OCMock */; };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: pbxproj file does not contain Swift Package Manager migration changes so that it will continue to build with stable. Migration will happen on the fly.

.headerSearchPath("include/video_player_avfoundation")
]
),
.target(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment from previous PR by @stuartmorgan:
Interesting, so SPM doesn't allow source filtering without making separate targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, it doesn't allow you to conditionalize by platform very much, only target dependencies, CSettings, CXXSettings, SwiftSettings, and LinkerSettings.

Sources can only be nil or an array of strings

#import "messages.g.h"
#import "./include/video_player_avfoundation/AVAssetTrackUtils.h"
#import "./include/video_player_avfoundation/FVPDisplayLink.h"
#import "./include/video_player_avfoundation/messages.g.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment from previous PR by @stuartmorgan:
Do we know why include paths aren't taking care of this?

Copy link
Contributor Author

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. More explanation here: flutter/flutter#147587 (comment)

So I decided to change all of them to relative paths to keep it uniform

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little surprised the compilation doesn't scope the search to just the module. Maybe it's the way we have to make all the headers public to make our unit tests work?

We could consider using a different naming convention for Obj-C out from Pigeon in our repo to give them unique names to avoid this, but relative paths are fine too.

@@ -2,7 +2,7 @@ name: video_player_avfoundation
description: iOS and macOS implementation of the video_player plugin.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.5.7
version: 2.6.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment from previous PR by @stuartmorgan:
Optional: I would probably make this a minor bump, since it's more of a new feature than a fix.

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 changed it to a minor bump

@vashworth vashworth marked this pull request as ready for review May 6, 2024 15:56
@vashworth vashworth requested a review from hellohuanlin as a code owner May 6, 2024 15:56
@vashworth vashworth requested review from stuartmorgan-g and removed request for hellohuanlin May 6, 2024 15:56
Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

Re-LGTM

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2024
@auto-submit auto-submit bot merged commit 09a373f into flutter:main May 8, 2024
78 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 10, 2024
flutter/packages@8de142d...6c4482a

2024-05-09 15619084+vashworth@users.noreply.github.com [image_picker_ios] Adds Swift Package Manager compatibility  (flutter/packages#6696)
2024-05-09 goderbauer@google.com [flutter_lints] Rev to 4.0.0; prepare for publishing (flutter/packages#6695)
2024-05-09 10687576+bparrishMines@users.noreply.github.com [pointer_interceptor] Remove `implements` from app-facing package (flutter/packages#6699)
2024-05-08 15619084+vashworth@users.noreply.github.com Temporarily add empty header files to video_player_avfoundation so include directory is downloaded (flutter/packages#6694)
2024-05-08 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[image_picker_ios] Adds Swift Package Manager compatibility to image_picker_ios (#6617)" (flutter/packages#6693)
2024-05-08 15619084+vashworth@users.noreply.github.com [image_picker_ios] Adds Swift Package Manager compatibility to image_picker_ios (flutter/packages#6617)
2024-05-08 15619084+vashworth@users.noreply.github.com [video_player_avfoundation] Adds Swift Package Manager compatibility (flutter/packages#6675)
2024-05-08 737941+loic-sharma@users.noreply.github.com [ios_platform_images] Add Swift Package Manager support (flutter/packages#6684)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
…lutter#6675)

Makes `video_player_avfoundation` available as a Swift Package to Flutter. Also, remains compatible with CocoaPods.

Fixes flutter/flutter#146921.

Redo of flutter#6634.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: video_player platform-ios platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[video_player_avfoundation] Add Swift Package Manager compatibility to video_player_avfoundation
3 participants