[clang] [llvm] [clang-format] Add CI check confirming ClangFormatStyleOptions.rst is up-to-date. (PR #111513)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 07:07:33 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Iuri Chaer (ichaer)
<details>
<summary>Changes</summary>
* Create a new `clang-format-style-options` build target which re-generates ClangFormatStyleOptions.rst from its source header files.
* Add CI check confirming that the repository's ClangFormatStyleOptions.rst is up-to-date, so that it doesn't have to be done by reviewers.
As discussed in https://github.com/llvm/llvm-project/pull/96804#discussion_r1718407404
---
Full diff: https://github.com/llvm/llvm-project/pull/111513.diff
2 Files Affected:
- (modified) .github/workflows/docs.yml (+13)
- (modified) clang/docs/CMakeLists.txt (+6)
``````````diff
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 800e9291573533..f559fbd237a99d 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -75,6 +75,9 @@ jobs:
- 'clang/include/clang/Basic/AttrDocs.td'
- 'clang/include/clang/Driver/ClangOptionDocs.td'
- 'clang/include/clang/Basic/DiagnosticDocs.td'
+ clang-format_style-headers:
+ - 'clang/include/clang/Format/Format.h'
+ - 'clang/include/clang/Tooling/Inclusions/IncludeStyle.h'
clang-tools-extra:
- 'clang-tools-extra/docs/**'
lldb:
@@ -122,6 +125,16 @@ jobs:
run: |
cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm
TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man
+ - name: Confirm ClangFormatStyleOptions.rst is up-to-date
+ if: steps.docs-changed-subprojects.outputs.clang-format_style-headers_any_changed == 'true'
+ run: |
+ cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm
+ TZ=UTC ninja -C clang-build clang-format-style-options
+ GIT_STATUS="$(git status --porcelain=v1 clang/docs/ClangFormatStyleOptions.rst)"
+ if [ ! -z "${GIT_STATUS}" ]; then
+ echo "Error: you must build the 'clang-format-style-options' target and commit any changes to 'clang/docs/ClangFormatStyleOptions.rst'"
+ exit 1
+ fi
- name: Build clang-tools-extra docs
if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true'
run: |
diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt
index 4fecc007f59954..93a4356c1d53bb 100644
--- a/clang/docs/CMakeLists.txt
+++ b/clang/docs/CMakeLists.txt
@@ -1,3 +1,9 @@
+add_custom_target(clang-format-style-options
+ COMMAND "${Python3_EXECUTABLE}" dump_format_style.py
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tools"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/Format/Format.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/Tooling/Inclusions/IncludeStyle.h")
+add_dependencies(clang-format clang-format-style-options)
if (DOXYGEN_FOUND)
if (LLVM_ENABLE_DOXYGEN)
``````````
</details>
https://github.com/llvm/llvm-project/pull/111513
More information about the cfe-commits
mailing list