Reland: [RN] iOS OSS: define plugin entries for OSS NativeModules
Summary: A reland of f26ffbf561
Reviewed By: sammy-SC
Differential Revision: D16091073
fbshipit-source-id: 09660ba987c3035333eac55e6bb94373fad9252b
This commit is contained in:
Родитель
cd05a85fe5
Коммит
e883197807
|
@ -1,5 +1,9 @@
|
||||||
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_debug_preprocessor_flags", "get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED")
|
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_debug_preprocessor_flags", "get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED")
|
||||||
load("//tools/build_defs/oss:rn_defs.bzl", "rn_debug_flags", "rn_apple_library", "subdir_glob")
|
load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "rn_apple_library", "rn_debug_flags", "subdir_glob")
|
||||||
|
load(
|
||||||
|
"@fbsource//xplat/configurations/buck/apple/plugins/sad_xplat_hosted_configurations:react_module_registration.bzl",
|
||||||
|
"react_module_plugin_providers",
|
||||||
|
)
|
||||||
|
|
||||||
rn_apple_library(
|
rn_apple_library(
|
||||||
name = "CoreModulesApple",
|
name = "CoreModulesApple",
|
||||||
|
@ -9,11 +13,49 @@ rn_apple_library(
|
||||||
"**/*.mm",
|
"**/*.mm",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
headers = glob(
|
headers = ["CoreModulesPlugins.h"],
|
||||||
[
|
compiler_flags = [
|
||||||
"**/*.h",
|
"-Wno-error=unguarded-availability-new",
|
||||||
],
|
"-Wno-unknown-warning-option",
|
||||||
|
],
|
||||||
|
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||||
|
exported_linker_flags = [
|
||||||
|
"-weak_framework",
|
||||||
|
"UserNotifications",
|
||||||
|
"-weak_framework",
|
||||||
|
"WebKit",
|
||||||
|
],
|
||||||
|
exported_preprocessor_flags = rn_debug_flags(),
|
||||||
|
frameworks = [
|
||||||
|
"Foundation",
|
||||||
|
"UIKit",
|
||||||
|
],
|
||||||
|
lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED(),
|
||||||
|
link_whole = True,
|
||||||
|
platform_preprocessor_flags = [(
|
||||||
|
"linux",
|
||||||
|
["-D PIC_MODIFIER=@PLT"],
|
||||||
|
)],
|
||||||
|
plugins = react_module_plugin_providers(
|
||||||
|
name = "PlatformConstants",
|
||||||
|
native_class_func = "RCTPlatformCls",
|
||||||
),
|
),
|
||||||
|
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_debug_flags() + [
|
||||||
|
"-DRN_DISABLE_OSS_PLUGIN_HEADER",
|
||||||
|
],
|
||||||
|
visibility = ["PUBLIC"],
|
||||||
|
exported_deps = [
|
||||||
|
"fbsource//xplat/js/react-native-github:ReactInternalApple",
|
||||||
|
"fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple",
|
||||||
|
":CoreModulesAppleHeader",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Workaround: define exported headers target separately so that the header
|
||||||
|
# namespace can be specified correctly.
|
||||||
|
rn_apple_library(
|
||||||
|
name = "CoreModulesAppleHeader",
|
||||||
|
srcs = [],
|
||||||
header_namespace = "",
|
header_namespace = "",
|
||||||
exported_headers = subdir_glob(
|
exported_headers = subdir_glob(
|
||||||
[
|
[
|
||||||
|
@ -22,6 +64,7 @@ rn_apple_library(
|
||||||
"*.h",
|
"*.h",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
exclude = ["CoreModulesPlugins.h"],
|
||||||
prefix = "React",
|
prefix = "React",
|
||||||
),
|
),
|
||||||
compiler_flags = [
|
compiler_flags = [
|
||||||
|
@ -40,17 +83,17 @@ rn_apple_library(
|
||||||
"Foundation",
|
"Foundation",
|
||||||
"UIKit",
|
"UIKit",
|
||||||
],
|
],
|
||||||
labels = ["depslint_never_add"],
|
|
||||||
lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED(),
|
lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED(),
|
||||||
link_whole = True,
|
link_whole = True,
|
||||||
platform_preprocessor_flags = [(
|
platform_preprocessor_flags = [(
|
||||||
"linux",
|
"linux",
|
||||||
["-D PIC_MODIFIER=@PLT"],
|
["-D PIC_MODIFIER=@PLT"],
|
||||||
)],
|
)],
|
||||||
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_debug_flags(),
|
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_debug_flags() + [
|
||||||
|
"-DRN_DISABLE_OSS_PLUGIN_HEADER",
|
||||||
|
],
|
||||||
visibility = ["PUBLIC"],
|
visibility = ["PUBLIC"],
|
||||||
exported_deps = [
|
exported_deps = [
|
||||||
"fbsource//xplat/js/react-native-github:ReactInternalApple",
|
"fbsource//xplat/js/react-native-github:ReactInternalApple",
|
||||||
"fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
||||||
|
|
||||||
|
// FB Internal: Plugins.h is autogenerated by the build system.
|
||||||
|
#import "Plugins.h"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
//OSS-compatibility layer: manually define these for github.
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: Sync these with FB internal version.
|
||||||
|
|
||||||
|
Class RCTPlatformCls(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
|
|
@ -5,14 +5,15 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "RCTPlatform.h"
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
#import <FBReactNativeSpec/FBReactNativeSpec.h>
|
#import <FBReactNativeSpec/FBReactNativeSpec.h>
|
||||||
|
#import <React/RCTPlatform.h>
|
||||||
#import <React/RCTUtils.h>
|
#import <React/RCTUtils.h>
|
||||||
#import <React/RCTVersion.h>
|
#import <React/RCTVersion.h>
|
||||||
|
|
||||||
|
#import "CoreModulesPlugins.h"
|
||||||
|
|
||||||
using namespace facebook::react;
|
using namespace facebook::react;
|
||||||
|
|
||||||
static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) {
|
static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) {
|
||||||
|
@ -68,3 +69,7 @@ RCT_EXPORT_MODULE(PlatformConstants)
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
Class RCTPlatformCls(void) {
|
||||||
|
return RCTPlatform.class;
|
||||||
|
}
|
||||||
|
|
|
@ -331,3 +331,8 @@ def jni_instrumentation_test_lib(**_kwargs):
|
||||||
def fb_xplat_cxx_test(**_kwargs):
|
def fb_xplat_cxx_test(**_kwargs):
|
||||||
"""A noop stub for OSS build."""
|
"""A noop stub for OSS build."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# iOS Plugin support.
|
||||||
|
def react_module_plugin_providers():
|
||||||
|
# Noop for now
|
||||||
|
return []
|
||||||
|
|
Загрузка…
Ссылка в новой задаче