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

Support Windows binaries #180

Open
fwcd opened this issue Oct 4, 2020 · 1 comment
Open

Support Windows binaries #180

fwcd opened this issue Oct 4, 2020 · 1 comment

Comments

@fwcd
Copy link

fwcd commented Oct 4, 2020

The Swift toolchain recently added official support for Windows, so it would be nice to have swiftenv support it. Or would that be impossible given that swiftenv is written in Bash?

@kylef
Copy link
Owner

kylef commented Oct 4, 2020

I don't think bash would be a blocker, bash is available on Windows. Installing other development tools such as git bring bash terminal along too.

At the moment, swiftenv should already work with Windows providing swift versions have been installed in ~/.swiftenv/versions/<version> with a usr/bin directory containing the binaries (custom installation). I would imagine that aliasing ~/.swiftenv/versions/5.3 to /c/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain would allow using swiftenv with these Windows toolchains with prior versions of swiftenv.

I've taken a look at what it would take to support both installing from these new Windows binaries, and being able to switch between the versions and have a limited proof of concept working, however it would appear that it won't be possible to support these binaries in their current form due to the following:

  • The installer appears to be GUI only (invoking it from terminal, even with --help and other flags launches GUI).
  • Swift 5.3 is installed into /c/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain (these toolchain names do not appear to be unique nor contain version identifier unlike the macOS toolchains).

However given the caveats, installing the Swift package manually allows it to be known by swiftenv with a couple of minor changes to libexec/swiftenv-versions and libexec/swiftenv-prefix:

$ ./libexec/swiftenv versions
* system
  unknown-Asserts-development

$ env SWIFT_VERSION=unknown-Asserts-development ./libexec/swiftenv prefix
/c/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain
    ​
$ env SWIFT_VERSION=unknown-Asserts-development ./libexec/swiftenv exec swift --version
compnerd.org Swift version 5.3 (swift-5.3-RELEASE)
Target: x86_64-unknown-windows-msvc

@kylef kylef changed the title Windows support Support Windows binaries Oct 4, 2020
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