mozilla-vpn-client
mozilla-vpn-client copied to clipboard
Update to Rust/Cargo v1.75 and simplify Windows Conda setup
Description
It took me three tries to get this done, but this should upgrade our Cargo/Rust toolchain to version v1.75 up from v1.69. The work was fairly straightforward for every platform except Windows, where all we really needed to do was bump a version number and work around some minor build quirks.
Windows however, turned out to be a beast, and I found it unable to build after touching the rust crates. This forced me to finally recon with my personal development machine and figure out why it never worked with Conda. A quick tour of the changes on Windows that made this all work for me:
- The
rust-std-apple-xxx
packages now have a dependency on the pseudo-package__unix
which makes them uninstallable on Windows. For this reason, I felt it was best to split out condaenv.yml
file into a UNIX and Windows variant. This enabled some other cleanup in the Windows env too and to omit theextras.ps1
script. - The
MSM/MergeModules
aren't installed by the Jake-Shadle/xwin project, and word on the internet is that they are only required to support Windows 8 and earlier. Given that we explicitly require Windows 10 (and even block installation on older version) we can just remove this and it ought to work. - A bump to Clang/LLVM 16.x.x brings with it significant improvement in the ability to autodetect the Visual Studio installation and any associated SDKs. This allows the Conda toolchain to work with an existing VS2019 installation.
- We write a toolchain file
scripts/windows/conda-toolchain.cmake
that can be used as a one-stop-shop to configure CMake with Clang-CL and the conda environment. This effectively replaces all of the environment hacking in the oldconda_setup_win_sdk.ps1
script. - We auto-generate a
config.toml
for Windows that passes the CMake toolchain tocargo
this eliminates much of the environment hacking needed to get cargo to build. - I wrote a new
conda-setup-xwin-sdk.ps1
script using the latest versionJake-Shadle/xwin
project using the new--use-winsysroot-style
option which allows us to massively simplify the arguments to Clang and LLVM in order to connect the two.
I think this was especially painful for me because my Windows machine has MS Visual Studio 2019 installed for other projects too and I am hesitant to uninstall it to get conda working. Hopefully with these changes we should get a working build environment both with and without VS2019 installed.
Reference
First Attempt: #9812 Second Attempt: #9914
Checklist
- [ ] My code follows the style guidelines for this project
- [ ] I have not added any packages that contain high risk or unknown licenses (GPL, LGPL, MPL, etc. consult with DevOps if in question)
- [ ] I have performed a self review of my own code
- [ ] I have commented my code PARTICULARLY in hard to understand areas
- [ ] I have added thorough tests where needed