Skip to content

Commit

Permalink
[video_player_avfoundation] Adds Swift Package Manager compatibility (#…
Browse files Browse the repository at this point in the history
…6675)

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

Fixes flutter/flutter#146921.

Redo of #6634.
  • Loading branch information
vashworth committed May 8, 2024
1 parent 0167b51 commit 09a373f
Show file tree
Hide file tree
Showing 27 changed files with 174 additions and 17 deletions.
4 changes: 4 additions & 0 deletions packages/video_player/video_player_avfoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.6.0

* Adds Swift Package Manager compatibility.

## 2.5.7

* Adds frame availability checks on iOS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Downloaded by pub (not CocoaPods).
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation' }
s.documentation_url = 'https://pub.dev/packages/video_player'
s.source_files = 'Classes/*'
s.ios.source_files = 'Classes/ios/*'
s.osx.source_files = 'Classes/macos/*'
s.public_header_files = 'Classes/**/*.h'
s.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation/**/*.{h,m}'
s.ios.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation_ios/*'
s.osx.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation_macos/*'
s.public_header_files = 'video_player_avfoundation/Sources/video_player_avfoundation/include/**/*.h'
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.14'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.resource_bundles = {'video_player_avfoundation_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
s.resource_bundles = {'video_player_avfoundation_privacy' => ['video_player_avfoundation/Sources/video_player_avfoundation/Resources/PrivacyInfo.xcprivacy']}
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// swift-tools-version: 5.9

// 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: "video_player_avfoundation",
platforms: [
.iOS("12.0"),
.macOS("10.14"),
],
products: [
.library(name: "video-player-avfoundation", targets: ["video_player_avfoundation"])
],
dependencies: [],
targets: [
.target(
name: "video_player_avfoundation",
dependencies: [
.target(name: "video_player_avfoundation_ios", condition: .when(platforms: [.iOS])),
.target(name: "video_player_avfoundation_macos", condition: .when(platforms: [.macOS])),
],
resources: [
.process("Resources")
],
cSettings: [
.headerSearchPath("include/video_player_avfoundation")
]
),
.target(
name: "video_player_avfoundation_ios",
cSettings: [
.headerSearchPath("../video_player_avfoundation/include/video_player_avfoundation")
]
),
.target(
name: "video_player_avfoundation_macos",
cSettings: [
.headerSearchPath("../video_player_avfoundation/include/video_player_avfoundation")
]
),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#import <AVFoundation/AVFoundation.h>
#import <GLKit/GLKit.h>

#import "AVAssetTrackUtils.h"
#import "FVPDisplayLink.h"
#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"

#if !__has_feature(objc_arc)
#error Code Requires ARC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

#if TARGET_OS_OSX
#import <FlutterMacOS/FlutterMacOS.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "../FVPDisplayLink.h"
#import "../video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h"

#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "../FVPDisplayLink.h"
#import "../video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h"

#import <CoreVideo/CoreVideo.h>
#import <Foundation/Foundation.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
pod 'OCMock', '3.9.1'
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
Expand Down Expand Up @@ -99,6 +100,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
78CF8D742BC5CEA80051231B /* OCMock in Frameworks */,
D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -260,6 +262,9 @@
F7151F4026603ECA0028CB91 /* PBXTargetDependency */,
);
name = RunnerTests;
packageProductDependencies = (
78CF8D732BC5CEA80051231B /* OCMock */,
);
productName = RunnerTests;
productReference = F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -297,6 +302,9 @@
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
packageReferences = (
78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */,
);
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -758,6 +766,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/erikdoe/ocmock";
requirement = {
kind = revision;
revision = ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
78CF8D732BC5CEA80051231B /* OCMock */ = {
isa = XCSwiftPackageProductDependency;
package = 78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */;
productName = OCMock;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pins" : [
{
"identity" : "ocmock",
"kind" : "remoteSourceControl",
"location" : "https://github.com/erikdoe/ocmock",
"state" : {
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pins" : [
{
"identity" : "ocmock",
"kind" : "remoteSourceControl",
"location" : "https://github.com/erikdoe/ocmock",
"state" : {
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ target 'Runner' do
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
pod 'OCMock', '3.9.1'
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
78CF8D772BC5D0140051231B /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 78CF8D762BC5D0140051231B /* OCMock */; };
C000184E56E3386C22EF683A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC60543320154AF9A465D416 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -95,6 +96,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
78CF8D772BC5D0140051231B /* OCMock in Frameworks */,
18AD5E2A5B24DAFCF3749529 /* Pods_RunnerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -226,6 +228,9 @@
331C80DA294CF71000263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
packageProductDependencies = (
78CF8D762BC5D0140051231B /* OCMock */,
);
productName = RunnerTests;
productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -292,6 +297,9 @@
Base,
);
mainGroup = 33CC10E42044A3C60003C045;
packageReferences = (
78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */,
);
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -808,6 +816,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/erikdoe/ocmock";
requirement = {
kind = revision;
revision = ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
78CF8D762BC5D0140051231B /* OCMock */ = {
isa = XCSwiftPackageProductDependency;
package = 78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */;
productName = OCMock;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pins" : [
{
"identity" : "ocmock",
"kind" : "remoteSourceControl",
"location" : "https://github.com/erikdoe/ocmock",
"state" : {
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pins" : [
{
"identity" : "ocmock",
"kind" : "remoteSourceControl",
"location" : "https://github.com/erikdoe/ocmock",
"state" : {
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/messages.g.dart',
dartTestOut: 'test/test_api.g.dart',
objcHeaderOut: 'darwin/Classes/messages.g.h',
objcSourceOut: 'darwin/Classes/messages.g.m',
objcHeaderOut:
'darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/messages.g.h',
objcSourceOut:
'darwin/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m',
objcOptions: ObjcOptions(
prefix: 'FVP',
headerIncludePath: './include/video_player_avfoundation/messages.g.h',
),
copyrightHeader: 'pigeons/copyright.txt',
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

environment:
sdk: ^3.2.3
Expand Down

0 comments on commit 09a373f

Please sign in to comment.