Skip to content

Commit 6c218f0

Browse files
committed
iwyu.yml: generate and use macOS mapping file
1 parent 95d36fe commit 6c218f0

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
@@ -17,6 +17,7 @@ jobs:
1717
- os: macos-13
1818
image: ""
1919
stdlib: libc++ # no libstdc++ on macOS
20+
mapping_file_opt: '-Xiwyu --mapping_file=$(realpath ./macos.imp)'
2021
fail-fast: false
2122

2223
runs-on: ${{ matrix.os }}
@@ -99,6 +100,13 @@ jobs:
99100
install-deps: false
100101
cache: true
101102

103+
- name: Build macOS mappings
104+
run: |
105+
set -x
106+
107+
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-apple-libc.py
108+
python3 iwyu-mapgen-apple-libc.py $(xcrun --show-sdk-path)/usr/include > macos.imp
109+
102110
- name: Prepare CMake
103111
run: |
104112
# TODO: why does it build dmake in the next step?
@@ -126,14 +134,22 @@ jobs:
126134
run: |
127135
# -isystem/usr/lib/clang/17/include
128136
# TODO: remove -stdlib= - it should have been taken from the compilation database
129-
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
137+
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
130138
131139
- uses: actions/upload-artifact@v4
132140
if: success() || failure()
133141
with:
134142
name: Compilation Database (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }})
135143
path: ./cmake.output/compile_commands.json
136144

145+
- uses: actions/upload-artifact@v4
146+
if: ${{ contains(matrix.os, 'macos') && (success() || failure()) }}
147+
with:
148+
name: macOS Mappings
149+
path: |
150+
./iwyu-mapgen-apple-libc.py
151+
./macos.imp
152+
137153
- uses: actions/upload-artifact@v4
138154
if: success() || failure()
139155
with:

0 commit comments

Comments
 (0)