Repository navigation
Conversation
React Native has no check for ABI breaks: changes in the size or memory layout of public C++ types that break code compiled against an earlier release. Between 0.87 and 0.88, facebook::yoga::Style shrank from 280 to 160 bytes, which changed YogaStylableProps and BaseViewProps, and no existing check caught it. scripts/abi-check compiles the stable-API headers with clang, dumps the record, vtable and enum layouts, and compares two versions per platform (iOS, Android) and build type (Debug, Release). The baseline comes from the published Maven artifacts; the other side is a published version or a source checkout. Headers that do not compile in a published layout are skipped only through a reviewed list.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
React Native has no check for ABI breaks. An ABI break is a change in the size or memory layout of a public C++ type that breaks code compiled against an earlier release, such as a library built for 0.88.0 running with 0.88.1. The existing API snapshots record names and signatures, not sizes or field offsets.
Between 0.87 and 0.88,
facebook::yoga::Styleshrank from 280 to 160 bytes. This changed the layout ofYogaStylablePropsandBaseViewProps, and no existing check caught it.This PR adds
scripts/abi-check, a local tool that catches this kind of break. It does not run in CI yet; a follow-up PR adds the workflow.What it does:
UmbrellaGuard.horFrameworksGuard.h, with the exclude patterns fromscripts/cxx-api/config.yml.facebook::react,facebook::yogaandfacebook::jsinamespaces.react-androidAAR plus fbjni. Downloads are cached and checked against their Maven SHA-1. The other side is a published version or a source checkout. For a checkout, the iOS header layout is built with the existingscripts/ios-prebuildcode, and the Android layout comes from the prefab rules inReactAndroid/build.gradle.kts.skipped-headers.js. Each entry gives a reason and, optionally, the releases it applies to. Any other compile failure stops the run.Usage:
Exit code 0 means no breaks, 1 means breaks were found, and 2 means bad arguments or a tool error.
Changelog:
[INTERNAL] [ADDED] - Add scripts/abi-check, a local C++ ABI layout check for stable-API headers
Test Plan:
Unit tests (offline; tests that run clang use the host clang):
Result: 10 suites, 91 tests passed.
yarn flow-check, ESLint and Prettier are clean onscripts/abi-check.Real comparisons, each run on iOS and Android, Debug and Release (iOS needs Xcode; Android needs NDK 28.2.13676358):
yoga::Style,YogaStylableProps,BaseViewPropsreported changed on all 4Example:
This exits with 1 and lists
L facebook::yoga::Styleamong the breaks.Not run: CI integration (a follow-up PR), and the exported-symbol and Java/Kotlin checks (also a follow-up PR).