Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b6c63e9
Initial commit of Cxx API snapshots
Mar 31, 2026
70cb14b
Add CI workflow for validating C++ API snapshot (#56042)
Mar 31, 2026
f30cb5a
Remove test code from the cxx-api snapshot
Mar 31, 2026
fa120c8
Add global exclude patterns to the cxx api config
Mar 31, 2026
1253ba4
Remove fantom test specific methods from the C++ API snapshot
Mar 31, 2026
695fcdb
Exclude stubs from the C++ public API snapshot
Mar 31, 2026
6a7639c
Add `--xml` flag to persist xml artifacts for testing purposes
Mar 31, 2026
18be329
Fix Doxygen merging base classes from primary templates into speciali…
Mar 31, 2026
6871247
Fix return type for Bridging::fromJs
Mar 31, 2026
31756f3
Add `exclude_symbols` to the cxx-api parser config
Mar 31, 2026
3f023d5
Exclude Fantom symbols from the C++ public API snapshot
Mar 31, 2026
f74079f
Exclude Android specific symbols from the ReactApple snapshot
Mar 31, 2026
859402d
Remove feature flags from the C++ public API snapshots
Mar 31, 2026
b5bee62
Exclude UnstabeLegacy symbols from stable C++ API snapshot
Mar 31, 2026
d984f57
Exclude experimental symbols from the C++ public API snapshot
Mar 31, 2026
9f61467
Exclude Apple Switch component from the ReactAndroid C++ API snapshot
Mar 31, 2026
33c4fa5
Exclude InputAccessory component from the ReactAndroid C++ API snapshot
Mar 31, 2026
3ba1fae
Exclude iOS-specific symbols from the ReactAndroid C++ API snapshot
Mar 31, 2026
bdbfbd7
Rename `--check` flag to `--validate` in C++ public API parser
Mar 31, 2026
d00ab4b
Run the snapshot comparison on Skycastle
Mar 31, 2026
fef57eb
tmp: snapshot dummy change
j-piasecki Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/validate-cxx-api-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Validate C++ API Snapshots

on:
workflow_dispatch:
pull_request:
paths:
- "packages/react-native/ReactCommon/**"
- "packages/react-native/ReactAndroid/**"
- "packages/react-native/React/**"
- "packages/react-native/ReactApple/**"
- "packages/react-native/Libraries/**"
- "scripts/cxx-api/**"
push:
branches:
- main
- "*-stable"
paths:
- "packages/react-native/ReactCommon/**"
- "packages/react-native/ReactAndroid/**"
- "packages/react-native/React/**"
- "packages/react-native/ReactApple/**"
- "packages/react-native/Libraries/**"
- "scripts/cxx-api/**"

env:
DOXYGEN_VERSION: "1.16.1"

jobs:
validate_cxx_api_snapshots:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install
- name: Restore Doxygen cache
id: cache-doxygen
uses: actions/cache@v4
with:
path: /tmp/doxygen-${{ env.DOXYGEN_VERSION }}
key: doxygen-${{ env.DOXYGEN_VERSION }}
- name: Install Doxygen
if: steps.cache-doxygen.outputs.cache-hit != 'true'
shell: bash
run: |
DOXYGEN_URL="https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
MAX_RETRIES=3
for i in $(seq 1 $MAX_RETRIES); do
echo "Attempt $i of $MAX_RETRIES: Installing Doxygen ${DOXYGEN_VERSION}..."
curl -fsSL "$DOXYGEN_URL" -o /tmp/doxygen.tar.gz && \
tar -xzf /tmp/doxygen.tar.gz -C /tmp && \
echo "Doxygen installed successfully." && \
break
echo "Attempt $i failed."
if [ $i -eq $MAX_RETRIES ]; then
echo "All $MAX_RETRIES attempts failed."
exit 1
fi
sleep 5
done
- name: Set DOXYGEN_BIN
shell: bash
run: echo "DOXYGEN_BIN=/tmp/doxygen-${DOXYGEN_VERSION}/bin/doxygen" >> "$GITHUB_ENV"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
shell: bash
run: pip install doxmlparser natsort pyyaml
- name: Validate C++ API snapshots
shell: bash
continue-on-error: true
run: yarn cxx-api-validate --output-dir /tmp/cxx-api-snapshots
- name: Upload C++ API snapshots
uses: actions/upload-artifact@v6
with:
name: cxx-api-snapshots
path: /tmp/cxx-api-snapshots/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,5 @@ __pycache__/
# Doxygen XML output used for C++ API tracking
/packages/react-native/**/api/xml
/packages/react-native/**/api/codegen
/packages/react-native/**/.doxygen.config.generated
/packages/react-native/**/.doxygen.config.*.generated
/scripts/cxx-api/codegen
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
"clean": "node ./scripts/build/clean.js",
"cxx-api-build": "python -m scripts.cxx-api.parser",
"cxx-api-validate": "python -m scripts.cxx-api.parser --check",
"cxx-api-validate": "python -m scripts.cxx-api.parser --validate",
"flow-check": "flow check",
"flow": "flow",
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/ReactCommon/react/bridging/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Bridging<std::array<T, N>> : array_detail::BridgingStatic<std::array<T, N

template <typename T1, typename T2>
struct Bridging<std::pair<T1, T2>> : array_detail::BridgingStatic<std::pair<T1, T2>, 2> {
static std::pair<T1, T1>
static std::pair<T1, T2>
fromJs(facebook::jsi::Runtime &rt, const jsi::Array &array, const std::shared_ptr<CallInvoker> &jsInvoker)
{
return std::make_pair(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ class ShadowNode : public Sealable, public DebugStringConvertible, public jsi::N
const std::shared_ptr<const ShadowNode> &destinationShadowNode,
const ShadowNodeFragment &fragment) const;

void dummyMethod() const;

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
Expand Down
6 changes: 3 additions & 3 deletions scripts/cxx-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Maintainers should run this command whenever making intentional C++ API changes:
python -m scripts.cxx-api.parser
```

#### Check snapshots against committed baseline
#### Validate snapshots against committed baseline

This mode generates snapshots to a temporary directory and compares them against the committed `.api` files. It is designed for CI:

```sh
python -m scripts.cxx-api.parser --check
python -m scripts.cxx-api.parser --validate
```

If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing check, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.
If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing validation, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.

## How it works

Expand Down
Loading
Loading