8000 [SwiftPM] ☂ Adopt local package override for the Flutter framework SwiftPM dependency · Issue #166486 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[SwiftPM] ☂ Adopt local package override for the Flutter framework SwiftPM dependency #166486
Open
4 of 7 issues completed
@vashworth

Description

@vashworth

Use case

The biggest problem with adopting SwiftPM in Flutter is that plugins have a dependency on Flutter, however, they need to use a local version of the Flutter framework. This poses a problem because the local path may vary per user, so it’s impossible to define in a plugin’s Package.swift.

To solve this problem, the current solution involves using a "Pre-action" bash script. This script invokes the flutter tool to copy the Flutter/FlutterMacOS framework to the BUILT_PRODUCTS_DIR directory before the build starts. Fortunately Swift Package Manager automatically uses BUILT_PRODUCTS_DIR as a framework search path, so when plugins compile, the Flutter framework is available.

Although Flutter uses caching to minimize the impact of using a pre-action on build times, pre-actions have a perception of being slow since they run before every build. They have also been known to be flakey in the past.

On the plugins side, the dependency on Flutter is not defined in the Package.swift and is implicit.

Due to only having an implicit dependency on Flutter, Flutter plugin Swift Packages cannot be built or tested independently like Swift Packages normally can (using commands like swift build or swift test.

Proposal

Instead, we can use local package overrides to handle the Flutter framework. Plugins will define a dependency on a remote Flutter framework, but when run through the Flutter CLI or Xcode, Xcode will override the dependency with a local version of the Flutter framework.

See flutter.dev/go/swift-package-manager-plugins-v3 for details

Sub-issues

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0