From 8ff23b5411da174a238cedc538e199861147fde4 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Mon, 18 Apr 2016 18:30:55 -0700 Subject: [PATCH] Fix build issues on Android GCC was more strict with how we handled some types. --- react-native/android/src/main/jni/Android.mk | 9 ++------- src/android/io_realm_react_RealmReactModule.cpp | 10 ++++++---- src/android/jsc_override.cpp | 2 +- src/android/platform.cpp | 4 ++-- src/js_list.hpp | 8 ++++---- src/js_object_accessor.hpp | 4 ++-- src/js_realm.hpp | 12 ++++++------ src/js_realm_object.hpp | 12 ++++++------ src/js_results.hpp | 8 ++++---- src/js_schema.hpp | 6 +++--- 10 files changed, 36 insertions(+), 39 deletions(-) diff --git a/react-native/android/src/main/jni/Android.mk b/react-native/android/src/main/jni/Android.mk index 7d90ceb6..c3d61dd1 100644 --- a/react-native/android/src/main/jni/Android.mk +++ b/react-native/android/src/main/jni/Android.mk @@ -15,15 +15,9 @@ include $(CLEAR_VARS) LOCAL_MODULE := librealmreact LOCAL_SRC_FILES := \ - src/js_collection.cpp \ - src/js_list.cpp \ - src/js_results.cpp \ - src/js_init.cpp \ src/js_realm.cpp \ - src/js_util.cpp \ - src/js_object.cpp \ - src/js_schema.cpp \ src/rpc.cpp \ + src/jsc/jsc_init.cpp \ src/android/platform.cpp \ src/android/io_realm_react_RealmReactModule.cpp \ src/android/jsc_override.cpp \ @@ -43,6 +37,7 @@ LOCAL_SRC_FILES := \ vendor/base64.cpp LOCAL_C_INCLUDES := src +LOCAL_C_INCLUDES += src/jsc LOCAL_C_INCLUDES += src/object-store/src LOCAL_C_INCLUDES += src/object-store/src/impl LOCAL_C_INCLUDES += src/object-store/src/parser diff --git a/src/android/io_realm_react_RealmReactModule.cpp b/src/android/io_realm_react_RealmReactModule.cpp index 864b7390..f94761f7 100644 --- a/src/android/io_realm_react_RealmReactModule.cpp +++ b/src/android/io_realm_react_RealmReactModule.cpp @@ -23,7 +23,9 @@ #include "rpc.hpp" #include "platform.hpp" -static realm_js::RPCServer *s_rpc_server; +using namespace realm::rpc; + +static RPCServer *s_rpc_server; extern bool realmContextInjected; JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_setDefaultRealmFileDirectory @@ -46,7 +48,7 @@ JNIEXPORT jlong JNICALL Java_io_realm_react_RealmReactModule_setupChromeDebugMod if (s_rpc_server) { delete s_rpc_server; } - s_rpc_server = new realm_js::RPCServer(); + s_rpc_server = new RPCServer(); return (jlong)s_rpc_server; } @@ -55,8 +57,8 @@ JNIEXPORT jstring JNICALL Java_io_realm_react_RealmReactModule_processChromeDebu { const char* cmd = env->GetStringUTFChars(chrome_cmd, NULL); const char* args = env->GetStringUTFChars(chrome_args, NULL); - realm_js::json json = realm_js::json::parse(args); - realm_js::json response = s_rpc_server->perform_request(cmd, json); + json parsed_args = json::parse(args); + json response = s_rpc_server->perform_request(cmd, parsed_args); env->ReleaseStringUTFChars(chrome_cmd, cmd); env->ReleaseStringUTFChars(chrome_args, args); return env->NewStringUTF(response.dump().c_str()); diff --git a/src/android/jsc_override.cpp b/src/android/jsc_override.cpp index 8b49ef25..4ec0399e 100644 --- a/src/android/jsc_override.cpp +++ b/src/android/jsc_override.cpp @@ -23,7 +23,7 @@ #include #include -#include "js_init.h" +#include "jsc_init.h" #include "shared_realm.hpp" #include "realm_coordinator.hpp" diff --git a/src/android/platform.cpp b/src/android/platform.cpp index e4d29fa9..1ce4a029 100644 --- a/src/android/platform.cpp +++ b/src/android/platform.cpp @@ -16,11 +16,11 @@ // //////////////////////////////////////////////////////////////////////////// -#include "../platform.hpp" - #include "../js_init.h" #include #include +#include "../platform.hpp" + std::string s_default_realm_directory; namespace realm { diff --git a/src/js_list.hpp b/src/js_list.hpp index 63207841..628de5f1 100644 --- a/src/js_list.hpp +++ b/src/js_list.hpp @@ -37,9 +37,9 @@ class List { using ContextType = typename T::Context; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using Object = Object; - using Value = Value; - using ReturnValue = ReturnValue; + using Object = js::Object; + using Value = js::Value; + using ReturnValue = js::ReturnValue; public: static ObjectType create_instance(ContextType, realm::List &); @@ -62,7 +62,7 @@ class List { template struct ListClass : ClassDefinition> { - using List = List; + using List = js::List; std::string const name = "List"; diff --git a/src/js_object_accessor.hpp b/src/js_object_accessor.hpp index dd513247..9234b27f 100644 --- a/src/js_object_accessor.hpp +++ b/src/js_object_accessor.hpp @@ -30,8 +30,8 @@ struct NativeAccessor { using ContextType = typename T::Context; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using Object = Object; - using Value = Value; + using Object = js::Object; + using Value = js::Value; static bool dict_has_value_for_key(ContextType ctx, ValueType dict, const std::string &prop_name) { ObjectType object = Value::validated_to_object(ctx, dict); diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 6b7ecbee..17b02634 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -47,7 +47,7 @@ class RealmDelegate : public BindingContext { using FunctionType = typename T::Function; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using Value = Value; + using Value = js::Value; using ObjectDefaultsMap = typename Schema::ObjectDefaultsMap; using ConstructorMap = typename Schema::ConstructorMap; @@ -121,10 +121,10 @@ class Realm { using FunctionType = typename T::Function; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using String = String; - using Object = Object; - using Value = Value; - using ReturnValue = ReturnValue; + using String = js::String; + using Object = js::Object; + using Value = js::Value; + using ReturnValue = js::ReturnValue; using NativeAccessor = realm::NativeAccessor; public: @@ -189,7 +189,7 @@ class Realm { template struct RealmClass : ClassDefinition { - using Realm = Realm; + using Realm = js::Realm; std::string const name = "Realm"; diff --git a/src/js_realm_object.hpp b/src/js_realm_object.hpp index 48b4a97d..c5df2226 100644 --- a/src/js_realm_object.hpp +++ b/src/js_realm_object.hpp @@ -34,11 +34,11 @@ class RealmObject { using FunctionType = typename T::Function; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using String = String; - using Value = Value; - using Object = Object; - using Function = Function; - using ReturnValue = ReturnValue; + using String = js::String; + using Value = js::Value; + using Object = js::Object; + using Function = js::Function; + using ReturnValue = js::ReturnValue; public: static ObjectType create_instance(ContextType, realm::Object &); @@ -50,7 +50,7 @@ class RealmObject { template struct RealmObjectClass : ClassDefinition { - using RealmObject = RealmObject; + using RealmObject = js::RealmObject; const std::string name = "RealmObject"; diff --git a/src/js_results.hpp b/src/js_results.hpp index 92b72c45..0318fb53 100644 --- a/src/js_results.hpp +++ b/src/js_results.hpp @@ -34,9 +34,9 @@ class Results { using ContextType = typename T::Context; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using Object = Object; - using Value = Value; - using ReturnValue = ReturnValue; + using Object = js::Object; + using Value = js::Value; + using ReturnValue = js::ReturnValue; public: static ObjectType create_instance(ContextType, const realm::Results &, bool live = true); @@ -60,7 +60,7 @@ class Results { template struct ResultsClass : ClassDefinition> { - using Results = Results; + using Results = js::Results; std::string const name = "Results"; diff --git a/src/js_schema.hpp b/src/js_schema.hpp index 31927abd..92e5c673 100644 --- a/src/js_schema.hpp +++ b/src/js_schema.hpp @@ -32,9 +32,9 @@ struct Schema { using FunctionType = typename T::Function; using ObjectType = typename T::Object; using ValueType = typename T::Value; - using String = String; - using Object = Object; - using Value = Value; + using String = js::String; + using Object = js::Object; + using Value = js::Value; using ObjectDefaults = std::map>; using ObjectDefaultsMap = std::map;