Skip to content

Commit 1d6e68b

Browse files
coadometa-codesync[bot]
authored andcommitted
Add --xml flag to persist xml artifacts for testing purposes (#56238)
Summary: Pull Request resolved: #56238 Currently, all xml artifacts generated by doxygen are stored in the tmp dir and deleted at the end of the snapshot generation. For debugging reasons, this diff adds `--xml` flag to persist generated artifacts, so that they can be analyzed. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D98289956 fbshipit-source-id: 73eb0185f7112389e589d3e8f8a2004efe325e8d
1 parent 7f87976 commit 1d6e68b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/cxx-api/parser/__main__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import argparse
1515
import concurrent.futures
1616
import os
17+
import shutil
1718
import subprocess
1819
import sys
1920
import tempfile
@@ -140,6 +141,7 @@ def build_snapshots(
140141
verbose: bool,
141142
view_filter: str | None = None,
142143
is_test: bool = False,
144+
keep_xml: bool = False,
143145
) -> None:
144146
if not is_test:
145147
configs_to_build = [
@@ -203,6 +205,7 @@ def build_snapshots(
203205
failed_views = ", ".join(name for name, _ in errors)
204206
raise RuntimeError(f"Failed to generate snapshots: {failed_views}")
205207
else:
208+
work_dir = os.path.join(react_native_dir, "api")
206209
snapshot = build_snapshot_for_view(
207210
api_view="Test",
208211
react_native_dir=react_native_dir,
@@ -213,8 +216,18 @@ def build_snapshots(
213216
codegen_dir=None,
214217
verbose=verbose,
215218
input_filter=input_filter,
219+
work_dir=work_dir,
216220
)
217221

222+
if keep_xml:
223+
xml_src = os.path.join(work_dir, "xml")
224+
xml_dst = os.path.join(output_dir, "xml")
225+
if os.path.exists(xml_dst):
226+
shutil.rmtree(xml_dst)
227+
shutil.copytree(xml_src, xml_dst)
228+
if verbose:
229+
print(f"XML files saved to {xml_dst}")
230+
218231
if verbose:
219232
print(snapshot)
220233

@@ -252,6 +265,11 @@ def main():
252265
action="store_true",
253266
help="Run on the local test directory instead of the react-native directory",
254267
)
268+
parser.add_argument(
269+
"--xml",
270+
action="store_true",
271+
help="Keep the generated Doxygen XML files next to the .api output in a xml/ directory",
272+
)
255273
args = parser.parse_args()
256274

257275
verbose = not args.check
@@ -309,6 +327,7 @@ def main():
309327
input_filter=input_filter,
310328
view_filter=args.view,
311329
is_test=args.test,
330+
keep_xml=args.xml,
312331
)
313332

314333
if args.check:

0 commit comments

Comments
 (0)