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-5332] The swift run does not launch the SwiftPM implemented run command #4991

Closed
hartbit opened this issue Jun 29, 2017 · 10 comments
Closed
Labels

Comments

@hartbit
Copy link
Collaborator

hartbit commented Jun 29, 2017

Previous ID SR-5332
Radar rdar://problem/33053333
Original Reporter @hartbit
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Compiler, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 42c44bc4fdd5a815207841a48a24de21

Issue Description:

SwiftPM has recently implemented the swift run command to run executable products in the project or its dependencies. But it seems that the compiler has a run sub-command and does not call the swift-run tool.

The latest snapshot swift-DEVELOPMENT-SNAPSHOT-2017-06-28 has the tool if you want to test it.

@ankitspd
Copy link
Member

@swift-ci create

@ankitspd
Copy link
Member

/cc @ddunbar @belkadan

@ddunbar
Copy link
Member

ddunbar commented Jun 29, 2017

This is ancient history dating back to when the subcommands were added (actually `swift run` may have always been present in the driver)... I'll send you some of the discussions I can find.

@belkadan
Copy link

Uh oh. I forgot we even had this, but I wouldn't want to break someone's script to replace it. Hm.

@belkadan
Copy link

I don't care about swift run invoking the REPL (which it does) but somebody really might be using swift run main.swift instead of swift main.swift.

@belkadan
Copy link

Could we detect this case in the new swift-run and fall back to the interpreter with a warning on stderr? If one of the direct arguments before -- ends in ".swift", they probably meant the interpreter, right?

@ankitspd
Copy link
Member

Ya sure we can do that. Though `foo.swift` is a valid name for an executable but I don't think that anyone use that. Also, in future we may want to use `swift run foo.swift` for running swiftpm scripts. A deprecation warning seems reasonable. Thanks!

@ddunbar
Copy link
Member

ddunbar commented Jun 30, 2017

I think we should:

  1. Check if we are in a Package, and if so, if the package has an executable with the given name. If so, run it using the new swift-run semantics.
  2. If that didn't find anything, then check if the path is a path on disk, and run it using the legacy behavior, with a warning.

The depreciation warning should give us coverage to reclaim this for something else in the future.

@ankitspd
Copy link
Member

ankitspd commented Jul 6, 2017

PR for removing built-in run subcommand: apple/swift#10786
PR for adding deprecation notice in the new run tool: #1258

@ankitspd
Copy link
Member

PR for swift-4.0-branch: apple/swift#10844

@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
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants