1load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_objc_arc_preprocessor_flags", "get_preprocessor_flags_for_build_mode")
2load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_target", "rn_apple_library", "rn_extra_build_flags")
3load(
4    "@fbsource//xplat/configurations/buck/apple/plugins/sad_xplat_hosted_configurations:react_module_registration.bzl",
5    "react_module_plugin_providers",
6)
7
8rn_apple_library(
9    name = "CoreModulesApple",
10    srcs = glob(
11        [
12            "**/*.m",
13            "**/*.mm",
14        ],
15    ),
16    exported_headers = glob(["**/*.h"]),
17    autoglob = False,
18    compiler_flags = [
19        "-Wno-error=unguarded-availability-new",
20        "-Wno-unknown-warning-option",
21        "-Wno-unused-property-ivar",
22    ],
23    contacts = ["[email protected]"],
24    enable_exceptions = True,
25    exported_preprocessor_flags = rn_extra_build_flags(),
26    extension_api_only = True,
27    frameworks = [
28        "Foundation",
29        "UIKit",
30        "UserNotifications",
31        "WebKit",
32    ],
33    header_path_prefix = "React",
34    labels = [
35        "depslint_never_remove",  # Some old NativeModule still relies on +load unfortunately.
36        "disable_plugins_only_validation",
37        "fbios_link_group:xplat/default/public.react_native.infra",
38        "pfh:ReactNative_CommonInfrastructurePlaceholder",
39        "talkios_link_group:xplat/default/public.react_native.infra",
40    ],
41    link_whole = True,
42    platform_preprocessor_flags = [(
43        "linux",
44        ["-D PIC_MODIFIER=@PLT"],
45    )],
46    plugins =
47        react_module_plugin_providers(
48            name = "AccessibilityManager",
49            native_class_func = "RCTAccessibilityManagerCls",
50        ) + react_module_plugin_providers(
51            name = "Appearance",
52            native_class_func = "RCTAppearanceCls",
53        ) + react_module_plugin_providers(
54            name = "DeviceInfo",
55            native_class_func = "RCTDeviceInfoCls",
56        ) + react_module_plugin_providers(
57            name = "ExceptionsManager",
58            native_class_func = "RCTExceptionsManagerCls",
59        ) + react_module_plugin_providers(
60            name = "PlatformConstants",
61            native_class_func = "RCTPlatformCls",
62        ) + react_module_plugin_providers(
63            name = "Clipboard",
64            native_class_func = "RCTClipboardCls",
65        ) + react_module_plugin_providers(
66            name = "I18nManager",
67            native_class_func = "RCTI18nManagerCls",
68        ) + react_module_plugin_providers(
69            name = "SourceCode",
70            native_class_func = "RCTSourceCodeCls",
71        ) + react_module_plugin_providers(
72            name = "ActionSheetManager",
73            native_class_func = "RCTActionSheetManagerCls",
74        ) + react_module_plugin_providers(
75            name = "AlertManager",
76            native_class_func = "RCTAlertManagerCls",
77        ) + react_module_plugin_providers(
78            name = "Timing",
79            native_class_func = "RCTTimingCls",
80        ) + react_module_plugin_providers(
81            name = "StatusBarManager",
82            native_class_func = "RCTStatusBarManagerCls",
83        ) + react_module_plugin_providers(
84            name = "KeyboardObserver",
85            native_class_func = "RCTKeyboardObserverCls",
86        ) + react_module_plugin_providers(
87            name = "AppState",
88            native_class_func = "RCTAppStateCls",
89        ) + react_module_plugin_providers(
90            name = "PerfMonitor",
91            native_class_func = "RCTPerfMonitorCls",
92        ) + react_module_plugin_providers(
93            name = "DevMenu",
94            native_class_func = "RCTDevMenuCls",
95        ) + react_module_plugin_providers(
96            name = "DevSettings",
97            native_class_func = "RCTDevSettingsCls",
98        ) + react_module_plugin_providers(
99            name = "RedBox",
100            native_class_func = "RCTRedBoxCls",
101        ) + react_module_plugin_providers(
102            name = "LogBox",
103            native_class_func = "RCTLogBoxCls",
104        ) + react_module_plugin_providers(
105            name = "WebSocketExecutor",
106            native_class_func = "RCTWebSocketExecutorCls",
107        ) + react_module_plugin_providers(
108            name = "WebSocketModule",
109            native_class_func = "RCTWebSocketModuleCls",
110        ) + react_module_plugin_providers(
111            name = "DevLoadingView",
112            native_class_func = "RCTDevLoadingViewCls",
113        ) + react_module_plugin_providers(
114            name = "DevSplitBundleLoader",
115            native_class_func = "RCTDevSplitBundleLoaderCls",
116        ) + react_module_plugin_providers(
117            name = "EventDispatcher",
118            native_class_func = "RCTEventDispatcherCls",
119        ),
120    plugins_header = "FBCoreModulesPlugins.h",
121    preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode() + rn_extra_build_flags() + [
122        "-DRN_DISABLE_OSS_PLUGIN_HEADER",
123    ],
124    reexport_all_header_dependencies = True,
125    visibility = ["PUBLIC"],
126    deps = [
127        react_native_xplat_target("react/renderer/mapbuffer:mapbufferApple"),
128    ],
129    exported_deps = [
130        "//xplat/js/react-native-github:FBReactNativeSpecApple",
131        "//xplat/js/react-native-github:RCTLinkingApple",
132        "//xplat/js/react-native-github:RCTPushNotificationApple",
133        "//xplat/js/react-native-github:RCTSettingsApple",
134        "//xplat/js/react-native-github:ReactInternalApple",
135    ],
136)
137