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
+26-8Lines changed: 26 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -89,37 +89,55 @@ the Swift compiler source because we always push gyb-generated files to a tag.
89
89
## Contributing
90
90
91
91
### Building SwiftSyntax from `master`
92
+
92
93
Since SwiftSyntax relies on definitions in the main Swift repository to generate the layout of the syntax tree using `gyb`, a checkout of [apple/swift](https://github.com/apple/swift) is still required to build `master` of SwiftSyntax.
93
94
94
-
To build the `master` version of SwiftSyntax, check `swift-syntax` and `swift` out side by side
95
+
To build the `master` version of SwiftSyntax, follow the following instructions:
96
+
97
+
1. Check `swift-syntax` and `swift` out side by side:
98
+
95
99
```
96
100
- (enclosing directory)
97
101
- swift
98
102
- swift-syntax
99
103
```
100
104
101
-
And run `swift-syntax/build-script.py`. SwiftSyntax is now being built with the Swift compiler installed on the system.
105
+
2. Make sure you have a recent [master Swift toolchain](https://swift.org/download/#snapshots) installed.
106
+
3. Define the `TOOLCHAINS` environment variable as below to have the `swift` command point inside the toolchain:
107
+
108
+
```
109
+
$ export TOOLCHAINS=swift
110
+
```
111
+
112
+
4. To make sure everything is setup correctly, check the return statement of `xcrun --find swift`. It should point inside the latest installed master toolchain. If it points inside an Xcode toolchain, check that you exported the `TOOLCHAINS` environment variable correctly. If it points inside a version specific toolchain (like Swift 5.0-dev), you'll need to remove that toolchain.
113
+
5. Run `swift-syntax/build-script.py`.
114
+
115
+
If, despite following those instructions, you get compiler errors, the Swift toolchain might be too old to contain recent changes in Swift's SwiftSyntaxParser C library. In that case, you'll have to build the compiler and SwiftSyntax together with the following command:
Swift-CI will automatically run the code generation step whenever a new toolchain (development snapshot or release) is published. It should thus almost never be necessary to perform the above build yourself.
121
+
Swift-CI will automatically run the code generation step whenever a new toolchain (development snapshot or release) is published. It should thus almost never be necessary to perform the above build yourself.
104
122
105
123
Afterwards, SwiftPM can also generate an Xcode project to develop SwiftSyntax by running `swift package generate-xcodeproj`.
106
124
107
-
If you also want to run tests locally, read the section below as testing has additional requirements.
125
+
If you also want to run tests locally, read the section below as testing has additional requirements.
108
126
109
127
### Local Testing
110
-
SwiftSyntax uses some test utilities that need to be built as part of the Swift compiler project. To build the most recent version of SwiftSyntax and test it, follow the steps in [swift/README.md](https://github.com/apple/swift/blob/master/README.md) and pass `--llbuild --swiftpm --swiftsyntax` to the build script invocation to build SwiftSyntax and all its dependencies using the current `master` compiler.
128
+
SwiftSyntax uses some test utilities that need to be built as part of the Swift compiler project. To build the most recent version of SwiftSyntax and test it, follow the steps in [swift/README.md](https://github.com/apple/swift/blob/master/README.md) and pass `--llbuild --swiftpm --swiftsyntax` to the build script invocation to build SwiftSyntax and all its dependencies using the current `master` compiler.
111
129
112
-
SwiftSyntax can then be tested using the build script in `apple/swift` by running
130
+
SwiftSyntax can then be tested using the build script in `apple/swift` by running
0 commit comments