blob: 899847896a244b9916080c93dd48af8130e8253d [file] [log] [blame] [view]
nodir06cbaa02015-08-25 17:15:241# Updating Clang format binaries
andybons3322f762015-08-24 21:37:092
nodir06cbaa02015-08-25 17:15:243Instructions on how to update the [clang-format binaries](clang_format.md) that
4come with a checkout of Chromium.
andybons3322f762015-08-24 21:37:095
nodir06cbaa02015-08-25 17:15:246## Prerequisites
andybons3322f762015-08-24 21:37:097
Arthur Eubanks32c470c2022-03-22 00:22:428You'll also need permissions to upload to the appropriate google storage
9bucket. Chromium infrastructure team members have this, and others can be
10granted the permission based on need. If you need this permission, mention this
11in the tracking bug.
andybons3322f762015-08-24 21:37:0912
Arthur Eubanks32c470c2022-03-22 00:22:4213## Fetch and upload prebuilt clang-format binaries from recent clang rolls
andybons3322f762015-08-24 21:37:0914
Arthur Eubanks32c470c2022-03-22 00:22:4215Recent 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
17use clang-format packages built in recent successful dry run attempts at
18updating clang as mentioned [here](clang_sheriffing.md).
andybons3322f762015-08-24 21:37:0919
Arthur Eubanks32c470c2022-03-22 00:22:4220The following will, for each supported host architecture,
nodir06cbaa02015-08-25 17:15:2421
Arthur Eubanks32c470c2022-03-22 00:22:4222* 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
nodir06cbaa02015-08-25 17:15:2426
27```shell
Arthur Eubanks32c470c2022-03-22 00:22:4228cd $SRC/chromium/src
andybons3322f762015-08-24 21:37:0929
Arthur Eubanks32c470c2022-03-22 00:22:4230GS_PATH=gs://chromium-browser-clang-staging
31CLANG_REV=llvmorg-15-init-234-g567890abc-2
32
33echo Linux
34gsutil cp $GS_PATH/Linux_x64/clang-format-$CLANG_REV.tgz /tmp
35tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/linux64 --strip-component=1 bin/clang-format
36
37echo Win
38gsutil cp $GS_PATH/Win/clang-format-$CLANG_REV.tgz /tmp
39tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/win --strip-component=1 bin/clang-format.exe
40
41echo 'Mac x64'
42gsutil cp $GS_PATH/Mac/clang-format-$CLANG_REV.tgz /tmp
43tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/mac --strip-component=1 bin/clang-format
44mv buildtools/mac/clang-format buildtools/mac/clang-format.x64
45
46echo 'Mac arm64'
47gsutil cp $GS_PATH/Mac_arm64/clang-format-$CLANG_REV.tgz /tmp
48tar xf /tmp/clang-format-$CLANG_REV.tgz -C buildtools/mac --strip-component=1 bin/clang-format
49mv buildtools/mac/clang-format buildtools/mac/clang-format.arm64
50
51echo 'Uploading to GCS and creating sha1 files'
52upload_to_google_storage.py --bucket=chromium-clang-format buildtools/linux64/clang-format
53upload_to_google_storage.py --bucket=chromium-clang-format buildtools/win/clang-format.exe
54upload_to_google_storage.py --bucket=chromium-clang-format buildtools/mac/clang-format.x64
55upload_to_google_storage.py --bucket=chromium-clang-format buildtools/mac/clang-format.arm64
56
57# Clean up
58rm /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.
61rm buildtools/mac/clang-format.x64 buildtools/mac/clang-format.arm64
andybons3322f762015-08-24 21:37:0962```
63
nodir06cbaa02015-08-25 17:15:2464## Upload a CL according to the following template
andybons3322f762015-08-24 21:37:0965
nodir06cbaa02015-08-25 17:15:2466 Update clang-format binaries and scripts for all platforms.
andybons3322f762015-08-24 21:37:0967
nodir06cbaa02015-08-25 17:15:2468 I followed these instructions:
John Palmer046f9872021-05-24 01:24:5669 https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang_format_binaries.md
andybons3322f762015-08-24 21:37:0970
Arthur Eubanks32c470c2022-03-22 00:22:4271 The binaries were built at clang revision ####### on ##CRREV##.
andybons3322f762015-08-24 21:37:0972
Henrique Ferreiro804beaf2020-03-06 20:56:5973 Bug:
andybons3322f762015-08-24 21:37:0974
nodir06cbaa02015-08-25 17:15:2475The change should **always** include new `.sha1` files for each platform (we
76want to keep these in lockstep), should **never** include `clang-format`
77binaries directly. The change should **always** update `README.chromium`
andybons3322f762015-08-24 21:37:0978
nodir06cbaa02015-08-25 17:15:2479clang-format binaries should weigh in at 1.5MB or less. Watch out for size
80regressions.