Skip to content

Commit 5e36b04

Browse files
authored
iwyu.yml: generate and use macOS mapping file [skip ci] (danmar#7465)
1 parent 9e547a3 commit 5e36b04

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.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 }}
@@ -110,6 +111,13 @@ jobs:
110111
install-deps: false
111112
cache: true
112113

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

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

0 commit comments

Comments
 (0)