Run the pull request's natvis generator in the amalgamation check

The check ran generate_natvis.py from the develop checkout and took only
the template from the pull request, so a pull request that changes the
generator (such as #5868, which limits the namespaces to two ABI tags)
could never pass: develop's generator rewrote the committed file. The
check now runs the pull request's generator, which loads its own
template, as the macro_builder step already does.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-21 07:24:46 +02:00
1 parent a55cae45fd
commit d9d0f2a0ce
1 file changed
+14 -15
+14 -15
View File
@@ -77,13 +77,12 @@ jobs:
cd $MAIN_DIR cd $MAIN_DIR
# Built from this PR's own tools/macro_builder/main.cpp, not a # Built from this PR's own tools/macro_builder/main.cpp, not a
# develop checkout: unlike amalgamate.py and generate_natvis.py, # develop checkout: unlike amalgamate.py, this tool has no other
# this tool has no other source of truth to check against (its # source of truth to check against (its own README documents that
# own README documents that it must reproduce macro_scope.hpp # it must reproduce macro_scope.hpp byte for byte), so there is
# byte for byte), so there is nothing to gain from checking out a # nothing to gain from checking out a separate copy, and doing so
# separate copy, and doing so would make this step fail on a PR # would make this step fail on a PR that adds support for a new
# that adds support for a new dispatch table until that PR itself # dispatch table until that PR itself merges to develop.
# merges to develop.
TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX) TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX)
c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder" c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder"
"$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp" "$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp"
@@ -143,14 +142,14 @@ jobs:
- name: Regenerate nlohmann_json.natvis - name: Regenerate nlohmann_json.natvis
run: | run: |
cd $MAIN_DIR cd $MAIN_DIR
# The template is what this check verifies the committed natvis # The generator and its template are what this check verifies the
# file against, so take it from this PR rather than from the # committed natvis file against (which namespaces it lists, and
# develop checkout: generate_natvis.py loads the template from its # what each entry looks like), so run this PR's copy rather than
# own directory, and with develop's copy a PR that changes the # the develop checkout's: with develop's, a PR that changes either
# template could never pass. Like the macro_builder step above, # could never pass. generate_natvis.py loads the template from its
# this only renders PR content in a job without credentials. # own directory. Like the macro_builder step above, this only runs
cp tools/generate_natvis/nlohmann_json.natvis.j2 $NATVIS_TOOL_DIR/ # PR content in a job without credentials.
python3 $NATVIS_TOOL_DIR/generate_natvis.py $MAIN_DIR python3 tools/generate_natvis/generate_natvis.py $MAIN_DIR
- name: Build patch and check for differences - name: Build patch and check for differences
id: diff id: diff