Swift Complier Setup

Hi everyone,

I am new to the community and currently participating in the Swift Mentorship Program. I'm trying to contribute to the Swift compiler. So far, I have followed the instructions in this guide to set up my environment and have reached the section on using Ninja with Xcode.

However, I'm having trouble understanding how to correctly set up the compiler and perform a dry run. Could someone please provide a brief summary on how to get started?

Thank you!

In your swift directory, make sure you've done ./utils/update-checkout --clone-with-ssh first. Then this will build enough to run tests:

./utils/build-script -r --skip-build-benchmarks

(The -r flag gives you a release build of the compiler; without that, building the stdlib will take forever. The second flag is optional. I don't build the benchmarks, but you can if you want. )

Now you can run the validation tests like so:

cd ../build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64
../ninja-build/ninja check-swift-validation

To run individual tests without rebuilding the stdlib every time, I use this invocation, but you'll need to adjust the paths:

python3 $HOME/src/llvm-project/llvm/utils/lit/lit.py -sv --param color_output -j 10 --param differentiable_programming --param concurrency --param distributed --param string_processing --param backtracing --param observation --param synchronization --param volatile --param remote_mirror --param threading=darwin --param backtrace_on_crash --param swift_test_subset=validation --param swift_test_mode=optimize_none $HOME/src/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64 $HOME/src/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/validation-test-macosx-arm64 --filter=...
1 Like