Skip to content

[SwiftPM Add2App] Create FlutterPluginRegistrant swift package #181221

Description

@vashworth

The FlutterPluginRegistrant should generate GeneratedPluginRegistrant files, which import all Flutter plugins. These files are put in a directory per build mode to allow us the option to have different plugins per build mode (such as if we wanted to exclude dev dependencies from release builds).

├── FlutterPluginRegistrant
│   ├── Debug
│   │   ├── FlutterPluginRegistrant
│   │   │   ├── GeneratedPluginRegistrant.m
│   │   │   ├── include
│   │   │   │   ├── GeneratedPluginRegistrant.h
│   │   ├── Package.swift
│   ├── Sources -> symlink to ./Debug
│   ├── Package.swift -> symlink to ./Debug/Package.swift

It will also create a Package.swift for the package.

let package = Package(
    name: "FlutterPluginRegistrant",
    products: [
        .library(name: "FlutterPluginRegistrant", type: .static, targets: ["FlutterPluginRegistrant"])
    ],
    dependencies: [
        .package(name: "FlutterFramework", path: "Sources/Packages/FlutterFramework"),
        .package(name: "plugin_with_swiftpm_support", path: "Sources/Packages/plugin_with_swiftpm_support"),
        .package(name: "FlutterConfigurationPlugin", path: "../FlutterConfigurationPlugin")
    ],
    targets: [
        .target(
            name: "FlutterPluginRegistrant",
            dependencies: [
                .product(name: "FlutterFramework", package: "FlutterFramework"),
                .target(name: "App"),
                .product(name: "plugin-with-swiftpm-support", package: "plugin_with_swiftpm_support"),
                .target(name: "cocoapod_only_plugin"),
                .target(name: "native_asset_plugin")
            ]
        ),
        .binaryTarget(
            name: "App",
            path: "Sources/Frameworks/App.xcframework"
        ),
        .binaryTarget(
            name: "cocoapod_only_plugin",
            path: "Sources/Frameworks/CocoaPods/cocoapod_only_plugin.xcframework"
        ),
        .binaryTarget(
            name: "native_asset_plugin",
            path: "Sources/Frameworks/NativeAssets/native_asset_plugin.xcframework"
        )
    ]
)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listcustomer: castawayteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions