Replace "facebook.proguard.annotations" with "facebook.yoga.annotations" (#35841)

Summary:
X-link: https://github.com/facebook/react-native/pull/35841

X-link: https://github.com/facebook/litho/pull/928

Pull Request resolved: https://github.com/facebook/yoga/pull/1216

The Yoga JNI bindings use Reflection, so we need to let ProGuard know not to strip certain annotated fields.

This is done internally using a single copy of `com.facebook.proguard.annotations` from fbandroid (sometimes), which is then repackaged externally, and published as its own whole Yoga specific package. We never actually inform the stock Gradle project of the rules for the annotations though, so apps must add these manually.

This simplifies the setup, where Yoga has its own self-contained annotations/rules. The rules are exposed for Gradle/Buck dependencies, but RN and Litho both consume Yoga via dirsync + custom Gradle logic, so we need to duplicate the proguard rules to them instead of them being propagated automatically.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D42406641

fbshipit-source-id: c2b12fd498f93f144e5651917ca878d2a5050e08
This commit is contained in:
Nick Gerleman
2023-01-16 11:25:59 -08:00
committed by Facebook GitHub Bot
parent 83c6997f29
commit 65c57d6a01
12 changed files with 19 additions and 58 deletions

View File

@@ -162,7 +162,7 @@ for name, values in sorted(ENUMS.items()):
f.write(get_license("java"))
f.write("package com.facebook.yoga;\n\n")
if name in DO_NOT_STRIP:
f.write("import com.facebook.proguard.annotations.DoNotStrip;\n\n")
f.write("import com.facebook.yoga.annotations.DoNotStrip;\n\n")
f.write("@DoNotStrip\n")
f.write("public enum Yoga%s {\n" % name)
if len(values) > 0: