mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Add dockerized include what you use tool
Introduces a tool that organizes C/C++ header includes. The tools output should still be manually reviewed by a contributor.
This commit is contained in:
23
tools/iwyu/README.md
Normal file
23
tools/iwyu/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Overview
|
||||
|
||||
IWYU - [include what you use](https://github.com/include-what-you-use/include-what-you-use)
|
||||
is a tool that can detect and correct C/C++ include errors
|
||||
|
||||
# Usage
|
||||
|
||||
```
|
||||
TARGET=<your target> docker compose up
|
||||
```
|
||||
|
||||
Automatically apply suggestions:
|
||||
|
||||
```
|
||||
TARGET=<your target> docker compose run iwyu | tee suggestions
|
||||
cat suggestions | python3 ~/include-what-you-use/fix_includes.py
|
||||
```
|
||||
|
||||
Apply only removal suggestions
|
||||
|
||||
```
|
||||
cat suggestions | grep "should add these line\|The full include-list\|should remove these lines\|^-" | python3 ~/include-what-you-use/fix_includes.py
|
||||
```
|
||||
39
tools/iwyu/docker-compose.yaml
Normal file
39
tools/iwyu/docker-compose.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
services:
|
||||
iwyu:
|
||||
image: iwyu
|
||||
build:
|
||||
dockerfile_inline: |
|
||||
FROM ran-base
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt update && \
|
||||
apt install -y wget gnupg && \
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
|
||||
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" > /etc/apt/sources.list.d/llvm.list && \
|
||||
apt update
|
||||
RUN apt install -y \
|
||||
git \
|
||||
cmake \
|
||||
build-essential \
|
||||
clang-14 \
|
||||
libclang-14-dev \
|
||||
ninja-build \
|
||||
libyaml-cpp-dev
|
||||
WORKDIR /iwyu/
|
||||
RUN git clone https://github.com/include-what-you-use/include-what-you-use.git
|
||||
RUN cd /iwyu/include-what-you-use && \
|
||||
git checkout origin/clang_14 && \
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc ../ -G "Unix Makefiles" && \
|
||||
make
|
||||
RUN apt clean && rm -rf /var/lib/apt/lists/*
|
||||
volumes:
|
||||
- ../../:/code/
|
||||
command:
|
||||
bash -c "git config --global --add safe.directory /code && \
|
||||
mkdir -p iwyu-bin && cd iwyu-bin && \
|
||||
cmake \
|
||||
-DCMAKE_C_INCLUDE_WHAT_YOU_USE=/iwyu/include-what-you-use/build/bin/include-what-you-use \
|
||||
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=/iwyu/include-what-you-use/build/bin/include-what-you-use \
|
||||
/code/ \
|
||||
-GNinja && \
|
||||
cmake --build . --target $TARGET"
|
||||
Reference in New Issue
Block a user