Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.58 KB

README.md

File metadata and controls

37 lines (29 loc) · 1.58 KB

scripts/android-api

Regenerate the React Native Android public API snapshot, packages/react-native/ReactAndroid/api/ReactAndroid.api, which tracks the public Java/Kotlin API surface of ReactAndroid.

Usage

# Regenerate the snapshot after an intentional public API change
yarn android-api-build

# Verify the committed snapshot is up to date without rewriting it (for CI)
yarn android-api-validate

These run ReactAndroid's publicApiDump Gradle task, which compiles the release classes and dumps their public API with the binary-compatibility-validator library, using the filters in packages/react-native/ReactAndroid/gradle.properties.

The snapshot is maintained from a build that also records a few entries the Gradle build does not produce: Kotlin $DefaultImpls classes and forwarders to inherited interface default methods, $$ReactModuleInfoProvider classes, and bridges for some internal members. The script keeps the ones already in the snapshot. $DefaultImpls members follow each interface's default methods, and $DefaultImpls classes, forwarders and bridges go away with the class or default method they belong to. It does not add new ones; those are added when the change is imported into Meta's repository.

When to use it

Run yarn android-api-build after any change to a Kotlin or Java API in packages/react-native/ReactAndroid/ that is effectively public or protected, and commit the updated .api file. APIs annotated with @UnstableReactNativeAPI, APIs inside an internal package, and Kotlin-internal/private declarations are excluded from tracking.