Skip to content

Commit c0d62c7

Browse files
committed
iwyu.yml: generate and use macOS mapping file [skip ci]
1 parent f537feb commit c0d62c7

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/iwyu.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- os: macos-13
2727
image: ""
2828
stdlib: libc++ # no libstdc++ on macOS
29+
mapping_file_opt: '-Xiwyu --mapping_file=$(realpath ./macos.imp)'
2930
fail-fast: false
3031

3132
runs-on: ${{ matrix.os }}
@@ -108,6 +109,13 @@ jobs:
108109
install-deps: false
109110
cache: true
110111

112+
- name: Build macOS mappings
113+
run: |
114+
set -x
115+
116+
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-apple-libc.py
117+
python3 iwyu-mapgen-apple-libc.py $(xcrun --show-sdk-path)/usr/include > macos.imp
118+
111119
- name: Prepare CMake
112120
run: |
113121
# TODO: why does it build dmake in the next step?
@@ -135,14 +143,22 @@ jobs:
135143
run: |
136144
# -isystem/usr/lib/clang/17/include
137145
# TODO: remove -stdlib= - it should have been taken from the compilation database
138-
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
146+
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
139147
140148
- uses: actions/upload-artifact@v4
141149
if: success() || failure()
142150
with:
143151
name: Compilation Database (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }})
144152
path: ./cmake.output/compile_commands.json
145153

154+
- uses: actions/upload-artifact@v4
155+
if: ${{ contains(matrix.os, 'macos') && (success() || failure()) }}
156+
with:
157+
name: macOS Mappings
158+
path: |
159+
./iwyu-mapgen-apple-libc.py
160+
./macos.imp
161+
146162
- uses: actions/upload-artifact@v4
147163
if: success() || failure()
148164
with:

0 commit comments

Comments
 (0)