Skip to content

Commit 9da3aa5

Browse files
committed
Cleanup the 'README.md' to remove stale content
1 parent cf48c44 commit 9da3aa5

File tree

1 file changed

+24
-87
lines changed

1 file changed

+24
-87
lines changed

README.md

+24-87
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Swift Compiler Driver
22

3-
Swift's compiler driver is a program that coordinates the compilation of Swift source code into various compiled results: executables, libraries, object files, Swift modules and interfaces, etc. It is the program one invokes from the command line to build Swift code (i.e., `swift` or `swiftc`) and is often invoked on the developer's behalf by a build system such as the [Swift Package Manager (SwiftPM)](https://github.com/swiftlang/swift-package-manager) or Xcode's build system.
3+
Swift's compiler driver is a program that coordinates the compilation of Swift source code into various compiled results: executables, libraries, object files, Swift modules and interfaces, etc. It is the program one invokes from the command line to build Swift code (i.e., `swift` or `swiftc`) and is often invoked on the developer's behalf by a build system such as the [Swift Package Manager](https://github.com/swiftlang/swift-package-manager) or [Swift Build](https://github.com/swiftlang/swift-build).
44

5-
The `swift-driver` project is a new implementation of the Swift compiler driver that is intended to replace the [existing driver](https://github.com/apple/swift/tree/main/lib/Driver) with a more extensible, maintainable, and robust code base. The specific goals of this project include:
5+
The `swift-driver` project is the primary implementation of the Swift compiler driver that has replaced the [legacy driver](https://github.com/apple/swift/tree/main/lib/Driver) with a more extensible, maintainable, and robust code base. Core pillars of the project's architecture include:
66

77
* A maintainable, robust, and flexible Swift code base
88
* Library-based architecture that allows better integration with build tools
@@ -11,8 +11,6 @@ The `swift-driver` project is a new implementation of the Swift compiler driver
1111

1212
## Getting Started
1313

14-
**Note:** Currently, swift-driver is only compatible with trunk development snapshots from [swift.org](https://swift.org/download/#snapshots).
15-
1614
The preferred way to build `swift-driver` is to use the Swift package manager.
1715

1816
On most platforms you can build using:
@@ -27,27 +25,24 @@ However, on Windows, because Swift Package Manager does not differentiate betwee
2725
swift build -Xlinker "%SDKROOT%\usr\lib\swift\windows\x86_64\swiftCore.lib"
2826
```
2927

30-
To use `swift-driver` in place of the existing Swift driver, create a symbolic link from `swift` and `swiftc` to `swift-driver`:
28+
To use a locally-built `swift-driver` in place of the existing Swift driver, create a symbolic link from `swift` and `swiftc` to `swift-driver`:
3129

3230
```
3331
ln -s /path/to/built/swift-driver $SOME_PATH/swift
3432
ln -s /path/to/built/swift-driver $SOME_PATH/swiftc
3533
```
3634

37-
Swift packages can be built with the new Swift driver by overriding `SWIFT_EXEC` to refer to the `swiftc` symbolic link created above and `SWIFT_DRIVER_SWIFT_FRONTEND_EXEC` to refer to the original `swift-frontend`, e.g.,
35+
Swift packages can be built with the new Swift driver by overriding `SWIFT_EXEC` to refer to the `swiftc` symbolic link created above and `SWIFT_DRIVER_SWIFT_FRONTEND_EXEC` to refer to the original `swift-frontend`, e.g.
3836

3937
```
4038
SWIFT_EXEC=$SOME_PATH/swiftc SWIFT_DRIVER_SWIFT_FRONTEND_EXEC=$TOOLCHAIN_PATH/bin/swift-frontend swift build
4139
```
4240

43-
Similarly, one can use the new Swift driver within Xcode by adding a custom build setting (usually at the project level) named `SWIFT_EXEC` that refers to `$SOME_PATH/swiftc` and adding `-driver-use-frontend-path $TOOLCHAIN_DIR/usr/bin/swiftc` to `Other Swift Flags`.
41+
Similarly, one can use the Swift driver within Xcode by adding a custom build setting (usually at the project level) named `SWIFT_EXEC` that refers to `$SOME_PATH/swiftc`.
4442

4543
## Building with CMake
4644

47-
`swift-driver` can also be built with CMake, which is suggested for
48-
environments where the Swift Package Manager is not yet
49-
available. Doing so requires several dependencies to be built first,
50-
all with CMake:
45+
`swift-driver` can also be built with CMake, which is suggested for environments where the Swift Package Manager is not yet available. Doing so requires several dependencies to be built first, all with CMake:
5146

5247
* (Non-Apple platforms only) [swift-corelibs-foundation](https://github.com/apple/swift-corelibs-foundation)
5348
* [llbuild](https://github.com/apple/swift-llbuild) configure CMake with `-DLLBUILD_SUPPORT_BINDINGS="Swift"` and `-DCMAKE_OSX_ARCHITECTURES=x86_64` (If building on Intel) when building
@@ -64,7 +59,7 @@ cmake --build <swift-driver-build-dir>
6459

6560
## Developing `swift-driver`
6661

67-
The new Swift driver is a work in progress, and there are numerous places for anyone with an interest to contribute! This section covers testing, miscellaneous development tips and tricks, and a rough development plan showing what work still needs to be done.
62+
Swift compiler driver is constantly evolving and improving, and there are numerous places for anyone with an interest to contribute! This section covers testing, and miscellaneous development tips and tricks.
6863

6964
### Driver Documentation
7065

@@ -78,26 +73,6 @@ Test using command-line SwiftPM or Xcode.
7873
$ swift test --parallel
7974
```
8075

81-
Integration tests are costly to run and are disabled by default. Enable them
82-
using `SWIFT_DRIVER_ENABLE_INTEGRATION_TESTS` environment variable. In Xcode,
83-
you can set this variable in the scheme's test action.
84-
85-
```
86-
$ SWIFT_DRIVER_ENABLE_INTEGRATION_TESTS=1 swift test --parallel
87-
```
88-
89-
Some integration tests run the lit test suites in a Swift working copy.
90-
To enable these, clone Swift and its dependencies and build them with
91-
build-script, then set both `SWIFT_DRIVER_ENABLE_INTEGRATION_TESTS`
92-
and `SWIFT_DRIVER_LIT_DIR`, either in your Xcode scheme or
93-
on the command line:
94-
95-
```
96-
$ SWIFT_DRIVER_ENABLE_INTEGRATION_TESTS=1 \
97-
SWIFT_DRIVER_LIT_DIR=/path/to/build/Ninja-ReleaseAssert/swift-.../test-... \
98-
swift test -c release --parallel
99-
```
100-
10176
#### Testing against `swift` compiler trunk
10277
`swift-driver` Continuous Integration runs against the most recent Trunk Development snapshot published at [swift.org/download](https://swift.org/download/).
10378

@@ -114,7 +89,7 @@ After the toolchain is installed, Xcode needs to be told to use it. This can mea
11489

11590
Building with the toolchain is easy, set the toolchain in Xcode: Menu Bar > Xcode > Toolchains > select your toolchain
11691

117-
Running the driver requires setting the TOOLCHAINS environment variable. This tells xcrun which toolchain to use (on darwin xcrun is used to find tools). This variable is the name of the toolchain and not the path (ex: `Swift Development Snapshot`). Important note: xcrun lookup is lower priority than the SWIFT_EXEC_*_EXEC family of environment variables, the tools directory, and any tools in the same directory as the driver (This includes a driver installed in a toolchain). Even though TOOLCHAINS is not highest priority it's a convenient way to run the xctest suite using a custom toolchain.
92+
Running the driver requires setting the TOOLCHAINS environment variable. This tells xcrun which toolchain to use (on darwin xcrun is used to find tools). This variable is the name of the toolchain and not the path (ex: `Swift Development Snapshot`). Important note: xcrun lookup is lower priority than the `SWIFT_EXEC_*_EXEC` family of environment variables, the tools directory, and any tools in the same directory as the driver (This includes a driver installed in a toolchain). Even though `TOOLCHAINS` is not highest priority it's a convenient way to run the xctest suite using a custom toolchain.
11893

11994
#### Preparing a Linux docker for debug
12095

@@ -155,51 +130,25 @@ $ .build/path/to/makeOptions > Sources/SwiftOptions/Options.swift
155130

156131
### Development Plan
157132

158-
The goal of the new Swift driver is to provide a drop-in replacement for the existing driver, which means that there is a fixed initial feature set to implement before the existing Swift driver can be deprecated and removed. The development plan below covers that feature set, as well as describing a number of tasks that can improve the Swift driver---from code cleanups, to improving testing, implementing missing features, and integrating with existing systems.
133+
The development plan below covers a number of tasks that can improve the Swift driver---from code cleanups, to improving testing, implementing missing features, and integrating with existing systems.
159134

160135
* Code and documentation quality
161-
* [ ] Search for `FIXME:` or `TODO:`: there are lots of little things to improve!
162-
* [ ] Improve documentation of how to incorporate the driver into your own builds
163-
* [ ] Add useful descriptions to any `Error` thrown within the library
136+
* Search for `FIXME:` or `TODO:`: there are lots of little things to improve!
137+
* Improve documentation of how to incorporate the driver into your own builds
138+
* Add useful descriptions to any `Error` thrown within the library
164139
* Option parsing
165-
* [ ] Look for complete "coverage" of the options in `Options.swift`. Is every option there checked somewhere in the driver?
166-
* [ ] Find a better way to describe aliases for options. Can they be of some other type `OptionAlias` so we can't make the mistake of (e.g.) asking for an alias option when we're translating options?
167-
* [ ] Diagnose unused options on the command line
168-
* [ ] Typo correction for misspelled option names
169-
* [ ] Find a better way than `makeOptions.cpp` to translate the command-line options from [Swift's repository](https://github.com/apple/swift/tree/main/include/swift/Option) into `Options.swift`.
170-
* Platform support
171-
* [x] Teach the `DarwinToolchain` to also handle iOS, tvOS, watchOS
172-
* [x] Fill out the `GenericUnixToolchain` toolchain to get it working
173-
* [x] Implement a `WindowsToolchain`
174-
* [x] Implement proper tokenization for response files
175-
* Compilation modes
176-
* [x] Batch mode
177-
* [x] Whole-module-optimization mode
178-
* [x] REPL mode
179-
* [x] Immediate mode
180-
* Features
181-
* [x] Precompiled bridging headers
182-
* [x] Support embedding of bitcode
183-
* [x] Incremental compilation
184-
* [x] Parseable output, as used by SwiftPM
185-
* [x] Response files
186-
* [x] Input and primary input file lists
187-
* [x] Complete `OutputFileMap` implementation to handle all file types uniformly
188-
* Testing
189-
* [ ] Build stuff with SwiftPM or Xcode or your favorite build system, using `swift-driver`. Were the results identical? What changed?
190-
* [x] Shim in `swift-driver` so it can run the Swift repository's [driver test suite](https://github.com/apple/swift/tree/main/test/Driver).
191-
* [ ] Investigate differences in the test results for the Swift repository's driver test suite (above) between the existing and new driver.
192-
* [ ] Port interesting tests from the Swift repository's [driver test suite](https://github.com/apple/swift/tree/main/test/Driver) over to XCTest
193-
* [ ] Fuzz the command-line options to try to crash the Swift driver itself
194-
* Integration
195-
* [x] Teach the Swift compiler's [`build-script`](https://github.com/apple/swift/blob/main/utils/build-script) to build `swift-driver`.
196-
* [x] Building on the above, teach the Swift compiler's [`build-toolchain`](https://github.com/apple/swift/blob/main/utils/build-toolchain) to install `swift-driver` as the primary driver so we can test full toolchains with the new driver
140+
* Look for complete "coverage" of the options in `Options.swift`. Is every option there checked somewhere in the driver?
141+
* Find a better way to describe aliases for options. Can they be of some other type `OptionAlias` so we can't make the mistake of (e.g.) asking for an alias option when we're translating options?
142+
* Diagnose unused options on the command line
143+
* Typo correction for misspelled option names
144+
* Find a better way than `makeOptions.cpp` to translate the command-line options from [Swift's repository](https://github.com/apple/swift/tree/main/include/swift/Option) into `Options.swift`.
197145

198146
### Build all Swift interfaces from an SDK
199147
Based on libSwiftDriver, `swift-build-sdk-interfaces` is a tool to batch build all Swift textual interfaces (`.swiftinterface`) from an SDK into binary modules (`.swiftmodule`). As an example, the following command finds all Swift textual interface from the MacOSX SDK, builds all of them into binary modules, and outputs module-specific error logs into the given directory.
200148

201-
`
202-
$SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk SWIFT_EXEC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc swift-build-sdk-interfaces -o /tmp/outputs -v -log-path /tmp/logs`
149+
```
150+
$ $SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk SWIFT_EXEC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc swift-build-sdk-interfaces -o /tmp/outputs -v -log-path /tmp/logs`
151+
```
203152

204153
* *SDKROOT*: an env var to specify the SDK to work on
205154
* *SWIFT_EXEC*: teach `swift-build-sdk-interfaces` about where to find the Swift compiler to use
@@ -209,22 +158,10 @@ $SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/De
209158

210159
## Contributing to swift-driver
211160

212-
Contributions to swift-driver are welcomed and encouraged! Please see the
213-
[Contributing to Swift guide](https://swift.org/contributing/).
214-
215-
Before submitting the pull request, please make sure you have [tested your
216-
changes](https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md)
217-
and that they follow the Swift project [guidelines for contributing
218-
code](https://swift.org/contributing/#contributing-code).
161+
Contributions to swift-driver are welcomed and encouraged! Please see the [Contributing to Swift guide](https://swift.org/contributing/).
219162

220-
To be a truly great community, [Swift.org](https://swift.org/) needs to welcome
221-
developers from all walks of life, with different backgrounds, and with a wide
222-
range of experience. A diverse and friendly community will have more great
223-
ideas, more unique perspectives, and produce more great code. We will work
224-
diligently to make the Swift community welcoming to everyone.
163+
Before submitting the pull request, please make sure you have [tested your changes](https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md) and that they follow the Swift project [guidelines for contributing code](https://swift.org/contributing/#contributing-code).
225164

226-
To give clarity of what is expected of our members, Swift has adopted the
227-
code of conduct defined by the Contributor Covenant. This document is used
228-
across many open source communities, and we think it articulates our values
229-
well. For more, see the [Code of Conduct](https://swift.org/code-of-conduct/).
165+
To be a truly great community, [Swift.org](https://swift.org/) needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience. A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone.
230166

167+
To give clarity of what is expected of our members, Swift has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the [Code of Conduct](https://swift.org/code-of-conduct/).

0 commit comments

Comments
 (0)