Skip to content

Commit ce81aa3

Browse files
Add daily work guide
1 parent 9107f32 commit ce81aa3

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

docs/upstreaming.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,58 @@ If our upstreaming commits break ci.swift.org, we should revert the commit or fi
3636
## Milestones
3737

3838
1. Upstream compiler patches
39-
If we upstream all of our compiler patches, we can stop building our own compiler and use the official Swift compiler instead.
40-
After that, we can focus on building standard library and save much time.
39+
40+
If we upstream all of our compiler patches, we can stop building our own compiler and use the official Swift compiler instead.
41+
After that, we can focus on building standard library and save much time.
4142

4243
2. Upstream standard library patches
4344
3. Set up WebAssembly check in ci.swift.org and make it mandatory to pass the check to merge a PR like [the Windows check](https://ci-external.swift.org/job/swift-PR-windows/)
45+
46+
## Checkout-build-edit-test cycle
47+
48+
Building the Swift toolchain is a time-consuming process. We recommend to use powerful machine or cloud service to build the toolchain. (FYI: [Yuta](https://github.com/kateinoigakukun) usually uses [CPX51 by Hetzner](https://pcr.cloud-mercato.com/providers/hetzner/flavors/cpx51))
49+
50+
Please basically follow the [README](../README.md) process to set up the build environment.
51+
52+
### Checkout
53+
54+
If it's first time to build or patch files are changed, you need to checkout the source code:
55+
56+
```
57+
./tools/git-swift-workspace --scheme main
58+
```
59+
60+
### Build
61+
62+
If you want to build the whole toolchain, run the following command:
63+
64+
```
65+
./tools/build/build-toolchain.sh
66+
```
67+
68+
If you already built the compiler and want to build only the standard library for WebAssembly, run the following command:
69+
70+
```
71+
./tools/build/build-toolchain.sh --skip-build-host-toolchain
72+
```
73+
74+
### Edit
75+
76+
If you want to add a new patch, edit the Swift source code and commit it on the current branch, which is created by `git-swift-workspace` and includes our existing patches.
77+
78+
If you want to edit an existing patch (e.g. to resolve conflicts with upstream changes, or to improve the patch), please edit the commit history by `git rebase -i`.
79+
80+
After editing the source code, you need to rebuild the toolchain, and if you are sure that the patch is OK, you can update our `.patch` files by the follwoing command:
81+
82+
```
83+
./tools/git-swift-update-patch --scheme main
84+
```
85+
86+
87+
### Test
88+
89+
The above build command does not run tests. If you want to run tests, run the following command:
90+
91+
```
92+
ninja -C ../target-build/swift-stdlib-wasi-wasm32 check-swift-wasi-wasm32-custom
93+
```

0 commit comments

Comments
 (0)