Make doxygen binary location configurable (#55842)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55842

Changelog: [Internal]

Updates the C++ API snapshot generator so that it tries to read doxygen binary location from the env variable before falling back to relying on PATH.

Reviewed By: cipolleschi

Differential Revision: D94901517

fbshipit-source-id: 48c770f9b80597304f3323fd0c00a9a68ebf889a
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-03-03 01:00:16 -08:00
1 parent e2fdf0fb04
commit bdaf176a21
2 files changed
+22 -8

No files matched your search

+16 -7
View File
@@ -87,31 +87,32 @@ def build_snapshot_for_view(
definitions=definitions,
)
print("Running Doxygen")
# If there is already a doxygen output directory, delete it
if os.path.exists(os.path.join(react_native_dir, "api")):
print("Deleting existing output directory")
subprocess.run(["rm", "-rf", os.path.join(react_native_dir, "api")])
print("Running Doxygen")
# Run doxygen with the config file
doxygen_bin = os.environ.get("DOXYGEN_BIN", "doxygen")
result = subprocess.run(
["doxygen", DOXYGEN_CONFIG_FILE],
[doxygen_bin, DOXYGEN_CONFIG_FILE],
cwd=react_native_dir,
capture_output=True,
text=True,
)
# Delete the Doxygen config file
print("Deleting Doxygen config file")
subprocess.run(["rm", DOXYGEN_CONFIG_FILE], cwd=react_native_dir)
# Check the result
if result.returncode != 0:
print(f"Doxygen finished with error: {result.stderr}")
else:
print("Doxygen finished successfully")
# Delete the Doxygen config file
print("Deleting Doxygen config file")
subprocess.run(["rm", DOXYGEN_CONFIG_FILE], cwd=react_native_dir)
# build snapshot, convert to string, and save to file
snapshot = build_snapshot(os.path.join(react_native_dir, "api", "xml"))
snapshot_string = snapshot.to_string()
@@ -145,6 +146,14 @@ def main():
)
args = parser.parse_args()
doxygen_bin = os.environ.get("DOXYGEN_BIN", "doxygen")
version_result = subprocess.run(
[doxygen_bin, "--version"],
capture_output=True,
text=True,
)
print(f"Using Doxygen {version_result.stdout.strip()} ({doxygen_bin})")
# Define the path to the react-native directory
react_native_dir = (
os.path.join(get_react_native_dir(), "packages", "react-native")
+6 -1
View File
@@ -49,10 +49,15 @@ def _assert_text_equal_with_diff(
tc.fail(diff)
def _get_doxygen_bin() -> str:
return os.environ.get("DOXYGEN_BIN", "doxygen")
def _generate_doxygen_api(case_dir_path: str, doxygen_config_path: str) -> None:
"""Run doxygen to generate XML API documentation."""
doxygen_bin = _get_doxygen_bin()
result = subprocess.run(
["doxygen", doxygen_config_path],
[doxygen_bin, doxygen_config_path],
cwd=case_dir_path,
capture_output=True,
text=True,