-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Build tool plugin is not seeing target dependencies in oddly-specific case of one particular dependency #8060
Comments
@DougGregor just to confirm, were you getting errors like:
|
If I change the Package.swift to only depend on JavaKitJar (which is really JavaKitReflection), it works. So I don't think the number of dependencies are a factor. Unless you are getting a totally different error than the one I posted above. |
That's the right error. The first indication of failure is actually a warning earlier on:
which is because the build tool isn't seeing the JavaKit target. If I go ahead and dump the JavaMath target's dependencies as the build tool sees it, "JavaKit" doesn't show up. |
You're right that the number of dependencies isn't a factor. Something about the JavaKit product/target specifically is tripping it up: if I dump the dependencies of the target in the build tool, we don't see a direct dependency on JavaKit! But if I swap in JavaKitJar, we see a direct dependency on it and an indirect one on JavaKit. |
Fixed a bug on the main branch where plugin dependencies were sneaking into the build planning. With that, swift-java-deps builds correctly. However, I'm still seeing the reported behaviour on the 6.0 branch. I want to understand that before assuming it's fixed on main. |
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
I have a build tool plugin that looks at the dependencies of the target it is applied to. For example:
The Java2SwiftPlugin doesn't see the dependency of JavaMath on JavaKit. However, if I uncomment the second line (to add the JavaKitJar dependency), the Java2SwiftPlugin sees both the JavaKit and JavaKitJar dependencies correctly. It seems to only ever happen when there is exactly one dependency, it is missing.
Expected behavior
The plugin should see the target dependency even when there is only one.
Actual behavior
The dependency is missing when there is a single dependency; all dependencies are visible if there is more than one.
Steps to reproduce
git clone https://github.com/DougGregor/swift-java-deps
cd swift-java-deps
swift build
The build will fail. If you uncomment the marked line in
Package.swift
, the build will succeed because the Java2SwiftPlugin is correctly seeing the dependency.Swift Package Manager version/commit hash
6.0
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: