xref: /aosp_15_r20/external/toolchain-utils/llvm_tools/patch_sync/README.md (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1*760c253cSXin Li# Overview
2*760c253cSXin Li
3*760c253cSXin LiSee go/llvm-patch-sync for motivation, diagrams, and design docs. The
4*760c253cSXin Li`patch_sync` tool also has a detailed `--help`, which can be quickly
5*760c253cSXin Liaccessed via `cargo run -- --help`, `cargo run -- transpose --help`,
6*760c253cSXin Liand `cargo run -- show --help`.
7*760c253cSXin Li
8*760c253cSXin Li## Building
9*760c253cSXin Li
10*760c253cSXin Li```rs
11*760c253cSXin Li# Release version
12*760c253cSXin Licargo build --release
13*760c253cSXin Li
14*760c253cSXin Li# Debug version
15*760c253cSXin Licargo build
16*760c253cSXin Li```
17*760c253cSXin Li
18*760c253cSXin LiThe executable will then exist at `./target/(debug|release)/patch_sync`.
19*760c253cSXin Li
20*760c253cSXin Li## Running Unittests
21*760c253cSXin Li
22*760c253cSXin Li```rs
23*760c253cSXin Licargo test
24*760c253cSXin Li```
25*760c253cSXin Li
26*760c253cSXin LiBecause `patch_sync` requires a specific file system layout to work correctly,
27*760c253cSXin Lithe unittests are unfortunately fairly sparse. Full testing will likely require
28*760c253cSXin Lirunning `patch_sync transpose ...` with the necessary arguments.
29*760c253cSXin Li
30*760c253cSXin Li## Example Transpose Command
31*760c253cSXin Li
32*760c253cSXin LiThis command will:
33*760c253cSXin Li
34*760c253cSXin Li1. Sync the Android toolchain and ChromiumOS overlay repositories.
35*760c253cSXin Li2. Find any new patches between the current version and the base ref.
36*760c253cSXin Li3. Copy any new and applicable patches into each repository.
37*760c253cSXin Li
38*760c253cSXin Li```
39*760c253cSXin Li./patch_sync transpose \
40*760c253cSXin Li  --sync \
41*760c253cSXin Li  --aosp-checkout "${HOME}/android" \
42*760c253cSXin Li  --aosp-base-ref "${base_aosp_git_hash}" \
43*760c253cSXin Li  --cros-checkout "${HOME}/chromiumos" \
44*760c253cSXin Li  --overlay-base-ref "${base_cros_git_hash}"
45*760c253cSXin Li```
46