forked from colobot/colobot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcc1e30
commit fd6ee1b
Showing
8 changed files
with
401 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: [push, pull_request] | ||
jobs: | ||
include-what-you-use: | ||
if: false | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Install dependencies | ||
run: sudo apt-get install iwyu build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libphysfs-dev gettext git po4a vorbis-tools libglm-dev | ||
- name: Download the code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Genarate a compilation database | ||
run: cmake -S . -B build -D=CMAKE_EXPORT_COMPILE_COMMANDS=ON -D=TESTS=ON | ||
- name: Generate iwyu mappings for C++ | ||
run: .github/workflows/include-what-you-use/c-to-cpp.py /usr/share/include-what-you-use ./build | ||
- name: Collect include-what-you-use recommendations | ||
run: | | ||
set -o pipefail; | ||
iwyu_tool \ | ||
-j 4 \ | ||
-p build \ | ||
-- \ | ||
-Xiwyu --no_default_mapping \ | ||
-Xiwyu --mapping_file=$PWD/build/iwyu.gcc.imp \ | ||
-Xiwyu --mapping_file=$PWD/.github/workflows/include-what-you-use/dependencies.imp \ | ||
| tee build/iwyu-log.txt | ||
- name: Apply include-what-you-use recommendations | ||
run: fix_include --safe_headers --noreorder --ignore_re '/lib/' < build/iwyu-log.txt | ||
- name: Check whether there are any changes | ||
run: git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
|
||
''' | ||
Generate C++-centric iwyu mappings. | ||
The default mappings shipped with iwyu prefer C library headers over their C++ counterparts. | ||
This script generates new mappings with swapped C and C++ headers | ||
Usage: | ||
c-to-cpp.py path/to/iwyu output/path | ||
''' | ||
|
||
import yaml, glob, pathlib, sys | ||
|
||
|
||
_, SRC_DIR, DST_DIR = sys.argv | ||
|
||
|
||
mapping = { | ||
"<assert.h>": "<cassert>", | ||
"<complex.h>": "<ccomplex>", | ||
"<ctype.h>": "<cctype>", | ||
"<errno.h>": "<cerrno>", | ||
"<fenv.h>": "<cfenv>", | ||
"<float.h>": "<cfloat>", | ||
"<inttypes.h>": "<cinttypes>", | ||
"<iso646.h>": "<ciso646>", | ||
"<limits.h>": "<climits>", | ||
"<locale.h>": "<clocale>", | ||
"<math.h>": "<cmath>", | ||
"<setjmp.h>": "<csetjmp>", | ||
"<signal.h>": "<csignal>", | ||
"<stdalign.h>": "<cstdalign>", | ||
"<stdarg.h>": "<cstdarg>", | ||
"<stdbool.h>": "<cstdbool>", | ||
"<stddef.h>": "<cstddef>", | ||
"<stdint.h>": "<cstdint>", | ||
"<stdio.h>": "<cstdio>", | ||
"<stdlib.h>": "<cstdlib>", | ||
"<string.h>": "<cstring>", | ||
"<tgmath.h>": "<ctgmath>", | ||
"<time.h>": "<ctime>", | ||
"<uchar.h>": "<cuchar>", | ||
"<wchar.h>": "<cwchar>", | ||
"<wctype.h>": "<cwctype>", | ||
} | ||
|
||
for k, v in list(mapping.items()): | ||
mapping[v] = k | ||
|
||
def transform_row(row): | ||
if 'ref' in row: | ||
return row | ||
((key, value),) = row.items() | ||
return { | ||
key: [ | ||
mapping.get(s, s) | ||
for s in value | ||
] | ||
} | ||
|
||
for name in pathlib.Path(SRC_DIR).glob('*.imp'): | ||
with name.open('r') as f: | ||
data = yaml.safe_load(f) | ||
data = [transform_row(row) for row in data] | ||
with (pathlib.Path(DST_DIR) / name.name).open('w') as f: | ||
yaml.dump(data, f) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ "include": [ "@\"gtest/.*\"", "private", "<gtest/gtest.h>", "public" ] }, | ||
{ "include": [ "@<gtest/.*>", "private", "<gtest/gtest.h>", "public" ] }, | ||
{ "include": [ "\"nlohmann/json.hpp\"", "private", "<nlohmann/json.hpp>", "public" ] }, | ||
{ "ref": "glm.imp" }, | ||
{ "include": [ "<pngconf.h>", "private", "<png.h>", "public" ] } | ||
] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters