Here I compile swift-5.2.4-RELEASE, because this is the version I use when compiling the source code.
If you need to compile the updated source code, you can find the corresponding version on the official website: Apple/Swift . At the same time, pay attention to the corresponding version of Xcode to match (there will be specific instructions when the official document is compiled).
Skipping cmake on Darwin
Skipping icu on Darwin
Skipping clone of 'sourcekit-lsp', directory already exists
Skipping clone of 'swift-syntax', directory already exists
Skipping clone of 'cmake', requested by user
Skipping clone of 'swift-xcode-playground-support', directory already exists
Skipping clone of 'swift-format', directory already exists
Skipping clone of 'indexstore-db', directory already exists
Skipping clone of 'swift-stress-tester', directory already exists
Skipping clone of 'llvm-project', directory already exists
Skipping clone of 'llbuild', directory already exists
Skipping clone of 'cmark', directory already exists
Skipping clone of 'swift-corelibs-foundation', directory already exists
Skipping clone of 'swift-tools-support-core', directory already exists
Skipping clone of 'swift-corelibs-xctest', directory already exists
Skipping clone of 'ninja', directory already exists
Skipping clone of 'swift-integration-tests', directory already exists
Skipping clone of 'swiftpm', directory already exists
Skipping clone of 'swift', directory already exists
Skipping clone of 'swift-corelibs-libdispatch', directory already exists
Skipping clone of 'icu', requested by user
This step is particularly important, because update-checkout will clone and compile swift-related libraries, otherwise the process of compiling swift will fail later.
③ Compile
During the compilation process, either njnia or Xcode can be used to compile. In the actual compilation and testing process, the support after Xcode compilation is not particularly good, it is recommended to use njnia to compile.
Compile using the script in the swift source code:
./swift/utils/build-script -x -R --debug-swift
Or execute the following script to view the command: