From c0d62c7302b0a5b2b12a03a783a8460023f71ba1 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 13 Apr 2025 22:32:16 +0200 Subject: [PATCH] iwyu.yml: generate and use macOS mapping file [skip ci] --- .github/workflows/iwyu.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 27c93c02049..62844ef4127 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -26,6 +26,7 @@ jobs: - os: macos-13 image: "" stdlib: libc++ # no libstdc++ on macOS + mapping_file_opt: '-Xiwyu --mapping_file=$(realpath ./macos.imp)' fail-fast: false runs-on: ${{ matrix.os }} @@ -108,6 +109,13 @@ jobs: install-deps: false cache: true + - name: Build macOS mappings + run: | + set -x + + wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-apple-libc.py + python3 iwyu-mapgen-apple-libc.py $(xcrun --show-sdk-path)/usr/include > macos.imp + - name: Prepare CMake run: | # TODO: why does it build dmake in the next step? @@ -135,7 +143,7 @@ jobs: run: | # -isystem/usr/lib/clang/17/include # TODO: remove -stdlib= - it should have been taken from the compilation database - iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} > iwyu.log + iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} ${{ matrix.mapping_file_opt }} > iwyu.log - uses: actions/upload-artifact@v4 if: success() || failure() @@ -143,6 +151,14 @@ jobs: name: Compilation Database (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }}) path: ./cmake.output/compile_commands.json + - uses: actions/upload-artifact@v4 + if: ${{ contains(matrix.os, 'macos') && (success() || failure()) }} + with: + name: macOS Mappings + path: | + ./iwyu-mapgen-apple-libc.py + ./macos.imp + - uses: actions/upload-artifact@v4 if: success() || failure() with: