Skip to content

Commit 2e87972

Browse files
authored
docs/GettingStarted.md: support Linux in incremental build steps (#65653)
Currently, guidance for incremental builds in `docs/GettingStarted.md` is specific to macOS and won't work on Linux. Let's adjust these steps so that they work on Linux too.
1 parent 3d7df83 commit 2e87972

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

docs/HowToGuides/GettingStarted.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -463,25 +463,34 @@ Now that you have made some changes, you will need to rebuild...
463463
464464
### Incremental builds with Ninja
465465
466-
To rebuild the compiler:
466+
Subsequent steps in this and the next subsections are specific to the platform you're building on, so we'll try to detect it first and reuse as a shell variable:
467+
467468
```sh
468-
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m) bin/swift-frontend
469+
platform=$([[ $(uname) == Darwin ]] && echo macosx || echo linux)
469470
```
470471
471-
To rebuild everything, including the standard library:
472+
After setting that variable you can rebuild the compiler incrementally with this command:
472473
```sh
473-
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)
474+
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m) bin/swift-frontend
474475
```
475476
477+
To rebuild everything that has its sources located in the `swift` repository, including the standard library:
478+
```sh
479+
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m)
480+
```
481+
482+
Similarly, you can rebuild other projects like Foundation or Dispatch by substituting their respective subdirectories in the commands above.
483+
476484
### Spot checking an incremental build
477485
478486
As a quick test, go to `lib/Basic/Version.cpp` and tweak the version
479487
printing code slightly. Next, do an incremental build as above. This incremental
480488
build should be much faster than the from-scratch build at the beginning.
481-
Now check if the version string has been updated:
489+
Now check if the version string has been updated (assumes you have `platform` shell variable
490+
defined as specified in the previous subsection:
482491
483492
```sh
484-
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/bin/swift-frontend --version
493+
../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m)/bin/swift-frontend --version
485494
```
486495
487496
This should print your updated version string.

0 commit comments

Comments
 (0)