Description
Description
Adding local target dependencies or external dependencies to my plugin doesn't result in an error when declared in the package manifest. However, importing these dependencies in the plugin code makes SwiftPM complain that it can't find these modules.
Expected behavior
I'd expect to declare dependencies and be able to actually import them.
Actual behavior
An error is emitted when importing a module that was declared as a dependency in the plugin code. This is the case for both build tools and command tools.
Steps to reproduce
- Create a
TestPackage
directory, cd into it, and runswift package init
. - Add the following target in the package manifest:
.plugin(name: "MyPlugin", capability: .buildTool(), dependencies: [.target(name: "TestPackage")]),
- Create a
Plugins/MyPlugin/Plugin.swift
containing:import TestPackage import PackagePlugin @main struct Plugin: BuildToolPlugin { func createBuildCommands(context: PackagePlugin.PluginContext, target: PackagePlugin.Target) async throws -> [PackagePlugin.Command] { [] } }
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.7.0
Swift & OS version (output of swift --version && uname -a
)
swift-driver version: 1.55.1 Apple Swift version 5.7 (swiftlang-5.7.0.113.202 clang-1400.0.16.2)
Target: arm64-apple-macosx13.0
Darwin Filip-MacBook-Air.local 22.0.0 Darwin Kernel Version 22.0.0: Tue May 24 20:30:32 PDT 2022; root:xnu-8792.0.50.111.3~5/RELEASE_ARM64_T8103 arm64