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
Tags will be created forevery nightly buildin the form of `swift-DEVELOPMENT-SNAPSHOT-<DATE>`. The revision field
77
74
should be specified with the intended tag.
@@ -85,7 +82,7 @@ SwiftSyntax depends on the `lib_InternalSwiftSyntaxParser.dylib/.so` library whi
85
82
86
83
You can either copy `lib_InternalSwiftSyntaxParser.dylib/.so` directly from the toolchain or even build it yourself from the [Swift repository](https://github.com/apple/swift), as long as you are matching the same tags or branches in both the SwiftSyntax and Swift repositories. To build it for the host os (macOS/linux) use the following steps:
You need to build `lib_InternalSwiftSyntaxParser.dylib` yourself, you cannot copy it from the toolchain. Follow the instructions above and change the invocation of `build-parser-lib` accordingly:
@@ -143,28 +140,26 @@ Since SwiftSyntax relies on definitions in the main Swift repository to generate
143
140
To build the `main` branch of SwiftSyntax, follow the following instructions:
144
141
145
142
1. Check `swift-syntax` and `swift` out side by side:
146
-
147
-
```
148
-
- (enclosing directory)
149
-
- swift
150
-
- swift-syntax
151
-
```
143
+
```
144
+
- (enclosing directory)
145
+
- swift
146
+
- swift-syntax
147
+
```
152
148
153
149
2. Make sure you have a recent [Trunk Swift Toolchain](https://swift.org/download/#snapshots) installed.
154
150
3. Define the `TOOLCHAINS` environment variable as below to have the `swift`command point inside the toolchain:
155
151
156
-
```
157
-
$ export TOOLCHAINS=swift
158
-
```
152
+
```bash
153
+
$ export TOOLCHAINS=swift
154
+
```
159
155
160
156
4. To make sure everything is set up correctly, check the return statement of `xcrun --find swift`. It should point inside the latest installed trunk development 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.
161
157
5. Run `swift-syntax/build-script.py`.
158
+
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:
162
159
163
-
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.
170
165
@@ -173,12 +168,15 @@ Afterward, SwiftPM can also generate an Xcode project to develop SwiftSyntax by
173
168
If you also want to run tests locally, read the section below as testing has additional requirements.
174
169
175
170
### Local Testing
171
+
176
172
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/main/README.md) and pass `--llbuild --swiftpm --swiftsyntax` to the build script invocation to build SwiftSyntax and all its dependencies using the current trunk (`main`) compiler.
177
173
178
174
SwiftSyntax can then be tested using the build script in `apple/swift` by running
Replace `<#Specify Release tag#>` by the version of SwiftSyntaxBuilder that you want to use. See this following [table](https://github.com/apple/swift-syntax#declare-swiftpm-dependency-with-release-tag) for mapping details.
59
+
60
+
Then, import `SwiftSyntaxBuilder` in your Swift code.
61
+
62
+
Note that SwiftSyntaxBuilder has limited support for pretty-printing code. We generally suggest running a formatter like [swift-format](https://github.com/apple/swift-format) on the generated code.
63
+
64
+
### Reporting Issues
65
+
66
+
If you should hit any issues while using SwiftSyntaxBuilder, we appreciate bug reports on [bugs.swift.org](https://bugs.swift.org) in the [SwiftSyntax component](https://bugs.swift.org/issues/?jql=component%20%3D%20SwiftSyntax).
67
+
68
+
## License
69
+
70
+
Please see [LICENSE](https://github.com/apple/swift-syntax#license) for more information.
0 commit comments