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

Plugin import scanner isn't passing in the library directory, making canImport not work #6323

Merged

Conversation

abertelrud
Copy link
Contributor

The Workspace type has a facility for scanning package plugins for imports. But since it's not passing in the actual plugin directory provided by the caller (whether it's SwiftPM or Xcode), any modules provided by an IDE aren't picked up if they are guarded by #if canImport(). This includes XcodeProjectPlugin, which is one of the additional plugin modules provided by Xcode. The same would be true for other IDEs.

Changes:

  • Workspace.loadPluginImports now also passes the path of the plugin directory to the import scanning
  • extended the testScanImportsInPluginTargets unit test to check for this case

rdar://106387043

The Workspace type has a facility for scanning package plugins for imports.  But since it's not passing in the actual plugin directory provided by the caller (whether it's SwiftPM or Xcode), any modules provided by an IDE aren't picked up if they are guarded by `#if canImport()`.  This includes `XcodeProjectPlugin`, which is one of the additional plugin modules provided by Xcode.  The same would be true for other IDEs.

Changes:
- `Workspace.loadPluginImports` now also passes the path of the plugin directory to the import scanning
- extended the `testScanImportsInPluginTargets` unit test to check for this case

rdar://106387043
@abertelrud
Copy link
Contributor Author

cc @neonichu

@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud merged commit e3b6e5d into swiftlang:main Mar 24, 2023
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Mar 24, 2023
…ng#6323)

The Workspace type has a facility for scanning package plugins for imports.  But since it's not passing in the actual plugin directory provided by the caller (whether it's SwiftPM or Xcode), any modules provided by an IDE aren't picked up if they are guarded by `#if canImport()`.  This includes `XcodeProjectPlugin`, which is one of the additional plugin modules provided by Xcode.  The same would be true for other IDEs.

Changes:
- `Workspace.loadPluginImports` now also passes the path of the plugin directory to the import scanning
- extended the `testScanImportsInPluginTargets` unit test to check for this case

rdar://106387043
(cherry picked from commit e3b6e5d)
tomerd pushed a commit that referenced this pull request Mar 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…6326)

The Workspace type has a facility for scanning package plugins for imports.  But since it's not passing in the actual plugin directory provided by the caller (whether it's SwiftPM or Xcode), any modules provided by an IDE aren't picked up if they are guarded by `#if canImport()`.  This includes `XcodeProjectPlugin`, which is one of the additional plugin modules provided by Xcode.  The same would be true for other IDEs.

Changes:
- `Workspace.loadPluginImports` now also passes the path of the plugin directory to the import scanning
- extended the `testScanImportsInPluginTargets` unit test to check for this case

rdar://106387043
(cherry picked from commit e3b6e5d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants