Skip to content

Fix incorrect executable target diagnostic #7447

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
merged 1 commit into from
Jun 20, 2024

Conversation

neonichu
Copy link
Contributor

@neonichu neonichu commented Apr 9, 2024

The determination for executable targets isn't limited to Swift files, it will also find 'main.m' for example. This was originally reflected in the diagnostic, but #3254 updated it incorrectly.

The determination for executable targets isn't limited to Swift files, it will also find 'main.m' for example. This was originally reflected in the diagnostic, but #3254 updated it incorrectly.
@neonichu neonichu requested a review from owenv April 9, 2024 18:32
@neonichu neonichu self-assigned this Apr 9, 2024
@neonichu
Copy link
Contributor Author

neonichu commented Apr 9, 2024

@swift-ci please test

@@ -953,7 +953,7 @@ public final class PackageBuilder {
{
self.observabilityScope
.emit(
warning: "'\(potentialModule.name)' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version \(ToolsVersion.v5_4) executable targets should be declared as 'executableTarget()'"
warning: "'\(potentialModule.name)' was identified as an executable target given the presence of a 'main' file. Starting with tools version \(ToolsVersion.v5_4) executable targets should be declared as 'executableTarget()'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "given the presence of an entry point file"? Makes it a bit more general.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to presence of ... to make it slightly shorter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "entry point file" might be too general, especially in the non-Swift case. There's really no rule outside of SwiftPM that makes "main.m" a special file.

@MaxDesiatov MaxDesiatov merged commit b617ed3 into main Jun 20, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the fix-executable-diagnostic branch June 20, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants