Skip to content
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

[SR-13924] Ability to declare executable targets in Swift Package manifests (to support @main) #4463

Open
abertelrud opened this issue Dec 1, 2020 · 0 comments
Assignees

Comments

@abertelrud
Copy link
Contributor

Previous ID SR-13924
Radar rdar://47691185
Original Reporter @abertelrud
Type Improvement
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Improvement
Assignee @abertelrud
Priority Medium

md5: f34118afd6b4c1ba4178dd48645a1db1

Issue Description:

The Swift Package Manager doesn’t currently provide a way for a package manifest to declare that a target is the main module of an executable. Instead, SwiftPM infers this by looking for a source file named main.swift (or main.c , main.cpp , etc) in the source directory of the target.

Knowing unambiguously whether or not a target is intended to be executable is important, because it affects the flags that are passed to the compiler at build time. It also affects the quality of diagnostics, such as detecting product declarations that mistakenly include multiple or no executable targets in an executable product.

Relying on specially named source files also doesn’t work when using @main to specify the entry point of an executable. In addition, there are ergonomic problems with using specially named source files (e.g. SR-1379) that would be addressed by being able to explicitly declare a target as being executable in the manifest.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants