Skip to content

Implement exec command #22

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

Closed
patrickfreed opened this issue Nov 11, 2022 · 2 comments
Closed

Implement exec command #22

patrickfreed opened this issue Nov 11, 2022 · 2 comments

Comments

@patrickfreed
Copy link
Contributor

swiftly should have an exec command which allows a user to run a specific swift command without having to switch the active toolchain.

e.g.

swiftly exec 5.5 build

Would run swift build using the latest 5.5 toolchain.

@cmcgee1024
Copy link
Member

cmcgee1024 commented Aug 21, 2024

Here are some additional thoughts on this enhancement. First, the version selector can be optional, and then the toolchain that is in use would be chosen, where the used toolchain logic can be flexible, possibly consulting the .swift-version file (see #155) as well as the global default in the config.json.

At the expense of requiring the full toolchain command there are some additional features we can unlock. Here's what the build example above could look like:

swiftly exec 5.5 swift build

But now you aren't restricted to just the swift command from the toolchain. You can also invoke any of the other tools, such as lldb, and clang too using the in-use toolchain:

swiftly exec clang -o foo.o foo.c

Or, you can invoke a command or even a shell script that makes use of any tool in the toolchain because it sets the toolchain at the beginning of the PATH:

swiftly exec ./my-special-script.sh

And, if your project uses autoconf/cmake you can build it with the swift toolchain (clang, clang++) like this because exec sets the CC, CXX environment variables to the in-use toolchain:

swiftly exec ./configure
swiftly exec make

@cmcgee1024
Copy link
Member

This got implemented along with the proxy support in the form of a swiftly run subcommand. Note that one needs to provide the command to run since it supports running arbitrary commands, such as make/clang/swift.

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

No branches or pull requests

2 participants