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
@@ -52,37 +52,55 @@ Then, import `SwiftSyntax` in your Swift code.
52
52
## Contributing
53
53
54
54
### Building SwiftSyntax from `master`
55
+
55
56
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.
56
57
57
-
To build the `master` version of SwiftSyntax, check `swift-syntax` and `swift` out side by side
58
+
To build the `master` version of SwiftSyntax, follow the following instructions:
59
+
60
+
1. Check `swift-syntax` and `swift` out side by side:
61
+
58
62
```
59
63
- (enclosing directory)
60
64
- swift
61
65
- swift-syntax
62
66
```
63
67
64
-
And run `swift-syntax/build-script.py`. SwiftSyntax is now being built with the Swift compiler installed on the system.
68
+
2. Make sure you have a recent master Swift toolchain installed.
69
+
3. Define the `TOOLCHAINS` environment variable as below to have the `swift` command point inside the toolchain:
70
+
71
+
```
72
+
$ export TOOLCHAINS=swift
73
+
```
74
+
75
+
4. To make sure everything is setup correctly, check the return statement of `xcrun --find swift`. It should point inside the master toolchain.
76
+
5. Run `swift-syntax/build-script.py`.
77
+
78
+
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.
84
+
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.
67
85
68
86
Afterwards, SwiftPM can also generate an Xcode project to develop SwiftSyntax by running `swift package generate-xcodeproj`.
69
87
70
-
If you also want to run tests locally, read the section below as testing has additional requirements.
88
+
If you also want to run tests locally, read the section below as testing has additional requirements.
71
89
72
90
### Local Testing
73
-
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.
91
+
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.
74
92
75
-
SwiftSyntax can then be tested using the build script in `apple/swift` by running
93
+
SwiftSyntax can then be tested using the build script in `apple/swift` by running
0 commit comments