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

Prompt plugin authors to add Swift Package Manager compatibility to their plugin #148222

Open
vashworth opened this issue May 13, 2024 · 1 comment
Labels
P2 Important issues not at the top of the work list team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team

Comments

@vashworth
Copy link
Contributor

vashworth commented May 13, 2024

When detected that a flutter project is a plugin example app that has a podspec but doesn't have a Package.swift, prompt the user to add Swift Package Manager compatibility and point to documentation with instructions on how to do that.

/// Expected path to the plugin's Package.swift. Returns null if the plugin
/// does not support the [platform] or the [platform] is not iOS or macOS.
String? pluginSwiftPackageManifestPath(
FileSystem fileSystem,
String platform,
) {
final String? platformDirectoryName = _darwinPluginDirectoryName(platform);
if (platformDirectoryName == null) {
return null;
}
return fileSystem.path.join(
path,
platformDirectoryName,
name,
'Package.swift',
);
}
/// Expected path to the plugin's podspec. Returns null if the plugin does
/// not support the [platform] or the [platform] is not iOS or macOS.
String? pluginPodspecPath(FileSystem fileSystem, String platform) {
final String? platformDirectoryName = _darwinPluginDirectoryName(platform);
if (platformDirectoryName == null) {
return null;
}
return fileSystem.path.join(path, platformDirectoryName, '$name.podspec');
}

bool get hasExampleApp => _exampleDirectory(directory).existsSync();

FlutterProject get example => FlutterProject(
_exampleDirectory(directory),
_exampleManifest,
FlutterManifest.empty(logger: globals.logger),
);

bool get isPlugin => manifest.isPlugin;

@vashworth vashworth added tool Affects the "flutter" command-line tool. See also t: labels. P2 Important issues not at the top of the work list team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels May 13, 2024
@stuartmorgan
Copy link
Contributor

I like it!

(Longer term, we'll want to more aggressively reach long-tail plugin developers by warning end users if they are using a plugin without SPM support, so that we can eventually remove Cocoapods, but that would be probably a couple of releases after SPM support is on stable.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

2 participants