mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-22 20:41:18 +00:00
Merge pull request #133 from realm/al-no-gdcwebservers
Don't require any GCDWebServers dependency when building Release
This commit is contained in:
commit
935b72bdac
@ -6,11 +6,14 @@ extern "C" {
|
||||
#import "RealmReact.h"
|
||||
#import "Base/RCTBridge.h"
|
||||
|
||||
#import <GCDWebServers/GCDWebServers.h>
|
||||
#import <RealmJS/RealmJS.h>
|
||||
#import <objc/runtime.h>
|
||||
#import <dlfcn.h>
|
||||
|
||||
#if DEBUG
|
||||
#import <GCDWebServers/GCDWebServers.h>
|
||||
#endif
|
||||
|
||||
@interface NSObject (RCTJavaScriptContext)
|
||||
- (instancetype)initWithJSContext:(JSGlobalContextRef)context;
|
||||
- (JSGlobalContextRef)ctx;
|
||||
@ -66,7 +69,12 @@ JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executor, bool cre
|
||||
|
||||
- (void)setBridge:(RCTBridge *)bridge {
|
||||
_bridge = bridge;
|
||||
|
||||
Ivar executorIvar = class_getInstanceVariable([bridge class], "_javaScriptExecutor");
|
||||
id executor = object_getIvar(bridge, executorIvar);
|
||||
bool chromeDebugMode = [executor isMemberOfClass:NSClassFromString(@"RCTWebSocketExecutor")];
|
||||
|
||||
#if DEBUG
|
||||
static GCDWebServer *s_webServer;
|
||||
static realm_js::RPCServer *rpcServer;
|
||||
|
||||
@ -79,9 +87,7 @@ JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executor, bool cre
|
||||
}
|
||||
|
||||
// The executor could be a RCTWebSocketExecutor, in which case it won't have a JS context.
|
||||
Ivar executorIvar = class_getInstanceVariable([bridge class], "_javaScriptExecutor");
|
||||
id executor = object_getIvar(bridge, executorIvar);
|
||||
if ([executor isMemberOfClass:NSClassFromString(@"RCTWebSocketExecutor")]) {
|
||||
if (chromeDebugMode) {
|
||||
[GCDWebServer setLogLevel:3];
|
||||
GCDWebServer *webServer = [[GCDWebServer alloc] init];
|
||||
rpcServer = new realm_js::RPCServer();
|
||||
@ -117,6 +123,11 @@ JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executor, bool cre
|
||||
s_webServer = webServer;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (chromeDebugMode) {
|
||||
@throw [NSException exceptionWithName:@"Invalid Executor" reason:@"Chrome debug mode not supported in Release builds" userInfo:nil];
|
||||
}
|
||||
|
||||
[executor executeBlockOnJavaScriptQueue:^{
|
||||
JSGlobalContextRef ctx = RealmReactGetJSGlobalContextForExecutor(executor, true);
|
||||
|
@ -64,7 +64,6 @@
|
||||
F67191381BCE231100AD0939 /* GCDWebServers.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 02A3C7941BC4317A00B1A7BE /* GCDWebServers.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
F68A278C1BC2722A0063D40A /* RJSModuleLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = F68A278B1BC2722A0063D40A /* RJSModuleLoader.m */; };
|
||||
F68A278E1BC30F0A0063D40A /* index.js in Resources */ = {isa = PBXBuildFile; fileRef = F68A278D1BC30F0A0063D40A /* index.js */; };
|
||||
F6B3963D1BCE2430008BDC39 /* GCDWebServers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02A3C7941BC4317A00B1A7BE /* GCDWebServers.framework */; };
|
||||
F6F405F81BCF0C1A00A1E24F /* base-test.js in Resources */ = {isa = PBXBuildFile; fileRef = F6F405F71BCF0C1A00A1E24F /* base-test.js */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -227,7 +226,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0291DBD21BD994F700E3852C /* JavaScriptCore.framework in Frameworks */,
|
||||
F6B3963D1BCE2430008BDC39 /* GCDWebServers.framework in Frameworks */,
|
||||
02B29A311B7CF86D008A7E6B /* RealmJS.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -300,6 +298,7 @@
|
||||
0270BCCE1B7D066100010E03 /* RealmReact */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
02EE6D781BD87E310016A82E /* ReactTests.xcodeproj */,
|
||||
0270BCCF1B7D067300010E03 /* RealmReact.h */,
|
||||
0270BCD01B7D067300010E03 /* RealmReact.mm */,
|
||||
);
|
||||
@ -321,8 +320,6 @@
|
||||
02B58CA71AE99CEB009B348C = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
02A3C7841BC4317A00B1A7BE /* GCDWebServer.xcodeproj */,
|
||||
02EE6D781BD87E310016A82E /* ReactTests.xcodeproj */,
|
||||
02B58CCF1AE99D8C009B348C /* Frameworks */,
|
||||
0270BC3D1B7CFBFD00010E03 /* RealmJS */,
|
||||
02B58CC01AE99CEC009B348C /* RealmJSTests */,
|
||||
@ -368,6 +365,7 @@
|
||||
children = (
|
||||
02A3C7A41BC4341500B1A7BE /* libc++.tbd */,
|
||||
02B58CCD1AE99D4D009B348C /* JavaScriptCore.framework */,
|
||||
02A3C7841BC4317A00B1A7BE /* GCDWebServer.xcodeproj */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@ -695,9 +693,11 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
EXCLUDED_SOURCE_FILE_NAMES = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -719,6 +719,10 @@
|
||||
"-isystem",
|
||||
core/include,
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
GCDWebServers,
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
@ -733,9 +737,11 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
EXCLUDED_SOURCE_FILE_NAMES = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -753,6 +759,7 @@
|
||||
"-isystem",
|
||||
core/include,
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
@ -767,9 +774,11 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
EXCLUDED_SOURCE_FILE_NAMES = GCDWebServers.framework;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -787,6 +796,7 @@
|
||||
"-isystem",
|
||||
core/include,
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -25,7 +25,7 @@
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
|
||||
F6F405C71BCE566300A1E24F /* RealmReact.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0277991B1BBF3BB700C96559 /* RealmReact.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
F6F405C71BCE566300A1E24F /* RealmReact.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0277991B1BBF3BB700C96559 /* RealmReact.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -414,7 +414,7 @@
|
||||
83CBB9F71A601CBA00E9B192 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0700;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
00E356ED1AD99517003FC87E = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
Loading…
x
Reference in New Issue
Block a user