Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit 58fff42

Browse files
author
featherless
committed
Merge branch 'release-candidate' into stable
2 parents e0e1a34 + 99ed3c7 commit 58fff42

3 files changed

Lines changed: 46 additions & 42 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 1.2.1
2+
3+
This patch release uses a more explicit invocation to calculate the sha of the clang-format
4+
binaries. The readme has also been updated to include a more generalizable installation method.
5+
6+
The invocation `openssl sha` appears to have been removed from recent continuous integration
7+
machines. This release now uses a more explicit `openssl sha256` invocation.
8+
19
# 1.2.0
210

311
This minor release updates clang-format to r352957.

README.md

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,50 +48,46 @@ be defined as environment variables in your Kokoro configuration.
4848
Example installation script using a pre-built clang-format binary:
4949

5050
```bash
51-
CLANG_FORMAT_VERSION="r343360"
52-
CLANG_FORMAT_SHA="9d2a3aeaee65f09ae5405dd33812d167fadd48aba712965cdb3238e5d8837255"
53-
GIT_CLANG_FORMAT_VERSION="c510fac5695e904b43d5bf0feee31cc9550f110e"
54-
GIT_CLANG_FORMAT_SHA="1f6cfad79f90ea202dcf2d52a360186341a589cdbfdee05b0e7694f912aa9820"
55-
56-
install_clang_format() {
57-
mkdir bin
58-
pushd bin >> /dev/null
59-
60-
echo "Downloading clang-format..."
61-
curl -Ls "https://github.com/material-foundation/clang-format/releases/download/$CLANG_FORMAT_VERSION/clang-format" -o "clang-format"
62-
if openssl sha -sha256 "clang-format" | grep -q "$CLANG_FORMAT_SHA"; then
63-
echo "SHAs match. Proceeding."
64-
else
65-
echo "clang-format does not match sha. Aborting."
66-
exit 1
51+
# Fail on any error.
52+
set -e
53+
54+
REPO="<TODO: Your github repo. E.g. material-foundation/clang-format-ci>"
55+
56+
# The tagged version of https://github.com/material-foundation/clang-format-ci to check out.
57+
# A * wildcard can be used to check out the latest release of a given version.
58+
CLANG_FORMAT_CI_VERSION="v1.*"
59+
60+
CLANG_FORMAT_CI_SRC_DIR=".clang-format-ci-src"
61+
62+
# Will run git clang-format on the branch's changes, reporting a failure if the linter generated any
63+
# stylistic changes.
64+
#
65+
# For local runs, you must set the following environment variables:
66+
#
67+
# GITHUB_API_TOKEN -> Create a token here: https://github.com/settings/tokens.
68+
# Must have public_repo scope.
69+
# KOKORO_GITHUB_PULL_REQUEST_NUMBER="###" -> The PR # you want to post the API diff results to.
70+
# KOKORO_GITHUB_PULL_REQUEST_COMMIT="..." -> The PR commit you want to post to.
71+
#
72+
# And install the following tools:
73+
#
74+
# - clang-format
75+
# - git-clang-format
76+
lint_clang_format() {
77+
if [ ! -d "$CLANG_FORMAT_CI_SRC_DIR" ]; then
78+
git clone --recurse-submodules https://github.com/material-foundation/clang-format-ci.git "$CLANG_FORMAT_CI_SRC_DIR"
6779
fi
68-
chmod +x "clang-format"
69-
70-
echo "Downloading git-clang-format..."
71-
curl -Ls "https://raw.githubusercontent.com/llvm-mirror/clang/$GIT_CLANG_FORMAT_VERSION/tools/clang-format/git-clang-format" -o "git-clang-format"
72-
if openssl sha -sha256 "git-clang-format" | grep -q "$GIT_CLANG_FORMAT_SHA"; then
73-
echo "SHAs match. Proceeding."
74-
else
75-
echo "git-clang-format does not match sha. Aborting."
76-
exit 1
77-
fi
78-
chmod +x "git-clang-format"
7980

80-
export PATH="$(pwd):$PATH"
81+
pushd "$CLANG_FORMAT_CI_SRC_DIR"
82+
git fetch > /dev/null
83+
TAG=$(git tag --sort=v:refname -l "$CLANG_FORMAT_CI_VERSION" | tail -n1)
84+
git checkout "$TAG" > /dev/null
85+
echo "Using clang-format-ci $TAG"
86+
popd
8187

82-
popd >> /dev/null
88+
.clang-format-ci-src/from-kokoro.sh "$REPO"
8389
}
8490

85-
if ! git clang-format -h > /dev/null 2> /dev/null; then
86-
install_clang_format
87-
fi
88-
89-
git clone --branch <TODO: version> https://github.com/material-foundation/clang-format-ci.git
90-
./clang-format-ci/check-pull-request.sh \
91-
--api_token "$API_TOKEN" \
92-
--repo "$REPO" \
93-
--pr "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" \
94-
--commit "$KOKORO_GITHUB_PULL_REQUEST_COMMIT" \
95-
--target_branch "$KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH"
91+
lint_clang_format
9692
```
9793

from-kokoro.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ lint_clang_format() {
146146
# Install clang-format
147147
echo "Downloading clang-format..."
148148
curl -Ls "https://github.com/material-foundation/clang-format/releases/download/$CLANG_FORMAT_TAG/clang-format" -o "clang-format"
149-
if openssl sha -sha256 "clang-format" | grep -q "$CLANG_FORMAT_SHA"; then
149+
if openssl sha256 -sha256 "clang-format" | grep -q "$CLANG_FORMAT_SHA"; then
150150
echo "SHAs match. Proceeding."
151151
else
152152
echo "clang-format does not match sha. Aborting."
@@ -157,7 +157,7 @@ lint_clang_format() {
157157
echo "Downloading git-clang-format..."
158158
# Install git-clang-format
159159
curl -Ls "https://raw.githubusercontent.com/llvm-mirror/clang/$GIT_CLANG_FORMAT_COMMIT/tools/clang-format/git-clang-format" -o "git-clang-format"
160-
if openssl sha -sha256 "git-clang-format" | grep -q "$GIT_CLANG_FORMAT_SHA"; then
160+
if openssl sha256 -sha256 "git-clang-format" | grep -q "$GIT_CLANG_FORMAT_SHA"; then
161161
echo "SHAs match. Proceeding."
162162
else
163163
echo "git-clang-format does not match sha. Aborting."

0 commit comments

Comments
 (0)