-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix indentation and remove trailing whitespace of test files #2
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use spaces as tabs.
ddunbar
added a commit
that referenced
this pull request
Dec 3, 2015
Fix indentation and remove trailing whitespace of test files
Thanks! |
aciidgh
referenced
this pull request
in aciidgh/swift-package-manager
Sep 20, 2017
aciidgh
referenced
this pull request
in aciidgh/swift-package-manager
Sep 20, 2017
aciidgh
referenced
this pull request
in aciidgh/swift-package-manager
Sep 20, 2017
aciidgh
added a commit
that referenced
this pull request
Sep 20, 2017
aciidgh
referenced
this pull request
in aciidgh/swift-package-manager
Jan 11, 2019
[Ninja] Support -j (jobs) parameter to Ninja.
sergiocampama
pushed a commit
that referenced
this pull request
Apr 20, 2020
Sync with SwiftPM trunk
MaxDesiatov
pushed a commit
to MaxDesiatov/swift-package-manager
that referenced
this pull request
Jul 6, 2020
[pull] swiftwasm from master
This was referenced May 4, 2022
DougGregor
pushed a commit
that referenced
this pull request
Aug 25, 2024
…wift identifier (#7764) Executing `swift package add-target my-target --type executable` breaks the updated package because the executable target name is not a valid Swift identifier. ### Motivation: After executing `swift package add-target my-target --type executable`, I expect the generated stub to not break the modified package. However, in this case, the resulting stub file would contain invalid Swift code: ```swift @main struct my-targetMain { static func main() { print("Hello, world") } } ``` The same issue applies to `macro` and `test` target types. It's also important to note that `dash case` is quite often used for target names, like e.g. in [swift-argument-parser](https://github.com/apple/swift-argument-parser/blob/main/Package.swift#L65-L68). Additionaly, when `AddTarget` is consumed via an API (as opposed to the CLI), the following parsing error is thrown into `stdout`: <img width="796" alt="Screenshot 2024-07-08 at 08 40 51" src="https://github.com/swiftlang/swift-package-manager/assets/1008612/c2696127-3e34-47a2-aa60-a843cfb64bda"> ### Modifications: I believe there are at least two ways to solve this issue: 1. Use a predefined type name in the generated stub, such as `struct ExampleMain`, so it doesn't depend on the target name. 2. Introduce a sanitizer function to ensure that the target name is always a valid Swift identifier. For example, a function that would convert "$my-target-name%" into "myTargetName". For the sake of simplicity, I opted for approach `#1` in the proposed PR. However, if it's necessary to preserve target names in the generated stubs, we can certainly go with approach `#2`. ### Result: `swift package add-target my-target --type executable` ```swift @main struct ExampleMain { static func main() { print("Hello, world") } } ```
bkhouri
added a commit
to bkhouri/swift-package-manager
that referenced
this pull request
Apr 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since most parts of the files were using spaces I converted all of them to use spaces as tabs.