nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 1 | # Updating Clang format binaries |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 3 | Instructions on how to update the [clang-format binaries](clang_format.md) that |
| 4 | come with a checkout of Chromium. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 5 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 6 | ## Prerequisites |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 7 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 8 | You'll also need permissions to upload to the appropriate google storage |
| 9 | bucket. Chromium infrastructure team members have this, and others can be |
| 10 | granted the permission based on need. If you need this permission, mention this |
| 11 | in the tracking bug. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 12 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 13 | ## Fetch and upload prebuilt clang-format binaries from recent clang rolls |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 14 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 15 | Recent clang rolls can be found via looking at the history of |
| 16 | [update.py](https://crsrc.org/c/tools/clang/scripts/update.py). You can also |
| 17 | use clang-format packages built in recent successful dry run attempts at |
| 18 | updating clang as mentioned [here](clang_sheriffing.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 19 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 20 | The following will, for each supported host architecture, |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 21 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 22 | * Fetch the corresponding clang-format package from the specified clang roll |
| 23 | * Extract and copy the clang-format binary to the proper directory |
| 24 | * Upload the binary into a publicly accessible google storage bucket, also |
| 25 | updating the corresponding `.sha1` files in the local checkout of Chrome |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 26 | |
| 27 | ```shell |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 28 | cd $SRC/chromium/src |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 29 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 30 | GS_PATH=gs://chromium-browser-clang-staging |
| 31 | CLANG_REV=llvmorg-15-init-234-g567890abc-2 |
| 32 | |
| 33 | echo Linux |
| 34 | gsutil cp $GS_PATH/Linux_x64/clang-format-$CLANG_REV.tgz /tmp |
| 35 | tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/linux64 --strip-component=1 bin/clang-format |
| 36 | |
| 37 | echo Win |
| 38 | gsutil cp $GS_PATH/Win/clang-format-$CLANG_REV.tgz /tmp |
| 39 | tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/win --strip-component=1 bin/clang-format.exe |
| 40 | |
| 41 | echo 'Mac x64' |
| 42 | gsutil cp $GS_PATH/Mac/clang-format-$CLANG_REV.tgz /tmp |
| 43 | tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/mac --strip-component=1 bin/clang-format |
| 44 | mv buildtools/mac/clang-format buildtools/mac/clang-format.x64 |
| 45 | |
| 46 | echo 'Mac arm64' |
| 47 | gsutil cp $GS_PATH/Mac_arm64/clang-format-$CLANG_REV.tgz /tmp |
| 48 | tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/mac --strip-component=1 bin/clang-format |
| 49 | mv buildtools/mac/clang-format buildtools/mac/clang-format.arm64 |
| 50 | |
| 51 | echo 'Uploading to GCS and creating sha1 files' |
| 52 | upload_to_google_storage.py --bucket=chromium-clang-format buildtools/linux64/clang-format |
| 53 | upload_to_google_storage.py --bucket=chromium-clang-format buildtools/win/clang-format.exe |
| 54 | upload_to_google_storage.py --bucket=chromium-clang-format buildtools/mac/clang-format.x64 |
| 55 | upload_to_google_storage.py --bucket=chromium-clang-format buildtools/mac/clang-format.arm64 |
| 56 | |
| 57 | # Clean up |
| 58 | rm /tmp/clang-format-$CLANG_REV.tgz |
| 59 | # These aren't in .gitignore because these mac per-arch paths only exist when updating clang-format. |
| 60 | # gclient runhooks puts these binaries at buildtools/mac/clang-format. |
| 61 | rm buildtools/mac/clang-format.x64 buildtools/mac/clang-format.arm64 |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 62 | ``` |
| 63 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 64 | ## Upload a CL according to the following template |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 65 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 66 | Update clang-format binaries and scripts for all platforms. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 67 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 68 | I followed these instructions: |
John Palmer | 046f987 | 2021-05-24 01:24:56 | [diff] [blame] | 69 | https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang_format_binaries.md |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 70 | |
Arthur Eubanks | 32c470c | 2022-03-22 00:22:42 | [diff] [blame^] | 71 | The binaries were built at clang revision ####### on ##CRREV##. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 72 | |
Henrique Ferreiro | 804beaf | 2020-03-06 20:56:59 | [diff] [blame] | 73 | Bug: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 74 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 75 | The change should **always** include new `.sha1` files for each platform (we |
| 76 | want to keep these in lockstep), should **never** include `clang-format` |
| 77 | binaries directly. The change should **always** update `README.chromium` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 78 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 79 | clang-format binaries should weigh in at 1.5MB or less. Watch out for size |
| 80 | regressions. |