Fix build issues on Android

GCC was more strict with how we handled some types.
This commit is contained in:
Scott Kyle 2016-04-18 18:30:55 -07:00
parent 73cfca7d81
commit 8ff23b5411
10 changed files with 36 additions and 39 deletions

View File

@ -15,15 +15,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE := librealmreact LOCAL_MODULE := librealmreact
LOCAL_SRC_FILES := \ 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_realm.cpp \
src/js_util.cpp \
src/js_object.cpp \
src/js_schema.cpp \
src/rpc.cpp \ src/rpc.cpp \
src/jsc/jsc_init.cpp \
src/android/platform.cpp \ src/android/platform.cpp \
src/android/io_realm_react_RealmReactModule.cpp \ src/android/io_realm_react_RealmReactModule.cpp \
src/android/jsc_override.cpp \ src/android/jsc_override.cpp \
@ -43,6 +37,7 @@ LOCAL_SRC_FILES := \
vendor/base64.cpp vendor/base64.cpp
LOCAL_C_INCLUDES := src LOCAL_C_INCLUDES := src
LOCAL_C_INCLUDES += src/jsc
LOCAL_C_INCLUDES += src/object-store/src LOCAL_C_INCLUDES += src/object-store/src
LOCAL_C_INCLUDES += src/object-store/src/impl LOCAL_C_INCLUDES += src/object-store/src/impl
LOCAL_C_INCLUDES += src/object-store/src/parser LOCAL_C_INCLUDES += src/object-store/src/parser

View File

@ -23,7 +23,9 @@
#include "rpc.hpp" #include "rpc.hpp"
#include "platform.hpp" #include "platform.hpp"
static realm_js::RPCServer *s_rpc_server; using namespace realm::rpc;
static RPCServer *s_rpc_server;
extern bool realmContextInjected; extern bool realmContextInjected;
JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_setDefaultRealmFileDirectory 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) { if (s_rpc_server) {
delete s_rpc_server; delete s_rpc_server;
} }
s_rpc_server = new realm_js::RPCServer(); s_rpc_server = new RPCServer();
return (jlong)s_rpc_server; 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* cmd = env->GetStringUTFChars(chrome_cmd, NULL);
const char* args = env->GetStringUTFChars(chrome_args, NULL); const char* args = env->GetStringUTFChars(chrome_args, NULL);
realm_js::json json = realm_js::json::parse(args); json parsed_args = json::parse(args);
realm_js::json response = s_rpc_server->perform_request(cmd, json); json response = s_rpc_server->perform_request(cmd, parsed_args);
env->ReleaseStringUTFChars(chrome_cmd, cmd); env->ReleaseStringUTFChars(chrome_cmd, cmd);
env->ReleaseStringUTFChars(chrome_args, args); env->ReleaseStringUTFChars(chrome_args, args);
return env->NewStringUTF(response.dump().c_str()); return env->NewStringUTF(response.dump().c_str());

View File

@ -23,7 +23,7 @@
#include <mutex> #include <mutex>
#include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSContextRef.h>
#include "js_init.h" #include "jsc_init.h"
#include "shared_realm.hpp" #include "shared_realm.hpp"
#include "realm_coordinator.hpp" #include "realm_coordinator.hpp"

View File

