diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml deleted file mode 100644 index 45805af8f45..00000000000 --- a/.github/workflows/iwyu.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: IWYU - -on: - workflow_dispatch: - schedule: - - cron: "0 12 * * 0" - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - iwyu_ubuntu_2204: - runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2204_clang:v41 - steps: - - name: Install git lfs and llvm dev - run: apt-get update && apt-get install -y git-lfs llvm-dev libclang-dev clang - - - name: Get IWYU source - uses: actions/checkout@v4 - with: - repository: include-what-you-use/include-what-you-use - ref: clang_14 - path: iwyu - - - name: Build IWYU - run: > - mkdir iwyu-build iwyu-install && - cmake -B iwyu-build -S iwyu - -DCMAKE_PREFIX_PATH=/usr/lib/llvm-14 - -DCMAKE_INSTALL_PREFIX=iwyu-install && - cmake --build iwyu-build --target install - - - name: Get Acts source - uses: actions/checkout@v4 - with: - path: acts - submodules: true - lfs: true - - - name: Configure Acts - run: > - mkdir acts-build acts-install && - cmake -B acts-build -S acts - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_CXX_FLAGS=-Werror - -DCMAKE_CXX_STANDARD=17 - -DCMAKE_INSTALL_PREFIX=acts-install - -DACTS_BUILD_EVERYTHING=ON - -DACTS_BUILD_ODD=ON - -DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON - -DACTS_BUILD_EXAMPLES_EDM4HEP=ON - - - name: Run IWYU - run: python3 iwyu-install/bin/iwyu_tool.py -p acts-build/ -j2 -- -Xiwyu --mapping_file=$(pwd)/acts/CI/iwyu/mapping.imp | tee iwyu-output.txt - - name: Filter IWYU output - run: python3 acts/CI/iwyu/filter.py acts/CI/iwyu/filter.yaml iwyu-output.txt iwyu-filtered.txt - - name: Apply IWYU - run: python3 iwyu-install/bin/fix_includes.py < iwyu-filtered.txt - - - name: Upload IWYU output - uses: actions/upload-artifact@v4 - with: - name: iwyu - path: | - iwyu-output.txt - iwyu-filtered.txt diff --git a/CI/iwyu/README.md b/CI/iwyu/README.md deleted file mode 100644 index 6204d806f20..00000000000 --- a/CI/iwyu/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# IWYU = Include what you use - -This tool finds unused includes and suggestes additional includes and declarations. - -It is not very stable at the moment and takes a few hours to complete within ACTS therefor it only runs once a week and can be triggered manually. - -There is also not sufficient filtering offered by IWYU at the moment. For that reason there is a specific filtering script for now which tries to get rid of unwanted changes. - -offline resources -- [GitHub Actions Workflow](../../.github/workflows/iwyu.yml) -- [Custom filter script](./filter.py) - -online resources - -- https://include-what-you-use.org/ -- https://github.com/include-what-you-use/include-what-you-use diff --git a/CI/iwyu/filter.py b/CI/iwyu/filter.py deleted file mode 100755 index 396ebececd3..00000000000 --- a/CI/iwyu/filter.py +++ /dev/null @@ -1,83 +0,0 @@ -import sys -import yaml -import re -import argparse -from collections import namedtuple - - -Config = namedtuple( - "Config", ["remove_lines", "replace_lines", "ignore_files"], defaults=[[], [], []] -) - - -class State: - skip_file: bool = False - - -def parse_config(config: Config): - remove_lines = [] - for s in config["remove_lines"]: - remove_lines.append(re.compile(s)) - - replace_lines = [] - for s in config["replace_lines"]: - s, r = list(s.items())[0] - replace_lines.append((re.compile(s), r)) - - ignore_files = [] - for s in config["ignore_files"]: - ignore_files.append(re.compile(s)) - - return Config( - remove_lines=remove_lines, - replace_lines=replace_lines, - ignore_files=ignore_files, - ) - - -def filter(line: str, config: Config, state: State): - if state.skip_file: - if line.endswith("---\n"): - state.skip_file = False - return None - - if line.endswith(" should add these lines:\n"): - for s in config.ignore_files: - if s.search(line): - state.skip_file = True - return None - - for s in config.remove_lines: - if s.search(line): - return None - - for s, r in config.replace_lines: - if s.search(line): - return s.sub(r, line) - - return line - - -parser = argparse.ArgumentParser() -parser.add_argument("config") -parser.add_argument("input") -parser.add_argument("output") -args = parser.parse_args() - -with open(args.config, "r") as config_file: - try: - config = yaml.safe_load(config_file) - config = parse_config(config) - except yaml.YAMLError as exc: - print(exc) - sys.exit(1) - -with open(args.input, "r") as input_file, open(args.output, "w") as output_file: - state = State() - - for line in input_file: - filtered_line = filter(line, config, state) - if filtered_line is not None: - output_file.write(filtered_line) - -sys.exit(0) diff --git a/CI/iwyu/filter.yaml b/CI/iwyu/filter.yaml deleted file mode 100644 index 07d3aaf643b..00000000000 --- a/CI/iwyu/filter.yaml +++ /dev/null @@ -1,29 +0,0 @@ -remove_lines: - # ignore if not existing in std - - "^#include " - - "^#include ": "#include " - - "^#include ": "#include " - - "^#include ": "#include " - - "^#include ": "#include " - - "^#include ": "#include " - - "^#include ": "#include " - - "^#include ": "#include " - # don't use ipp - - "^#include ([<\"].*)\\.ipp": "#include \\1.hpp" - -ignore_files: - - ".*FpeMonitor\\.[hc]pp" - - ".*thirdparty/" diff --git a/CI/iwyu/mapping-boost.imp b/CI/iwyu/mapping-boost.imp deleted file mode 100644 index 2f8f2177803..00000000000 --- a/CI/iwyu/mapping-boost.imp +++ /dev/null @@ -1,3 +0,0 @@ -[ - { include: ["@<", "private", "", "public"] }, -] \ No newline at end of file diff --git a/CI/iwyu/mapping-eigen.imp b/CI/iwyu/mapping-eigen.imp deleted file mode 100644 index 07dbcaa79d2..00000000000 --- a/CI/iwyu/mapping-eigen.imp +++ /dev/null @@ -1,4 +0,0 @@ -[ - { include: ["@", "private", "", "public"] }, - { include: ["@\"src/Core/.*\"", "private", "", "public"] } -] \ No newline at end of file diff --git a/CI/iwyu/mapping-pythia.imp b/CI/iwyu/mapping-pythia.imp deleted file mode 100644 index 42d469b75a7..00000000000 --- a/CI/iwyu/mapping-pythia.imp +++ /dev/null @@ -1,3 +0,0 @@ -[ - { include: ["@", "private", "", "public"] } -] \ No newline at end of file diff --git a/CI/iwyu/mapping.imp b/CI/iwyu/mapping.imp deleted file mode 100644 index 05274f37fff..00000000000 --- a/CI/iwyu/mapping.imp +++ /dev/null @@ -1,5 +0,0 @@ -[ - { ref: "mapping-boost.imp" }, - { ref: "mapping-eigen.imp" }, - { ref: "mapping-pythia.imp" } -] \ No newline at end of file