Skip to content

Commit

Permalink
Simplify the Android.mk file in the App Template (#34080)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jun 28, 2022
1 parent 7cfd77d commit 7fb0bb4
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions template/android/app/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 := \
Expand All @@ -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_<your library name>

LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall

include $(BUILD_SHARED_LIBRARY)

0 comments on commit 7fb0bb4

Please sign in to comment.