Skip to content

Commit 28a1b29

Browse files
committed
Document specially integrated modules and integration process.
1 parent 8febede commit 28a1b29

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,61 @@ See [Declarative String Processing Overview][decl-string]
99
## Requirements
1010

1111
- [Swift Trunk Development Snapshot](https://www.swift.org/download/#snapshots) DEVELOPMENT-SNAPSHOT-2022-02-03 or later.
12+
13+
## Integration with Swift
14+
15+
### Specially integrated modules
16+
17+
`_MatchingEngine`, `_CUnicode` and `_StringProcessing` are specially integrated modules that are built as part of apple/swift.
18+
19+
Specifically, `_MatchingEngine` contains the parser for regular expression literals and is built both as part of the compiler and as a core library. `_CUnicode` and `_StringProcessing` are built together as a core library named `_StringProcessing`.
20+
21+
| Module | Swift toolchain component |
22+
| ------------------- | ------------------------------------------------------------------------------------ |
23+
| `_MatchingEngine` | `SwiftCompilerSources/Sources/ExperimentalRegex` and `stdlib/public/_MatchingEngine` |
24+
| `_CUnicode` | `stdlib/public/_StringProcessing` |
25+
| `_StringProcessing` | `stdlib/public/_StringProcessing` |
26+
27+
### Branches
28+
29+
`main` and `release/` branches correspond to branches in apple/swift of the same name. They are expected to build together and pass all tests.
30+
31+
| apple/swift branch | apple/swift-experimental-string-processing branch |
32+
| ------------------- | ----------------------------------------------------- |
33+
| main | main |
34+
| release/5.7 | release/5.7 |
35+
| ... | ... |
36+
37+
## Pull request testing
38+
39+
Pull requests are tested via Swift CI. Unlike other packages, sources from this package (the `_MatchingEngine` module) are used directly by the Swift compiler, so any change to these sources will be cross-tested with the compiler using `build-script` in addition to SwiftPM testing. Other sources are tested using SwiftPM only.
40+
41+
### Workflow
42+
43+
- Create pull requests.
44+
- Create a pull request in apple/swift-experimental-string-processing from `main` to `swift/main`, e.g. "[Integration] main -> swift/main".
45+
- If apple/swift needs to be modified together, create a pull request in apple/swift.
46+
- Trigger CI.
47+
- In the apple/swift-experimental-string-processing pull request, trigger CI using the following command (replacing `<PR NUMBER>` with the apple/swift pull request number, if any):
48+
```
49+
apple/swift#<PR NUMBER> # use this line only if there is an corresponding apple/swift PR
50+
@swift-ci please test
51+
```
52+
- In the apple/swift pull request (if any), trigger CI using the following command (replacing `<PR NUMBER>` with the apple/swift-experimental-string-processing pull request number):
53+
```
54+
apple/swift-experimental-string-processing#<PR NUMBER>
55+
@swift-ci please test
56+
```
57+
- Merge when approved.
58+
- Merge the pull request in apple/swift-experimental-string-processing as a **merge commit**.
59+
- Merge the pull request in apple/swift, if any.
60+
61+
## Development notes
62+
63+
Compiler integration can be tricky. Use special caution when developing `_MatchingEngine`, `_CUnicode` and `_StringProcessing` modules.
64+
65+
- Do not change the names of these modules without due approval from compiler and infrastructure teams.
66+
- Do not modify the existing ABI between the regular expression parser and the Swift compiler unless absolutely necessary.
67+
- Always minimize the number of lockstep integrations, i.e. when apple/swift-experimental-string-processing and apple/swift have to change together.
68+
- In `_StringProcessing`, do not write fully qualified references to symbols in `_CUnicode`, and always wrap `import _CUnicode` in a `#if canImport(_CUnicode)`. This is because `_CUnicode` is built as part of `_StringProcessing` with CMake.
69+
- In `_MatchingEngine`, do not write fully qualified references to `_MatchingEngine` itself. This is because `_MatchingEngine` is built as `ExperimentalRegex` in `SwiftCompilerSources/` with CMake.

0 commit comments

Comments
 (0)