From 6f0a736c6cb4eaaef41c59d7403b241286a592d4 Mon Sep 17 00:00:00 2001 From: Margen67 Date: Fri, 24 Jan 2025 06:39:13 -0800 Subject: [PATCH] [xb] Print clang-format version --- .github/workflows/Linux_build.yml | 2 -- .github/workflows/Windows_build.yml | 2 -- xenia-build | 20 ++++++++++---------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/Linux_build.yml b/.github/workflows/Linux_build.yml index 8a0e9ae07..3c263a942 100644 --- a/.github/workflows/Linux_build.yml +++ b/.github/workflows/Linux_build.yml @@ -45,8 +45,6 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@main - - name: Check Clang-Format Version - run: clang-format --version - name: Lint run: ./xb lint --all diff --git a/.github/workflows/Windows_build.yml b/.github/workflows/Windows_build.yml index e13ee7bbf..fb961109c 100644 --- a/.github/workflows/Windows_build.yml +++ b/.github/workflows/Windows_build.yml @@ -53,8 +53,6 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@main - - name: Check Clang-Format Version - run: clang-format --version - name: Lint run: .\xb lint --all diff --git a/xenia-build b/xenia-build index 50e4fe79d..8145fa2da 100755 --- a/xenia-build +++ b/xenia-build @@ -435,14 +435,10 @@ def get_clang_format_binary(): Returns: A path to the clang-format executable. """ + clang_format_minimum_ver='18' attempts = [ 'clang-format-19', - 'clang-format-18', - 'clang-format-17', - 'clang-format-16', - 'clang-format-15', - 'clang-format-14', - 'clang-format-13', + 'clang-format-' + clang_format_minimum_ver, 'clang-format', ] if sys.platform == 'win32': @@ -452,10 +448,14 @@ def get_clang_format_binary(): attempts.append(os.path.join(os.environ['VCINSTALLDIR'], 'Tools', 'Llvm', 'bin', 'clang-format.exe')) for binary in attempts: if has_bin(binary): + shell_call([ + binary, + '--version', + ]) return binary print('ERROR: clang-format is not on PATH') print('LLVM is available from https://llvm.org/releases/download.html') - print('At least version 13 is required.') + print('At least version ' + clang_format_minimum_ver + ' is required.') print('See docs/style_guide.md for instructions on how to get it.') sys.exit(1) @@ -851,12 +851,12 @@ class BaseBuildCommand(Command): else: result = subprocess.call([ 'cmake', - '-S build/', - '-B build/build_%s' % (args['config']), + '-Sbuild', + '-Bbuild/build_%s' % (args['config']), '-DCMAKE_BUILD_TYPE=%s' % (args['config'].title()), '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++', - '-G Ninja' + '-GNinja' ] + pass_args, shell=False, env=dict(os.environ)) print('') if result != 0: