build: fix clang format location helper (#42926)
* build: fix clang format location helper (again) * use gclient sync in lint workflow for downloading clang-format
This commit is contained in:
parent
85cb6d9476
commit
5951712f2e
2 changed files with 18 additions and 11 deletions
6
.github/workflows/pipeline-electron-lint.yml
vendored
6
.github/workflows/pipeline-electron-lint.yml
vendored
|
@ -53,10 +53,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||||
|
|
||||||
sha1_path='buildtools/linux64/clang-format.sha1'
|
mkdir -p src/buildtools
|
||||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/${sha1_path}?format=TEXT" | base64 -d > "src/${sha1_path}"
|
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||||
|
|
||||||
download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s "src/${sha1_path}"
|
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||||
- name: Run Lint
|
- name: Run Lint
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -4,6 +4,7 @@ import contextlib
|
||||||
import errno
|
import errno
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -184,14 +185,20 @@ def get_electron_exec():
|
||||||
|
|
||||||
def get_buildtools_executable(name):
|
def get_buildtools_executable(name):
|
||||||
buildtools = os.path.realpath(os.path.join(ELECTRON_DIR, '..', 'buildtools'))
|
buildtools = os.path.realpath(os.path.join(ELECTRON_DIR, '..', 'buildtools'))
|
||||||
chromium_platform = {
|
|
||||||
'darwin': 'mac',
|
if sys.platform == 'darwin':
|
||||||
'linux': 'linux64',
|
chromium_platform = 'mac_arm64' if platform.machine() == 'arm64' else 'mac'
|
||||||
'linux2': 'linux64',
|
elif sys.platform in ['win32', 'cygwin']:
|
||||||
'win32': 'win',
|
chromium_platform = 'win'
|
||||||
'cygwin': 'win',
|
elif sys.platform in ['linux', 'linux2']:
|
||||||
}[sys.platform]
|
chromium_platform = 'linux64'
|
||||||
path = os.path.join(buildtools, chromium_platform, name)
|
else:
|
||||||
|
raise Exception(f"Unsupported platform: {sys.platform}")
|
||||||
|
|
||||||
|
if name == 'clang-format':
|
||||||
|
path = os.path.join(buildtools, chromium_platform, 'format', name)
|
||||||
|
else:
|
||||||
|
path = os.path.join(buildtools, chromium_platform, name)
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
path += '.exe'
|
path += '.exe'
|
||||||
return path
|
return path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue