Skip to content

Commit 996c6d3

Browse files
authored
Merge pull request #170 from rxwei/integration-doc
Document specially integrated modules and integration process.
2 parents e8c84a1 + 3ab3b17 commit 996c6d3

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,65 @@ 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+
`_MatchingEngine`, `_CUnicode` and `_StringProcessing` are specially integrated modules that are built as part of apple/swift.
16+
17+
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`.
18+
19+
| Module | Swift toolchain component |
20+
| ------------------- | ------------------------------------------------------------------------------------ |
21+
| `_MatchingEngine` | `SwiftCompilerSources/Sources/ExperimentalRegex` and `stdlib/public/_MatchingEngine` |
22+
| `_CUnicode` | `stdlib/public/_StringProcessing` |
23+
| `_StringProcessing` | `stdlib/public/_StringProcessing` |
24+
25+
### Branching scheme
26+
27+
#### Development branch
28+
29+
The `main` branch is the branch for day-to-day development. Generally, you should create PRs against this branch.
30+
31+
#### Swift integration branches
32+
33+
Branches whose name starts with `swift/` are Swift integration branches similar to those in [apple/llvm-project](https://github.com/apple/llvm-project). For each branch, dropping the `swift/` prefix is the corresponding branch in [apple/swift](https://github.com/apple/swift).
34+
35+
| apple/swift branch | apple/swift-experimental-string-processing branch |
36+
| ------------------- | ----------------------------------------------------- |
37+
| main | swift/main |
38+
| release/5.7 | swift/release/5.7 |
39+
| ... | swift/... |
40+
41+
A pair of corresponding branches are expected to build successfully together and pass all tests.
42+
43+
### Integration workflow
44+
45+
To integrate the latest changes in apple/swift-experimental-string-processing to apple/swift, carefully follow the workflow:
46+
47+
- Create pull requests.
48+
- Create a pull request in apple/swift-experimental-string-processing from `main` to `swift/main`, e.g. "[Integration] main -> swift/main".
49+
- If apple/swift needs to be modified to work with the latest `main` in apple/swift-experimental-string-processing, create a pull request in apple/swift.
50+
- Trigger CI.
51+
- 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):
52+
```
53+
apple/swift#<PR NUMBER> # use this line only if there is an corresponding apple/swift PR
54+
@swift-ci please test
55+
```
56+
- 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):
57+
```
58+
apple/swift-experimental-string-processing#<PR NUMBER>
59+
@swift-ci please test
60+
```
61+
- Merge when approved.
62+
- Merge the pull request in apple/swift-experimental-string-processing as a **merge commit**.
63+
- Merge the pull request in apple/swift (if any).
64+
65+
### Development notes
66+
67+
Compiler integration can be tricky. Use special caution when developing `_MatchingEngine`, `_CUnicode` and `_StringProcessing` modules.
68+
69+
- Do not change the names of these modules without due approval from compiler and infrastructure teams.
70+
- Do not modify the existing ABI (e.g. C API, serialization format) between the regular expression parser and the Swift compiler unless absolutely necessary.
71+
- Always minimize the number of lockstep integrations, i.e. when apple/swift-experimental-string-processing and apple/swift have to change together. Whenever possible, introduce new API first, migrate Swift compiler onto it, and then deprecate old API. Use versioning if helpful.
72+
- 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.
73+
- 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)