Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pigweed set up clang-format on M1/M2 macs as well. #26579

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,8 @@ jobs:
if: always()
run: |
git grep -n 'SuccessOrExit(CHIP_ERROR' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0

- name: Check that our hardcoded SHA for clang-format on ARM mac matches the pigweed SHA.
if: always()
run: |
./scripts/lints/clang-format-version-matches.py
43 changes: 43 additions & 0 deletions scripts/lints/clang-format-version-matches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
#
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import json
import os

CHIP_ROOT_DIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), '../..'))


def readClangRevision(jsonFileName):
with open(os.path.join(CHIP_ROOT_DIR, jsonFileName)) as file:
data = json.load(file)

packages = data['packages']
for package in packages:
if package['path'].startswith('fuchsia/third_party/clang/'):
return package['tags']

raise Exception('Could not find clang package in %s' % jsonFileName)


pigweed_revision = readClangRevision('third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json')

our_file = 'scripts/setup/clang.json'
our_revision = readClangRevision(our_file)

if our_revision != pigweed_revision:
raise Exception('In %s, "%s" should be changed to "%s"' % (our_file, our_revision, pigweed_revision))
9 changes: 9 additions & 0 deletions scripts/setup/clang.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"packages": [
{
"path": "fuchsia/third_party/clang/mac-arm64",
"platforms": ["mac-arm64"],
"tags": ["git_revision:3a20597776a5d2920e511d81653b4d2b6ca0c855"]
}
]
}
1 change: 1 addition & 0 deletions scripts/setup/environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cipd_package_files": [
"third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/arm.json",
"third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json",
"scripts/setup/clang.json",
"scripts/setup/python.json",
"scripts/setup/zap.json"
],
Expand Down