Revert D4588356: Refactor dependencies
Differential Revision: D4588356 fbshipit-source-id: 88cd348ed10cbf51e8ea4cde7503f6e0f9e6c572
This commit is contained in:
parent
5c24a9110a
commit
f0394ce38b
|
@ -30,11 +30,10 @@ def react_native_integration_tests_target(path):
|
|||
def react_native_dep(path):
|
||||
return '//ReactAndroid/src/main/' + path
|
||||
|
||||
JSC_INTERNAL_DEPS = [
|
||||
JSC_DEPS = [
|
||||
'//native/third-party/jsc:jsc',
|
||||
'//native/third-party/jsc:jsc_legacy_profiler',
|
||||
]
|
||||
JSC_DEPS = JSC_INTERNAL_DEPS
|
||||
|
||||
YOGA_TARGET = '//ReactAndroid/src/main/java/com/facebook:yoga'
|
||||
FBGLOGINIT_TARGET = '//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit'
|
||||
|
|
|
@ -7,89 +7,51 @@ EXPORTED_HEADERS = [
|
|||
"Value.h",
|
||||
]
|
||||
|
||||
EXPORTED_HEADER_MAP = subdir_glob(
|
||||
(("", header) for header in EXPORTED_HEADERS),
|
||||
prefix = "jschelpers",
|
||||
)
|
||||
|
||||
if THIS_IS_FBANDROID:
|
||||
include_defs("//ReactAndroid/DEFS")
|
||||
include_defs('//ReactAndroid/DEFS')
|
||||
|
||||
cxx_library(
|
||||
name = "jscinternalhelpers",
|
||||
name = 'jschelpers',
|
||||
force_static = True,
|
||||
compiler_flags = [
|
||||
"-Wall",
|
||||
"-fexceptions",
|
||||
"-fvisibility=hidden",
|
||||
"-std=c++1y",
|
||||
'-Wall',
|
||||
'-fexceptions',
|
||||
'-fvisibility=hidden',
|
||||
'-std=c++1y',
|
||||
],
|
||||
exported_headers = EXPORTED_HEADERS,
|
||||
headers = glob(["*.h"], excludes=EXPORTED_HEADERS),
|
||||
header_namespace = "jschelpers",
|
||||
srcs = glob(["*.cpp"], excludes=["systemJSCWrapper.cpp"]),
|
||||
deps = JSC_INTERNAL_DEPS + [
|
||||
"//xplat/folly:molly",
|
||||
headers = glob(['*.h'], excludes=EXPORTED_HEADERS),
|
||||
header_namespace = 'jschelpers',
|
||||
srcs = glob(['*.cpp']),
|
||||
deps = JSC_DEPS + [
|
||||
'//xplat/folly:molly',
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
)
|
||||
|
||||
cxx_library(
|
||||
name = "jschelpers",
|
||||
force_static = True,
|
||||
compiler_flags = [
|
||||
"-Wall",
|
||||
"-fexceptions",
|
||||
"-fvisibility=hidden",
|
||||
"-std=c++1y",
|
||||
],
|
||||
srcs = [],
|
||||
deps = [ ":jscinternalhelpers" ],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
||||
|
||||
if THIS_IS_FBOBJC:
|
||||
|
||||
ios_library(
|
||||
name = "jscinternalhelpers",
|
||||
name = 'jschelpers',
|
||||
inherited_buck_flags = STATIC_LIBRARY_IOS_FLAGS,
|
||||
compiler_flags = [
|
||||
"-Wall",
|
||||
"-fexceptions",
|
||||
"-fvisibility=hidden",
|
||||
"-std=c++1y",
|
||||
'-Wall',
|
||||
'-fexceptions',
|
||||
'-fvisibility=hidden',
|
||||
'-std=c++1y',
|
||||
],
|
||||
exported_headers = EXPORTED_HEADER_MAP,
|
||||
headers = subdir_glob([("", "*.h")], excludes=EXPORTED_HEADERS, prefix="jschelpers"),
|
||||
header_namespace = "jschelpers",
|
||||
srcs = glob(["*.cpp"], excludes=["systemJSCWrapper.cpp"]),
|
||||
deps = [
|
||||
"//xplat/folly:molly",
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
)
|
||||
|
||||
ios_library(
|
||||
name = "jschelpers",
|
||||
inherited_buck_flags = STATIC_LIBRARY_IOS_FLAGS,
|
||||
compiler_flags = [
|
||||
"-Wall",
|
||||
"-fexceptions",
|
||||
"-fvisibility=hidden",
|
||||
"-std=c++1y",
|
||||
],
|
||||
srcs = ["systemJSCWrapper.cpp"],
|
||||
exported_headers = EXPORTED_HEADERS,
|
||||
headers = glob(['*.h'], excludes=EXPORTED_HEADERS),
|
||||
header_namespace = 'jschelpers',
|
||||
srcs = glob(['*.cpp']),
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework",
|
||||
'$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework',
|
||||
],
|
||||
deps = [
|
||||
'//xplat/folly:molly',
|
||||
],
|
||||
deps = [ ":jscinternalhelpers" ],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include <mutex>
|
||||
|
||||
// TODO: use glog in OSS too
|
||||
#if __has_include(<glog/logging.h>)
|
||||
#define USE_GLOG 1
|
||||
|
@ -19,11 +21,36 @@
|
|||
#define USE_GLOG 0
|
||||
#endif
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
// Crash the app (with a descriptive stack trace) if a function that is not supported by
|
||||
// the system JSC is called.
|
||||
#define UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FUNC_NAME) \
|
||||
static void Unimplemented_##FUNC_NAME(__unused void* args...) { \
|
||||
assert(false); \
|
||||
}
|
||||
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSEvaluateBytecodeBundle)
|
||||
#if WITH_FBJSCEXTENSIONS
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStringCreateWithUTF8CStringExpectAscii)
|
||||
#endif
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSPokeSamplingProfiler)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStartSamplingProfilingOnMainJSCThread)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(configureJSCForIOS)
|
||||
|
||||
bool JSSamplingProfilerEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int32_t JSNoBytecodeFileFormatVersion = -1;
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static const JSCWrapper* s_customWrapper = nullptr;
|
||||
|
||||
static JSCWrapper s_systemWrapper = {};
|
||||
|
||||
bool isCustomJSCWrapperSet() {
|
||||
return s_customWrapper != nullptr;
|
||||
}
|
||||
|
@ -42,6 +69,96 @@ void setCustomJSCWrapper(const JSCWrapper* wrapper) {
|
|||
s_customWrapper = wrapper;
|
||||
}
|
||||
|
||||
const JSCWrapper* systemJSCWrapper() {
|
||||
// Note that this is not used on Android. All methods are statically linked instead.
|
||||
// Some fields are lazily initialized
|
||||
static std::once_flag flag;
|
||||
std::call_once(flag, []() {
|
||||
s_systemWrapper = {
|
||||
.JSGlobalContextCreateInGroup = JSGlobalContextCreateInGroup,
|
||||
.JSGlobalContextRelease = JSGlobalContextRelease,
|
||||
.JSGlobalContextSetName = JSGlobalContextSetName,
|
||||
|
||||
.JSContextGetGlobalContext = JSContextGetGlobalContext,
|
||||
.JSContextGetGlobalObject = JSContextGetGlobalObject,
|
||||
|
||||
.JSEvaluateScript = JSEvaluateScript,
|
||||
.JSEvaluateBytecodeBundle =
|
||||
(decltype(&JSEvaluateBytecodeBundle))
|
||||
Unimplemented_JSEvaluateBytecodeBundle,
|
||||
|
||||
.JSStringCreateWithUTF8CString = JSStringCreateWithUTF8CString,
|
||||
.JSStringCreateWithCFString = JSStringCreateWithCFString,
|
||||
#if WITH_FBJSCEXTENSIONS
|
||||
.JSStringCreateWithUTF8CStringExpectAscii =
|
||||
(decltype(&JSStringCreateWithUTF8CStringExpectAscii))
|
||||
Unimplemented_JSStringCreateWithUTF8CStringExpectAscii,
|
||||
#endif
|
||||
.JSStringCopyCFString = JSStringCopyCFString,
|
||||
.JSStringGetCharactersPtr = JSStringGetCharactersPtr,
|
||||
.JSStringGetLength = JSStringGetLength,
|
||||
.JSStringGetMaximumUTF8CStringSize = JSStringGetMaximumUTF8CStringSize,
|
||||
.JSStringIsEqualToUTF8CString = JSStringIsEqualToUTF8CString,
|
||||
.JSStringRelease = JSStringRelease,
|
||||
.JSStringRetain = JSStringRetain,
|
||||
|
||||
.JSClassCreate = JSClassCreate,
|
||||
.JSClassRelease = JSClassRelease,
|
||||
|
||||
.JSObjectCallAsConstructor = JSObjectCallAsConstructor,
|
||||
.JSObjectCallAsFunction = JSObjectCallAsFunction,
|
||||
.JSObjectGetPrivate = JSObjectGetPrivate,
|
||||
.JSObjectGetProperty = JSObjectGetProperty,
|
||||
.JSObjectGetPropertyAtIndex = JSObjectGetPropertyAtIndex,
|
||||
.JSObjectIsConstructor = JSObjectIsConstructor,
|
||||
.JSObjectIsFunction = JSObjectIsFunction,
|
||||
.JSObjectMake = JSObjectMake,
|
||||
.JSObjectMakeArray = JSObjectMakeArray,
|
||||
.JSObjectMakeError = JSObjectMakeError,
|
||||
.JSObjectMakeFunctionWithCallback = JSObjectMakeFunctionWithCallback,
|
||||
.JSObjectSetPrivate = JSObjectSetPrivate,
|
||||
.JSObjectSetProperty = JSObjectSetProperty,
|
||||
|
||||
.JSObjectCopyPropertyNames = JSObjectCopyPropertyNames,
|
||||
.JSPropertyNameArrayGetCount = JSPropertyNameArrayGetCount,
|
||||
.JSPropertyNameArrayGetNameAtIndex = JSPropertyNameArrayGetNameAtIndex,
|
||||
.JSPropertyNameArrayRelease = JSPropertyNameArrayRelease,
|
||||
|
||||
.JSValueCreateJSONString = JSValueCreateJSONString,
|
||||
.JSValueGetType = JSValueGetType,
|
||||
.JSValueMakeFromJSONString = JSValueMakeFromJSONString,
|
||||
.JSValueMakeBoolean = JSValueMakeBoolean,
|
||||
.JSValueMakeNull = JSValueMakeNull,
|
||||
.JSValueMakeNumber = JSValueMakeNumber,
|
||||
.JSValueMakeString = JSValueMakeString,
|
||||
.JSValueMakeUndefined = JSValueMakeUndefined,
|
||||
.JSValueProtect = JSValueProtect,
|
||||
.JSValueToBoolean = JSValueToBoolean,
|
||||
.JSValueToNumber = JSValueToNumber,
|
||||
.JSValueToObject = JSValueToObject,
|
||||
.JSValueToStringCopy = JSValueToStringCopy,
|
||||
.JSValueUnprotect = JSValueUnprotect,
|
||||
|
||||
.JSSamplingProfilerEnabled = JSSamplingProfilerEnabled,
|
||||
.JSPokeSamplingProfiler =
|
||||
(decltype(&JSPokeSamplingProfiler))
|
||||
Unimplemented_JSPokeSamplingProfiler,
|
||||
.JSStartSamplingProfilingOnMainJSCThread =
|
||||
(decltype(&JSStartSamplingProfilingOnMainJSCThread))
|
||||
Unimplemented_JSStartSamplingProfilingOnMainJSCThread,
|
||||
|
||||
.configureJSCForIOS =
|
||||
(decltype(&configureJSCForIOS))Unimplemented_configureJSCForIOS,
|
||||
|
||||
.JSContext = objc_getClass("JSContext"),
|
||||
.JSValue = objc_getClass("JSValue"),
|
||||
|
||||
.JSBytecodeFileFormatVersion = JSNoBytecodeFileFormatVersion,
|
||||
};
|
||||
});
|
||||
return &s_systemWrapper;
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2016-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include <jschelpers/JSCWrapper.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
// Crash the app (with a descriptive stack trace) if a function that is not supported by
|
||||
// the system JSC is called.
|
||||
#define UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FUNC_NAME) \
|
||||
static void Unimplemented_##FUNC_NAME(__unused void* args...) { \
|
||||
assert(false); \
|
||||
}
|
||||
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSEvaluateBytecodeBundle)
|
||||
#if WITH_FBJSCEXTENSIONS
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStringCreateWithUTF8CStringExpectAscii)
|
||||
#endif
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSPokeSamplingProfiler)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStartSamplingProfilingOnMainJSCThread)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(configureJSCForIOS)
|
||||
|
||||
bool JSSamplingProfilerEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int32_t JSNoBytecodeFileFormatVersion = -1;
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static JSCWrapper s_systemWrapper = {};
|
||||
|
||||
const JSCWrapper* systemJSCWrapper() {
|
||||
// Note that this is not used on Android. All methods are statically linked instead.
|
||||
// Some fields are lazily initialized
|
||||
static std::once_flag flag;
|
||||
std::call_once(flag, []() {
|
||||
s_systemWrapper = {
|
||||
.JSGlobalContextCreateInGroup = JSGlobalContextCreateInGroup,
|
||||
.JSGlobalContextRelease = JSGlobalContextRelease,
|
||||
.JSGlobalContextSetName = JSGlobalContextSetName,
|
||||
|
||||
.JSContextGetGlobalContext = JSContextGetGlobalContext,
|
||||
.JSContextGetGlobalObject = JSContextGetGlobalObject,
|
||||
|
||||
.JSEvaluateScript = JSEvaluateScript,
|
||||
.JSEvaluateBytecodeBundle =
|
||||
(decltype(&JSEvaluateBytecodeBundle))
|
||||
Unimplemented_JSEvaluateBytecodeBundle,
|
||||
|
||||
.JSStringCreateWithUTF8CString = JSStringCreateWithUTF8CString,
|
||||
.JSStringCreateWithCFString = JSStringCreateWithCFString,
|
||||
#if WITH_FBJSCEXTENSIONS
|
||||
.JSStringCreateWithUTF8CStringExpectAscii =
|
||||
(decltype(&JSStringCreateWithUTF8CStringExpectAscii))
|
||||
Unimplemented_JSStringCreateWithUTF8CStringExpectAscii,
|
||||
#endif
|
||||
.JSStringCopyCFString = JSStringCopyCFString,
|
||||
.JSStringGetCharactersPtr = JSStringGetCharactersPtr,
|
||||
.JSStringGetLength = JSStringGetLength,
|
||||
.JSStringGetMaximumUTF8CStringSize = JSStringGetMaximumUTF8CStringSize,
|
||||
.JSStringIsEqualToUTF8CString = JSStringIsEqualToUTF8CString,
|
||||
.JSStringRelease = JSStringRelease,
|
||||
.JSStringRetain = JSStringRetain,
|
||||
|
||||
.JSClassCreate = JSClassCreate,
|
||||
.JSClassRelease = JSClassRelease,
|
||||
|
||||
.JSObjectCallAsConstructor = JSObjectCallAsConstructor,
|
||||
.JSObjectCallAsFunction = JSObjectCallAsFunction,
|
||||
.JSObjectGetPrivate = JSObjectGetPrivate,
|
||||
.JSObjectGetProperty = JSObjectGetProperty,
|
||||
.JSObjectGetPropertyAtIndex = JSObjectGetPropertyAtIndex,
|
||||
.JSObjectIsConstructor = JSObjectIsConstructor,
|
||||
.JSObjectIsFunction = JSObjectIsFunction,
|
||||
.JSObjectMake = JSObjectMake,
|
||||
.JSObjectMakeArray = JSObjectMakeArray,
|
||||
.JSObjectMakeError = JSObjectMakeError,
|
||||
.JSObjectMakeFunctionWithCallback = JSObjectMakeFunctionWithCallback,
|
||||
.JSObjectSetPrivate = JSObjectSetPrivate,
|
||||
.JSObjectSetProperty = JSObjectSetProperty,
|
||||
|
||||
.JSObjectCopyPropertyNames = JSObjectCopyPropertyNames,
|
||||
.JSPropertyNameArrayGetCount = JSPropertyNameArrayGetCount,
|
||||
.JSPropertyNameArrayGetNameAtIndex = JSPropertyNameArrayGetNameAtIndex,
|
||||
.JSPropertyNameArrayRelease = JSPropertyNameArrayRelease,
|
||||
|
||||
.JSValueCreateJSONString = JSValueCreateJSONString,
|
||||
.JSValueGetType = JSValueGetType,
|
||||
.JSValueMakeFromJSONString = JSValueMakeFromJSONString,
|
||||
.JSValueMakeBoolean = JSValueMakeBoolean,
|
||||
.JSValueMakeNull = JSValueMakeNull,
|
||||
.JSValueMakeNumber = JSValueMakeNumber,
|
||||
.JSValueMakeString = JSValueMakeString,
|
||||
.JSValueMakeUndefined = JSValueMakeUndefined,
|
||||
.JSValueProtect = JSValueProtect,
|
||||
.JSValueToBoolean = JSValueToBoolean,
|
||||
.JSValueToNumber = JSValueToNumber,
|
||||
.JSValueToObject = JSValueToObject,
|
||||
.JSValueToStringCopy = JSValueToStringCopy,
|
||||
.JSValueUnprotect = JSValueUnprotect,
|
||||
|
||||
.JSSamplingProfilerEnabled = JSSamplingProfilerEnabled,
|
||||
.JSPokeSamplingProfiler =
|
||||
(decltype(&JSPokeSamplingProfiler))
|
||||
Unimplemented_JSPokeSamplingProfiler,
|
||||
.JSStartSamplingProfilingOnMainJSCThread =
|
||||
(decltype(&JSStartSamplingProfilingOnMainJSCThread))
|
||||
Unimplemented_JSStartSamplingProfilingOnMainJSCThread,
|
||||
|
||||
.configureJSCForIOS =
|
||||
(decltype(&configureJSCForIOS))Unimplemented_configureJSCForIOS,
|
||||
|
||||
.JSContext = objc_getClass("JSContext"),
|
||||
.JSValue = objc_getClass("JSValue"),
|
||||
|
||||
.JSBytecodeFileFormatVersion = JSNoBytecodeFileFormatVersion,
|
||||
};
|
||||
});
|
||||
return &s_systemWrapper;
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue