diff --git a/ReactAndroid/proguard-rules.pro b/ReactAndroid/proguard-rules.pro index 2161cd7e7d668c..7e65d79104306d 100644 --- a/ReactAndroid/proguard-rules.pro +++ b/ReactAndroid/proguard-rules.pro @@ -60,3 +60,10 @@ -dontwarn java.nio.file.* -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement -dontwarn okio.** + +# yoga +-keep,allowobfuscation @interface com.facebook.yoga.annotations.DoNotStrip +-keep @com.facebook.yoga.annotations.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.yoga.annotations.DoNotStrip *; +} diff --git a/ReactAndroid/src/main/java/com/facebook/BUCK b/ReactAndroid/src/main/java/com/facebook/BUCK index a96954afb10fb1..6d6072c9078b67 100644 --- a/ReactAndroid/src/main/java/com/facebook/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/BUCK @@ -2,7 +2,7 @@ load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "rn_android_libra rn_android_library( name = "yoga", - srcs = glob(["yoga/*.java"]), + srcs = glob(["yoga/**/*.java"]), autoglob = False, language = "JAVA", visibility = ["PUBLIC"], diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java index 85076706c3786b..761f302eb29d7c 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java @@ -9,7 +9,7 @@ package com.facebook.yoga; -import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.yoga.annotations.DoNotStrip; @DoNotStrip public enum YogaLogLevel { diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java index 9d439ad31df3ac..f40292dd52875b 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java @@ -7,7 +7,7 @@ package com.facebook.yoga; -import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.yoga.annotations.DoNotStrip; /** * Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger); diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java index f6c53c3b64fc07..c0246f60965d6d 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java @@ -7,7 +7,7 @@ package com.facebook.yoga; -import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.yoga.annotations.DoNotStrip; import com.facebook.soloader.SoLoader; @DoNotStrip diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java index 85aebb3fcc212f..fd44cc0ff6249a 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java @@ -7,7 +7,7 @@ package com.facebook.yoga; -import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.yoga.annotations.DoNotStrip; import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/annotations/DoNotStrip.java b/ReactAndroid/src/main/java/com/facebook/yoga/annotations/DoNotStrip.java new file mode 100644 index 00000000000000..574d3562b0ce99 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/yoga/annotations/DoNotStrip.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.yoga.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.CLASS; + +@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) +@Retention(CLASS) +public @interface DoNotStrip { }