code-gen: Enable opt-in to mobile dependencies when building for Apple Catalyst (#36851)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36851

Changelog:
[Internal]

Differential Revision: D44795138

fbshipit-source-id: 4d667531a50d41b8da8146be3c0a9b8854eb6bd1
This commit is contained in:
Christoph Purrer 2023-04-07 12:46:03 -07:00 committed by Facebook GitHub Bot
parent 247a913af0
commit 95dabeb53c
2 changed files with 12 additions and 9 deletions

View File

@ -20,6 +20,7 @@ load(
"get_apple_compiler_flags",
"get_apple_inspector_flags",
"get_preprocessor_flags_for_build_mode",
"is_catalyst_build",
"is_rn_desktop",
"react_native_dep",
"react_native_desktop_root_target",
@ -230,6 +231,11 @@ def rn_codegen_modules(
labels = ["codegen_rule"],
)
MOBILE_DEPS = [
"//xplat/js/react-native-github:RCTTypeSafety",
"//xplat/js/react-native-github/packages/react-native/Libraries/RCTRequired:RCTRequired",
react_native_xplat_target_apple("react/nativemodule/core:core"),
]
rn_apple_library(
name = "{}Apple".format(name),
srcs = [
@ -247,13 +253,9 @@ def rn_codegen_modules(
"-Wno-unused-private-field",
],
extension_api_only = True,
ios_exported_deps = [
"//xplat/js/react-native-github:RCTTypeSafety",
"//xplat/js/react-native-github/packages/react-native/Libraries/RCTRequired:RCTRequired",
react_native_xplat_target_apple("react/nativemodule/core:core"),
],
ios_exported_deps = MOBILE_DEPS,
labels = library_labels + ["codegen_rule"],
macosx_exported_deps = [
macosx_exported_deps = MOBILE_DEPS if is_catalyst_build() else [
react_native_desktop_root_target(":RCTTypeSafetyAppleMac"),
react_native_desktop_root_target(":RCTRequiredAppleMac"),
react_native_desktop_root_target(":nativemoduleAppleMac"),
@ -591,9 +593,7 @@ def rn_codegen_cxx_modules(
react_native_xplat_target("react/nativemodule/core:core"),
],
labels = library_labels + ["codegen_rule"],
macosx_exported_deps = [
react_native_desktop_root_target(":bridging"),
],
macosx_exported_deps = [react_native_xplat_target("react/nativemodule/core:core")] if is_catalyst_build() else [react_native_desktop_root_target(":bridging")],
platforms = (ANDROID, APPLE, CXX, WINDOWS),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",

View File

@ -171,6 +171,9 @@ def react_native_desktop_root_target(path):
def is_rn_desktop():
return False
def is_catalyst_build():
return False
# Example: react_native_tests_target('java/com/facebook/react/modules:modules')
def react_native_tests_target(path):
return "//packages/react-native/ReactAndroid/src/test/" + path