You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-11Lines changed: 18 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
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/apple/swift-package-manager) or Xcode's build system.
4
4
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/master/lib/Driver) with a more extensible, maintainable, and robust code base. The specific goals of this project include:
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:
6
6
7
7
* A maintainable, robust, and flexible Swift code base
8
8
* Library-based architecture that allows better integration with build tools
@@ -42,9 +42,9 @@ available. Doing so requires several dependencies to be built first,
*[llbuild](https://github.com/apple/swift-llbuild) configure CMake with `-DLLBUILD_SUPPORT_BINDINGS="Swift"` when building
45
+
*[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
@@ -61,7 +61,7 @@ The new Swift driver is a work in progress, and there are numerous places for an
61
61
62
62
### Driver Documentation
63
63
64
-
For a conceptual overview of the driver, see [The Swift Driver, Compilation Model, and Command-Line Experience](https://github.com/apple/swift/blob/master/docs/Driver.md). To learn more about the internals, see [Driver Design & Internals](https://github.com/apple/swift/blob/master/docs/DriverInternals.md) and [Parseable Driver Output](https://github.com/apple/swift/blob/master/docs/DriverParseableOutput.md).
64
+
For a conceptual overview of the driver, see [The Swift Driver, Compilation Model, and Command-Line Experience](https://github.com/apple/swift/blob/main/docs/Driver.md). To learn more about the internals, see [Driver Design & Internals](https://github.com/apple/swift/blob/main/docs/DriverInternals.md) and [Parseable Driver Output](https://github.com/apple/swift/blob/main/docs/DriverParseableOutput.md).
65
65
66
66
### Testing
67
67
@@ -100,7 +100,14 @@ Using:
100
100
apple/swift-driver#208
101
101
@swift-ci smoke test
102
102
```
103
-
@swift-ci cross-repository testing facilities are described [here](https://github.com/apple/swift/blob/master/docs/ContinuousIntegration.md#cross-repository-testing).
103
+
@swift-ci cross-repository testing facilities are described [here](https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#cross-repository-testing).
104
+
105
+
### Testing in Xcode with custom toolchain
106
+
After the toolchain is installed, Xcode needs to be told to use it. This can mean two things, building the driver with the toolchain and telling the driver to use the toolchain when running.
107
+
108
+
Building with the toolchain is easy, set the toolchain in Xcode: Menu Bar > Xcode > Toolchains > select your toolchain
109
+
110
+
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.
`Options.swift`, which contains the complete set of options that can be parsed by the driver, is automatically generated from the [option tables in the Swift compiler](https://github.com/apple/swift/tree/master/include/swift/Option). If you need to regenerate `Options.swift`, you will need to [build the Swift compiler](https://github.com/apple/swift#building-swift) and then build `makeOptions` program with a `-I` that allows the generated `Options.inc` to
136
+
`Options.swift`, which contains the complete set of options that can be parsed by the driver, is automatically generated from the [option tables in the Swift compiler](https://github.com/apple/swift/tree/main/include/swift/Option). If you need to regenerate `Options.swift`, you will need to [build the Swift compiler](https://github.com/apple/swift#building-swift) and then build `makeOptions` program with a `-I` that allows the generated `Options.inc` to
130
137
be found, e.g.:
131
138
132
139
```
@@ -152,7 +159,7 @@ The goal of the new Swift driver is to provide a drop-in replacement for the exi
152
159
*[ ] 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?
153
160
*[ ] Diagnose unused options on the command line
154
161
*[ ] Typo correction for misspelled option names
155
-
*[ ] Find a better way than `makeOptions.cpp` to translate the command-line options from [Swift's repository](https://github.com/apple/swift/tree/master/include/swift/Option) into `Options.swift`.
162
+
*[ ] 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`.
156
163
* Platform support
157
164
*[x] Teach the `DarwinToolchain` to also handle iOS, tvOS, watchOS
158
165
*[x] Fill out the `GenericUnixToolchain` toolchain to get it working
@@ -173,10 +180,10 @@ The goal of the new Swift driver is to provide a drop-in replacement for the exi
173
180
*[x] Complete `OutputFileMap` implementation to handle all file types uniformly
174
181
* Testing
175
182
*[ ] Build stuff with SwiftPM or Xcode or your favorite build system, using `swift-driver`. Were the results identical? What changed?
176
-
*[x] Shim in `swift-driver` so it can run the Swift repository's [driver test suite](https://github.com/apple/swift/tree/master/test/Driver).
183
+
*[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).
177
184
*[ ] Investigate differences in the test results for the Swift repository's driver test suite (above) between the existing and new driver.
178
-
*[ ] Port interesting tests from the Swift repository's [driver test suite](https://github.com/apple/swift/tree/master/test/Driver) over to XCTest
185
+
*[ ] Port interesting tests from the Swift repository's [driver test suite](https://github.com/apple/swift/tree/main/test/Driver) over to XCTest
179
186
*[ ] Fuzz the command-line options to try to crash the Swift driver itself
180
187
* Integration
181
-
*[ ] Teach the Swift compiler's [`build-script`](https://github.com/apple/swift/blob/master/utils/build-script) to build `swift-driver`.
182
-
*[ ] Building on the above, teach the Swift compiler's [`build-toolchain`](https://github.com/apple/swift/blob/master/utils/build-toolchain) to install `swift-driver` as the primary driver so we can test full toolchains with the new driver
188
+
*[ ] Teach the Swift compiler's [`build-script`](https://github.com/apple/swift/blob/main/utils/build-script) to build `swift-driver`.
189
+
*[ ] 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
0 commit comments