Skip to content

Commit

Permalink
Enable proguard for Fabric in release builds
Browse files Browse the repository at this point in the history
Reviewed By: shergin

Differential Revision: D8247814

fbshipit-source-id: 94ed8a767fcf4f6093646618a5691ff17753ffe0
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jun 5, 2018
1 parent e95e73a commit e09c56a
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.util.Log;
import android.view.View;
import com.facebook.infer.annotation.Assertions;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
Expand Down Expand Up @@ -51,6 +52,7 @@
* API.
*/
@SuppressWarnings("unused") // used from JNI
@DoNotStrip
public class FabricUIManager implements UIManager, JSHandler {

private static final String TAG = FabricUIManager.class.getSimpleName();
Expand Down Expand Up @@ -94,6 +96,7 @@ public void setBinding(FabricBinding binding) {

/** Creates a new {@link ReactShadowNode} */
@Nullable
@DoNotStrip
public ReactShadowNode createNode(
int reactTag, String viewName, int rootTag, ReadableNativeMap props, long instanceHandle) {
if (DEBUG) {
Expand Down Expand Up @@ -145,6 +148,7 @@ private ReactStylesDiffMap updateProps(ReactShadowNode node, @Nullable ReadableN
* including its children set (note that the children nodes will not be cloned).
*/
@Nullable
@DoNotStrip
public ReactShadowNode cloneNode(ReactShadowNode node, long instanceHandle) {
if (DEBUG) {
Log.d(TAG, "cloneNode \n\tnode: " + node);
Expand All @@ -165,6 +169,7 @@ public ReactShadowNode cloneNode(ReactShadowNode node, long instanceHandle) {
* children set will be empty.
*/
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node, long instanceHandle) {
if (DEBUG) {
Log.d(TAG, "cloneNodeWithNewChildren \n\tnode: " + node);
Expand All @@ -185,6 +190,7 @@ public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node, long insta
* props will be overridden with the {@link ReadableMap} received by parameter.
*/
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewProps(
ReactShadowNode node, @Nullable ReadableNativeMap newProps, long instanceHandle) {
if (DEBUG) {
Expand All @@ -208,6 +214,7 @@ public ReactShadowNode cloneNodeWithNewProps(
* children set will be empty.
*/
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewChildrenAndProps(
ReactShadowNode node, ReadableNativeMap newProps, long instanceHandle) {
if (DEBUG) {
Expand Down Expand Up @@ -242,6 +249,7 @@ private void assertReactShadowNodeCopy(ReactShadowNode source, ReactShadowNode t
* ReactShadowNode}.
*/
@Nullable
@DoNotStrip
public void appendChild(ReactShadowNode parent, ReactShadowNode child) {
if (DEBUG) {
Log.d(TAG, "appendChild \n\tparent: " + parent + "\n\tchild: " + child);
Expand All @@ -263,6 +271,7 @@ public void appendChild(ReactShadowNode parent, ReactShadowNode child) {
* @return an empty {@link List<ReactShadowNode>} that will be used to append the {@link
* ReactShadowNode} elements of the root. Typically this List will contain one element.
*/
@DoNotStrip
public List<ReactShadowNode> createChildSet(int rootTag) {
if (DEBUG) {
Log.d(TAG, "createChildSet rootTag: " + rootTag);
Expand All @@ -273,10 +282,12 @@ public List<ReactShadowNode> createChildSet(int rootTag) {
/**
* Adds the {@link ReactShadowNode} to the {@link List<ReactShadowNode>} received by parameter.
*/
@DoNotStrip
public void appendChildToSet(List<ReactShadowNode> childList, ReactShadowNode child) {
childList.add(child);
}

@DoNotStrip
public synchronized void completeRoot(int rootTag, @Nullable List<ReactShadowNode> childList) {
try {
childList = childList == null ? new LinkedList<ReactShadowNode>() : childList;
Expand Down Expand Up @@ -383,6 +394,7 @@ private void applyUpdatesRecursive(ReactShadowNode node, float absoluteX, float
}

@Override
@DoNotStrip
public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> int addRootView(
final T rootView) {
final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
Expand All @@ -409,6 +421,7 @@ public void onSizeChanged(final int width, final int height, int oldW, int oldH)
}

@Override
@DoNotStrip
public void updateRootLayoutSpecs(int rootViewTag, int widthMeasureSpec, int heightMeasureSpec) {
ReactShadowNode rootNode = mRootShadowNodeRegistry.getNode(rootViewTag);
if (rootNode == null) {
Expand Down Expand Up @@ -458,7 +471,7 @@ private ReactShadowNode createRootShadowNode(int rootTag, ThemedReactContext the
* Updates the styles of the {@link ReactShadowNode} based on the Measure specs received by
* parameters.
*/
public void updateRootView(
private void updateRootView(
ReactShadowNode node, int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = View.MeasureSpec.getMode(widthMeasureSpec);
int widthSize = View.MeasureSpec.getSize(widthMeasureSpec);
Expand Down Expand Up @@ -502,6 +515,7 @@ private void handleException(ReactShadowNode node, Throwable t) {
}

@Nullable
@DoNotStrip
public long createEventTarget(int reactTag) {
long instanceHandle = mNativeViewHierarchyManager.getInstanceHandle(reactTag);
long context = mJSContext.get();
Expand All @@ -514,19 +528,23 @@ public long createEventTarget(int reactTag) {
return eventTarget;
}

@DoNotStrip
public void registerEventHandler(long eventHandlerPointer) {
mEventHandlerPointer = eventHandlerPointer;
}

@DoNotStrip
public void releaseEventTarget(long eventTargetPointer) {
mBinding.releaseEventTarget(mJSContext.get(), eventTargetPointer);
}

@DoNotStrip
public void releaseEventHandler(long eventHandlerPointer) {
mBinding.releaseEventHandler(mJSContext.get(), eventHandlerPointer);
}

@Override
@DoNotStrip
public void invoke(long eventTarget, String name, WritableMap params) {
if (DEBUG) {
Log.d(
Expand Down

0 comments on commit e09c56a

Please sign in to comment.