Skip to content

SwiftPM complains about @main in non main.swift file when integrated driver is not enabled #3546

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

Merged

Conversation

abertelrud
Copy link
Contributor

@abertelrud abertelrud commented Jun 12, 2021

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

@abertelrud abertelrud self-assigned this Jun 12, 2021
@abertelrud abertelrud marked this pull request as draft June 12, 2021 04:56
@abertelrud abertelrud force-pushed the eng/at-main-in-exec-doesnt-always-work branch from a387251 to a830d30 Compare June 13, 2021 18:15
…driver is not enabled

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
@abertelrud abertelrud force-pushed the eng/at-main-in-exec-doesnt-always-work branch from a830d30 to da3d6d3 Compare June 13, 2021 18:21
@abertelrud abertelrud marked this pull request as ready for review June 13, 2021 18:23
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud merged commit e84fd1c into swiftlang:main Jun 14, 2021
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Jun 26, 2021
…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 added a commit that referenced this pull request Jul 6, 2021
…driver is not enabled (#3546) (#3575)

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 deleted the eng/at-main-in-exec-doesnt-always-work branch September 27, 2021 00:19
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.

2 participants