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
Verify that only targets that are manifest dependencies can be imported. #3562
Verify that only targets that are manifest dependencies can be imported. #3562
Conversation
b9faf24
to
6af65b0
Compare
3eda4d7
to
3b840ca
Compare
@swift-ci please smoke test |
cc @elsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this PR, Artem!
8e377b8
to
11e0f93
Compare
@swift-ci please smoke test |
Oof, I'm looking at how to work around this/remove these side-effects. |
11e0f93
to
c8ba669
Compare
@swift-ci please smoke test |
The current failure seems to be due to the fact that the toolchain being tested does not come with
Which is not expected to be seen in some of these tests. |
Together with apple/swift-driver#731 |
@swift-ci please smoke test |
@swift-ci please test package compatibility |
@artemcm also running the compatibility test suite to make sure we dont break any packages |
I don't see how the Linux self-hosted failure could be caused by the changes in this PR and I also can't reproduce them locally so far. I think we should still understand why they're failing even though we don't require them to pass for merging. |
@swift-ci please smoke test |
Coming over here with some friendly cheer leading -- hit such issue hard right now and took us a while to debug it. |
54097aa
to
2e620d1
Compare
@swift-ci please smoke test |
Thanks @artemcm ! I talked with @tomerd and @abertelrud and we'll try and see if we could solve the swift-syntax being usable here, and then we could try to use that for the parsing instead... Thank you for the rebase, we'll report back soon what the plan here is! |
In the meantime, I've reversed the build command-line option I had here from a |
2e620d1
to
60bac7b
Compare
@swift-ci please smoke test |
@swift-ci please smoke test Linux platform |
1 similar comment
@swift-ci please smoke test Linux platform |
Periodic ping here... this has hit us again and broke users trying to play around with distributed actors because it sneaked through CI which did not validate it, nor did it show up on dev machines, since we're not using Xcode most of the time; apple/swift-distributed-actors#981 |
+1 Originally this did not seem particularly important. But ever since Xcode started adding import statements behind your back, stray invalid imports have been spreading like wildfire. Consequently, this feature has rocketed to the very highest ranks of my most wanted list. |
This change introduces a build verification step that attempts to detect scenarios where a target contains an `import` of another target in the package without declaring the imported target as a dependency in the manifest. This is done via SwiftDriver's import-prescan capability which relies on libSwiftScan to quickly parse a target's sources and identify all `import`ed modules. Related to rdar://79423257
… host compiler does not support it.
…ted source-code may not be available at the time of scan.
`--disable-explicit-target-dependency-import-checking` prevents the verification code from being run as a just-in-case option to opt-out from this warning
…n to an opt-in `enable` option. While we work on optimizing incremental build performance of this check, it would be nice to have it as an opt-in option.
60bac7b
to
a4114eb
Compare
…warning', or 'none' modes, with 'none' being the default.
@swift-ci smoke test |
Thank you very much folks! |
@@ -0,0 +1 @@ | |||
print(baz(x: 11)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failure log for now available at https://ci.swift.org/job/swift-package-manager-with-xcode-self-hosted-PR-osx/2994/console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the error is expected, right? The test is using XCTAssertThrowsError
in all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is that Target A imports another target (B) in the package without declaring it a dependency.
isn't present in the output at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption would be that <unknown>:0: error: unknown argument: '-dwarf-version=4
interferes with the import detection, e.g. we may not get a list of imports at all and from that follows the test failure.
AFAIK, we haven't updated the installed Swift version, so it's a bit of a mystery how this broke?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually maybe this will be the fix? apple/swift-driver#1502
This change introduces a build verification step that attempts to detect scenarios where a target contains an
import
of another target in the package without declaring the imported target as a dependency in the manifest.This is done via SwiftDriver's import-prescan capability which relies on libSwiftScan to quickly parse a target's sources and identify all
import
ed modules.