p4c
p4c copied to clipboard
It should be possible to run the formatters without needing to install all P4C dependencies
Currently CMake breaks if you do not have certain dependencies (flex, bison, boost, etc) installed. It would be nice to run our formatters independently.
Hello, I am going to working on this issue
@fruffy if i want to extract formatters into a separate directory or module, may i add only clang-format and cmake-format scripts ? It is a bit complicated to find all used formatters, directory will include documentation how to use it
is it okay?
This should be possible to do only in CMake. The reason why is that each back end may add its own clang-format files. We used to have code set up like this but it turned out to be too inflexible.
We have a linter file where everything is set up: https://github.com/p4lang/p4c/blob/71d79c8dccd9fc78af52379868f20f5c45e69774/cmake/Linters.cmake#L1
Private extensions may call add_clang_format_files
to add their own files to the list.
Also do not worry about creating a dedicated folder structure. We already have all the formatters and configs available, the only changes required are to the CMake script. We could add an option "CMAKE_LINT_ONLY" to the main CMakeLists.txt file where it does not check for certain dependencies.
added PR #4552 should i add conditional checks? In order to handle the dependencies based on whether CMAKE_LINT_ONLY is enabled or not: if(NOT CMAKE_LINT_ONLY) find_package(FLEX REQUIRED) find_package(BISON REQUIRED) find_package(Boost REQUIRED) endif()
or an option "CMAKE_LINT_ONLY" is enough?
But it looks like the failures are coming from eBPF back end tests, is it because some dependencies are missing?