@ -16,11 +16,11 @@
// //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#include "../platform.hpp"
#include "../js_init.h"
#include <string> #include <string>
#include <stdlib.h> #include <stdlib.h>
#include "../platform.hpp"
std::string s_default_realm_directory; std::string s_default_realm_directory;
namespace realm { namespace realm {

View File

@ -37,9 +37,9 @@ class List {
using ContextType = typename T::Context; using ContextType = typename T::Context;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using Object = Object<T>; using Object = js::Object<T>;
using Value = Value<T>; using Value = js::Value<T>;
using ReturnValue = ReturnValue<T>; using ReturnValue = js::ReturnValue<T>;
public: public:
static ObjectType create_instance(ContextType, realm::List &); static ObjectType create_instance(ContextType, realm::List &);
@ -62,7 +62,7 @@ class List {
template<typename T> template<typename T>
struct ListClass : ClassDefinition<T, realm::List, CollectionClass<T>> { struct ListClass : ClassDefinition<T, realm::List, CollectionClass<T>> {
using List = List<T>; using List = js::List<T>;
std::string const name = "List"; std::string const name = "List";

View File

@ -30,8 +30,8 @@ struct NativeAccessor {
using ContextType = typename T::Context; using ContextType = typename T::Context;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using Object = Object<T>; using Object = js::Object<T>;
using Value = Value<T>; using Value = js::Value<T>;
static bool dict_has_value_for_key(ContextType ctx, ValueType dict, const std::string &prop_name) { static bool dict_has_value_for_key(ContextType ctx, ValueType dict, const std::string &prop_name) {
ObjectType object = Value::validated_to_object(ctx, dict); ObjectType object = Value::validated_to_object(ctx, dict);

View File

@ -47,7 +47,7 @@ class RealmDelegate : public BindingContext {
using FunctionType = typename T::Function; using FunctionType = typename T::Function;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using Value = Value<T>; using Value = js::Value<T>;
using ObjectDefaultsMap = typename Schema<T>::ObjectDefaultsMap; using ObjectDefaultsMap = typename Schema<T>::ObjectDefaultsMap;
using ConstructorMap = typename Schema<T>::ConstructorMap; using ConstructorMap = typename Schema<T>::ConstructorMap;
@ -121,10 +121,10 @@ class Realm {
using FunctionType = typename T::Function; using FunctionType = typename T::Function;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using String = String<T>; using String = js::String<T>;
using Object = Object<T>; using Object = js::Object<T>;
using Value = Value<T>; using Value = js::Value<T>;
using ReturnValue = ReturnValue<T>; using ReturnValue = js::ReturnValue<T>;
using NativeAccessor = realm::NativeAccessor<ValueType, ContextType>; using NativeAccessor = realm::NativeAccessor<ValueType, ContextType>;
public: public:
@ -189,7 +189,7 @@ class Realm {
template<typename T> template<typename T>
struct RealmClass : ClassDefinition<T, SharedRealm> { struct RealmClass : ClassDefinition<T, SharedRealm> {
using Realm = Realm<T>; using Realm = js::Realm<T>;
std::string const name = "Realm"; std::string const name = "Realm";

View File

@ -34,11 +34,11 @@ class RealmObject {
using FunctionType = typename T::Function; using FunctionType = typename T::Function;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using String = String<T>; using String = js::String<T>;
using Value = Value<T>; using Value = js::Value<T>;
using Object = Object<T>; using Object = js::Object<T>;
using Function = Function<T>; using Function = js::Function<T>;
using ReturnValue = ReturnValue<T>; using ReturnValue = js::ReturnValue<T>;
public: public:
static ObjectType create_instance(ContextType, realm::Object &); static ObjectType create_instance(ContextType, realm::Object &);
@ -50,7 +50,7 @@ class RealmObject {
template<typename T> template<typename T>
struct RealmObjectClass : ClassDefinition<T, realm::Object> { struct RealmObjectClass : ClassDefinition<T, realm::Object> {
using RealmObject = RealmObject<T>; using RealmObject = js::RealmObject<T>;
const std::string name = "RealmObject"; const std::string name = "RealmObject";

View File

@ -34,9 +34,9 @@ class Results {
using ContextType = typename T::Context; using ContextType = typename T::Context;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using Object = Object<T>; using Object = js::Object<T>;
using Value = Value<T>; using Value = js::Value<T>;
using ReturnValue = ReturnValue<T>; using ReturnValue = js::ReturnValue<T>;
public: public:
static ObjectType create_instance(ContextType, const realm::Results &, bool live = true); static ObjectType create_instance(ContextType, const realm::Results &, bool live = true);
@ -60,7 +60,7 @@ class Results {
template<typename T> template<typename T>
struct ResultsClass : ClassDefinition<T, realm::Results, CollectionClass<T>> { struct ResultsClass : ClassDefinition<T, realm::Results, CollectionClass<T>> {
using Results = Results<T>; using Results = js::Results<T>;
std::string const name = "Results"; std::string const name = "Results";

View File

@ -32,9 +32,9 @@ struct Schema {
using FunctionType = typename T::Function; using FunctionType = typename T::Function;
using ObjectType = typename T::Object; using ObjectType = typename T::Object;
using ValueType = typename T::Value; using ValueType = typename T::Value;
using String = String<T>; using String = js::String<T>;
using Object = Object<T>; using Object = js::Object<T>;
using Value = Value<T>; using Value = js::Value<T>;
using ObjectDefaults = std::map<std::string, Protected<ValueType>>; using ObjectDefaults = std::map<std::string, Protected<ValueType>>;
using ObjectDefaultsMap = std::map<std::string, ObjectDefaults>; using ObjectDefaultsMap = std::map<std::string, ObjectDefaults>;