Skip to content

[5.5] SwiftPM complains about @main in non main.swift file when integrated driver is not enabled #3575

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

Conversation

abertelrud
Copy link
Contributor

This is the 5.5 cherry-pick of #3546. This fix has been in the main branch for 12 days.

One of several different code paths in BuildPlan.swift are taken depending on whether the integrated Swift driver is enabled, whether explicit modules are enabled, whether there is a single source file in the module, etc.

In the non-integrated-driver case, the code path for adding a -parse-as-library when necessary wasn't taken. This moves that code to a more central place, and extends a unit test to test both single and multiple file Swift targets, which seems to trigger the difference in code paths.

Separately, there should be a JIRA to eliminate the code duplication in BuildPlan.swift, because it leads to this kind of bug.

rdar://78080245

…driver is not enabled (swiftlang#3546)

One of several different code paths in BuildPlan.swift are taken depending on whether the integrated Swift driver is enabled, whether explicit modules are enabled, etc.

In the non-integrated-driver case, the code path for adding a `-parse-as-library` when necessary wasn't taken.  This moves that code to a more central place, and extends a unit test to test both single and multiple file Swift targets, which seems to trigger the difference in code paths.

rdar://78080245
(cherry picked from commit e84fd1c)
@abertelrud abertelrud changed the base branch from main to release/5.5 June 26, 2021 06:01
@abertelrud abertelrud self-assigned this Jun 26, 2021
@abertelrud abertelrud added 5.5 ready Author believes the PR is ready to be merged & any feedback has been addressed labels Jun 26, 2021
@abertelrud
Copy link
Contributor Author

@swift-ci please test

@abertelrud abertelrud merged commit 2ccaf04 into swiftlang:release/5.5 Jul 6, 2021
@abertelrud abertelrud deleted the eng/at-main-in-exec-doesnt-always-work-5.5 branch July 6, 2021 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants