From 7fb0bb40d2206c734a1feb6b555c22d6d5f2436e Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 28 Jun 2022 04:35:11 -0700 Subject: [PATCH] Simplify the Android.mk file in the App Template (#34080) Summary: I'm simplifying the `Android.mk` file inside the template as it was confusing. There are two ways to include the generated code from the codegen: 1. Importing the generated Android.mk file 2. Include the generate source files in the `_appmodules` source files. Those two approaches are mutually exclusive (as doing both will lead to duplicate symbols). Our template comments were confusing and were suggesting a combination of both. I'm simplifying the comments here by removing the one suggesting to go with option `1` instead. ## Changelog [Android][Changed] - Simplify the Android.mk file in the App Template Pull Request resolved: https://github.com/facebook/react-native/pull/34080 Test Plan: Nothing to test here as it's a comments only change Reviewed By: cipolleschi Differential Revision: D37463222 Pulled By: cortinico fbshipit-source-id: 30ecc6fbbbcaf484272b4c724600cda588146506 --- template/android/app/src/main/jni/Android.mk | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/template/android/app/src/main/jni/Android.mk b/template/android/app/src/main/jni/Android.mk index e2c306187ab2a7..55732a705bcff6 100644 --- a/template/android/app/src/main/jni/Android.mk +++ b/template/android/app/src/main/jni/Android.mk @@ -16,22 +16,10 @@ LOCAL_PATH := $(THIS_DIR) # You can customize the name of your application .so file here. LOCAL_MODULE := helloworld_appmodules -LOCAL_C_INCLUDES := $(LOCAL_PATH) -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) - -# Autolinked TurboModules and Fabric components -LOCAL_C_INCLUDES += $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni -LOCAL_SRC_FILES += $(wildcard $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni/*.cpp) -LOCAL_EXPORT_C_INCLUDES += $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni - -# If you wish to add a custom TurboModule or Fabric component in your app you -# will have to uncomment those lines to include the generated source -# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni) -# -# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni -# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp) -# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni +# The generated/rncli/src/main/jni folder contains Autolinking support files. +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni/*.cpp) +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni # Here you should add any native library you wish to depend on. LOCAL_SHARED_LIBRARIES := \ @@ -55,6 +43,11 @@ LOCAL_SHARED_LIBRARIES := \ # Autolinked libraries LOCAL_SHARED_LIBRARIES += $(call import-codegen-modules) +# If you wish to add a custom TurboModule or Fabric component in your app you +# will have to link against it here: +# LOCAL_SHARED_LIBRARIES += \ +# libreact_codegen_ + LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY)