Skip to content

Commit

Permalink
Integrate binary-compatibility-validator into RN Android build system
Browse files Browse the repository at this point in the history
Summary:
In this diff I'm integrating 'org.jetbrains.kotlinx.binary-compatibility-validator' into RN Android build gradle system.

The tool allows dumping binary API of a JVM part of a Kotlin library that is public in the sense of Kotlin visibilities and ensures that the public binary API wasn't changed in a way that makes this change binary incompatible

More context on https://github.com/Kotlin/binary-compatibility-validator#building-the-project-locally

bypass-github-export-checks

Reviewed By: cortinico

Differential Revision: D51262577

fbshipit-source-id: 1894f4e55a4019e3ce1585e9df12dee69944e5ce
  • Loading branch information
mdvacca authored and facebook-github-bot committed Dec 4, 2023
1 parent a481ae7 commit e9b8097
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.download) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.binary.compatibility.validator) apply true
}

val reactAndroidProperties = java.util.Properties()
Expand All @@ -19,6 +20,31 @@ File("$rootDir/packages/react-native/ReactAndroid/gradle.properties").inputStrea
reactAndroidProperties.load(it)
}

apiValidation {
ignoredPackages.addAll(
listOf(
"com.facebook.fbreact",
"com.facebook.react.flipper",
"com.facebook.debug",
"com.facebook.hermes",
"com.facebook.perftest",
"com.facebook.proguard",
"com.facebook.react.module.processing",
"com.facebook.systrace",
"com.facebook.yoga",
"com.facebook.react.internal",
"com.facebook.react.bridgeless.internal"))

ignoredClasses.addAll(listOf("com.facebook.react.BuildConfig"))

nonPublicMarkers.addAll(
listOf(
"com.facebook.react.common.annotations.UnstableReactNativeAPI",
"com.facebook.react.common.annotations.VisibleForTesting"))

validationDisabled = true
}

version =
if (project.hasProperty("isSnapshot") &&
(project.property("isSnapshot") as? String).toBoolean()) {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ androidx-swiperefreshlayout = "1.1.0"
androidx-test = "1.5.0"
androidx-tracing = "1.1.0"
assertj = "3.21.0"
binary-compatibility-validator = "0.13.2"
download = "5.4.0"
fbjni = "0.5.1"
fresco = "3.1.3"
Expand Down Expand Up @@ -76,3 +77,4 @@ android-library = { id = "com.android.library", version.ref = "agp" }
download = { id = "de.undercouch.download", version.ref = "download" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }

0 comments on commit e9b8097

Please sign in to comment.