mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
commit
049db589a8
21
binding.gyp
21
binding.gyp
@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"target_name": "object-store",
|
"target_name": "object-store",
|
||||||
"dependencies": [ "realm-core", "realm-sync" ],
|
"dependencies": [ "realm-core" ],
|
||||||
"type": "static_library",
|
"type": "static_library",
|
||||||
"include_dirs": [
|
"include_dirs": [
|
||||||
"src/object-store/src",
|
"src/object-store/src",
|
||||||
@ -63,12 +63,6 @@
|
|||||||
"src/object-store/src/parser/query_builder.cpp",
|
"src/object-store/src/parser/query_builder.cpp",
|
||||||
"src/object-store/src/util/format.cpp",
|
"src/object-store/src/util/format.cpp",
|
||||||
"src/object-store/src/util/thread_id.cpp",
|
"src/object-store/src/util/thread_id.cpp",
|
||||||
"src/object-store/src/sync/sync_manager.cpp",
|
|
||||||
"src/object-store/src/sync/sync_user.cpp",
|
|
||||||
"src/object-store/src/sync/sync_session.cpp",
|
|
||||||
"src/object-store/src/sync/impl/sync_file.cpp",
|
|
||||||
"src/object-store/src/sync/impl/sync_metadata.cpp",
|
|
||||||
"src/object-store/src/impl/apple/keychain_helper.cpp"
|
|
||||||
],
|
],
|
||||||
"conditions": [
|
"conditions": [
|
||||||
["OS=='linux'", {
|
["OS=='linux'", {
|
||||||
@ -80,10 +74,21 @@
|
|||||||
"sources": [
|
"sources": [
|
||||||
"src/object-store/src/impl/apple/external_commit_helper.cpp"
|
"src/object-store/src/impl/apple/external_commit_helper.cpp"
|
||||||
]
|
]
|
||||||
|
}],
|
||||||
|
["realm_enable_sync", {
|
||||||
|
"dependencies": [ "realm-sync" ],
|
||||||
|
"sources": [
|
||||||
|
"src/object-store/src/sync/sync_manager.cpp",
|
||||||
|
"src/object-store/src/sync/sync_user.cpp",
|
||||||
|
"src/object-store/src/sync/sync_session.cpp",
|
||||||
|
"src/object-store/src/sync/impl/sync_file.cpp",
|
||||||
|
"src/object-store/src/sync/impl/sync_metadata.cpp",
|
||||||
|
"src/object-store/src/impl/apple/keychain_helper.cpp"
|
||||||
|
],
|
||||||
}]
|
}]
|
||||||
],
|
],
|
||||||
"all_dependent_settings": {
|
"all_dependent_settings": {
|
||||||
"include_dirs": [
|
"include_dirs": [
|
||||||
"src/object-store/src",
|
"src/object-store/src",
|
||||||
"src/object-store/src/impl",
|
"src/object-store/src/impl",
|
||||||
"src/object-store/src/impl/apple",
|
"src/object-store/src/impl/apple",
|
||||||
|
@ -30,9 +30,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
SYNC_DIR='sync'
|
SYNC_DIR='sync'
|
||||||
SYNC_PLATFORM_TAG="cocoa-"
|
SYNC_PLATFORM_TAG="node-cocoa-"
|
||||||
|
|
||||||
SYNC_DOWNLOAD_FILE="realm-sync-$SYNC_PLATFORM_TAG$REALM_SYNC_VERSION.tar.xz"
|
SYNC_DOWNLOAD_FILE="realm-sync-$SYNC_PLATFORM_TAG$REALM_SYNC_VERSION.zip"
|
||||||
|
|
||||||
# Start current working directory at the root of the project.
|
# Start current working directory at the root of the project.
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
@ -47,6 +47,8 @@ download_core() {
|
|||||||
local VERSION=$2
|
local VERSION=$2
|
||||||
local DOWNLOAD_FILE=$3
|
local DOWNLOAD_FILE=$3
|
||||||
local SERVER_DIR=$4
|
local SERVER_DIR=$4
|
||||||
|
local UNTAR=$5
|
||||||
|
local UNTARRED_DIR=$6
|
||||||
echo "Downloading dependency: $DIR $VERSION"
|
echo "Downloading dependency: $DIR $VERSION"
|
||||||
|
|
||||||
local TMP_DIR="${TMPDIR:-/tmp}/$DIR"
|
local TMP_DIR="${TMPDIR:-/tmp}/$DIR"
|
||||||
@ -56,7 +58,7 @@ download_core() {
|
|||||||
mkdir -p "$TMP_DIR"
|
mkdir -p "$TMP_DIR"
|
||||||
|
|
||||||
if [ ! -f "$TAR" ]; then
|
if [ ! -f "$TAR" ]; then
|
||||||
echo "https://static.realm.io/downloads/$SERVER_DIR/$DOWNLOAD_FILE"
|
echo "https://static.realm.io/downloads/$SERVER_DIR/$DOWNLOAD_FILE"
|
||||||
curl -f -L -s "https://static.realm.io/downloads/$SERVER_DIR/$DOWNLOAD_FILE" -o "$TMP_TAR" ||
|
curl -f -L -s "https://static.realm.io/downloads/$SERVER_DIR/$DOWNLOAD_FILE" -o "$TMP_TAR" ||
|
||||||
die "Downloading $DIR failed. Please try again once you have an Internet connection."
|
die "Downloading $DIR failed. Please try again once you have an Internet connection."
|
||||||
mv "$TMP_TAR" "$TAR"
|
mv "$TMP_TAR" "$TAR"
|
||||||
@ -67,8 +69,8 @@ download_core() {
|
|||||||
(
|
(
|
||||||
cd "$TMP_DIR"
|
cd "$TMP_DIR"
|
||||||
rm -rf "$DIR"
|
rm -rf "$DIR"
|
||||||
tar -xzf "$TAR"
|
eval "$UNTAR" "$TAR"
|
||||||
mv core "$DIR-$VERSION"
|
mv "$UNTARRED_DIR" "$DIR-$VERSION"
|
||||||
)
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
@ -84,7 +86,7 @@ check_release_notes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -e "vendor/$CORE_DIR" ]; then
|
if [ ! -e "vendor/$CORE_DIR" ]; then
|
||||||
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core
|
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
|
||||||
elif [ -d "vendor/$CORE_DIR" -a -d ../realm-core -a ! -L "vendor/$CORE_DIR" ]; then
|
elif [ -d "vendor/$CORE_DIR" -a -d ../realm-core -a ! -L "vendor/$CORE_DIR" ]; then
|
||||||
# Allow newer versions than expected for local builds as testing
|
# Allow newer versions than expected for local builds as testing
|
||||||
# with unreleased versions is one of the reasons to use a local build
|
# with unreleased versions is one of the reasons to use a local build
|
||||||
@ -96,19 +98,19 @@ elif [ -d "vendor/$CORE_DIR" -a -d ../realm-core -a ! -L "vendor/$CORE_DIR" ]; t
|
|||||||
elif [ ! -L "vendor/$CORE_DIR" ]; then
|
elif [ ! -L "vendor/$CORE_DIR" ]; then
|
||||||
echo "vendor/$CORE_DIR is not a symlink. Deleting..."
|
echo "vendor/$CORE_DIR is not a symlink. Deleting..."
|
||||||
rm -rf "vendor/$CORE_DIR"
|
rm -rf "vendor/$CORE_DIR"
|
||||||
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core
|
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
|
||||||
# With a prebuilt version we only want to check the first non-empty
|
# With a prebuilt version we only want to check the first non-empty
|
||||||
# line so that checking out an older commit will download the
|
# line so that checking out an older commit will download the
|
||||||
# appropriate version of core if the already-present version is too new
|
# appropriate version of core if the already-present version is too new
|
||||||
elif ! grep -m 1 . "vendor/$CORE_DIR/CHANGELOG.txt" | check_release_notes; then
|
elif ! grep -m 1 . "vendor/$CORE_DIR/CHANGELOG.txt" | check_release_notes; then
|
||||||
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core
|
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
|
||||||
else
|
else
|
||||||
echo "The core library seems to be up to date."
|
echo "The core library seems to be up to date."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -e "vendor/$SYNC_DIR" ]; then
|
if [ ! -e "vendor/$SYNC_DIR" ]; then
|
||||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync
|
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "unzip" realm-sync-node-cocoa-$REALM_SYNC_VERSION
|
||||||
elif [ -d "vendor/$SYNC_DIR" -a -d ../realm-sync -a ! -L "vendor/$SYNC_DIR" ]; then
|
elif [ -d "vendor/$SYNC_DIR" -a -d ../realm-sync -a ! -L "vendor/$SYNC_DIR" ]; then
|
||||||
# Allow newer versions than expected for local builds as testing
|
# Allow newer versions than expected for local builds as testing
|
||||||
# with unreleased versions is one of the reasons to use a local build
|
# with unreleased versions is one of the reasons to use a local build
|
||||||
@ -120,12 +122,12 @@ elif [ -d "vendor/$SYNC_DIR" -a -d ../realm-sync -a ! -L "vendor/$SYNC_DIR" ]; t
|
|||||||
elif [ ! -L "vendor/$SYNC_DIR" ]; then
|
elif [ ! -L "vendor/$SYNC_DIR" ]; then
|
||||||
echo "vendor/$SYNC_DIR is not a symlink. Deleting..."
|
echo "vendor/$SYNC_DIR is not a symlink. Deleting..."
|
||||||
rm -rf "vendor/$SYNC_DIR"
|
rm -rf "vendor/$SYNC_DIR"
|
||||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync
|
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "unzip" realm-sync-node-cocoa-$REALM_SYNC_VERSION
|
||||||
# With a prebuilt version we only want to check the first non-empty
|
# With a prebuilt version we only want to check the first non-empty
|
||||||
# line so that checking out an older commit will download the
|
# line so that checking out an older commit will download the
|
||||||
# appropriate version of core if the already-present version is too new
|
# appropriate version of core if the already-present version is too new
|
||||||
elif ! grep -m 1 . "vendor/$SYNC_DIR/version.txt" | check_release_notes; then
|
elif ! grep -m 1 . "vendor/$SYNC_DIR/version.txt" | check_release_notes; then
|
||||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync
|
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "unzip" realm-sync-node-cocoa-$REALM_SYNC_VERSION
|
||||||
else
|
else
|
||||||
echo "The sync library seems to be up to date."
|
echo "The sync library seems to be up to date."
|
||||||
fi
|
fi
|
||||||
|
@ -217,7 +217,7 @@ case "$TARGET" in
|
|||||||
touch "tests/sync-bundle/object-server/do_not_open_browser"
|
touch "tests/sync-bundle/object-server/do_not_open_browser"
|
||||||
;;
|
;;
|
||||||
"object-server-integration")
|
"object-server-integration")
|
||||||
echo -e "yes\n" | ./tests/sync-bundle/reset-server-realms.command
|
echo -e "yes\n" | ./tests/sync-bundle/reset-server-realms.command
|
||||||
|
|
||||||
pushd "$SRCROOT/tests"
|
pushd "$SRCROOT/tests"
|
||||||
npm install
|
npm install
|
||||||
|
@ -178,17 +178,17 @@ public:
|
|||||||
static void set_default_path(ContextType, ObjectType, ValueType value);
|
static void set_default_path(ContextType, ObjectType, ValueType value);
|
||||||
|
|
||||||
std::string const name = "Realm";
|
std::string const name = "Realm";
|
||||||
|
|
||||||
MethodMap<T> const static_methods = {
|
MethodMap<T> const static_methods = {
|
||||||
{"schemaVersion", wrap<schema_version>},
|
{"schemaVersion", wrap<schema_version>},
|
||||||
{"clearTestState", wrap<clear_test_state>},
|
{"clearTestState", wrap<clear_test_state>},
|
||||||
{"copyBundledRealmFiles", wrap<copy_bundled_realm_files>},
|
{"copyBundledRealmFiles", wrap<copy_bundled_realm_files>},
|
||||||
};
|
};
|
||||||
|
|
||||||
PropertyMap<T> const static_properties = {
|
PropertyMap<T> const static_properties = {
|
||||||
{"defaultPath", {wrap<get_default_path>, wrap<set_default_path>}},
|
{"defaultPath", {wrap<get_default_path>, wrap<set_default_path>}},
|
||||||
};
|
};
|
||||||
|
|
||||||
MethodMap<T> const methods = {
|
MethodMap<T> const methods = {
|
||||||
{"objects", wrap<objects>},
|
{"objects", wrap<objects>},
|
||||||
{"objectForPrimaryKey", wrap<object_for_primary_key>},
|
{"objectForPrimaryKey", wrap<object_for_primary_key>},
|
||||||
@ -201,14 +201,14 @@ public:
|
|||||||
{"removeAllListeners", wrap<remove_all_listeners>},
|
{"removeAllListeners", wrap<remove_all_listeners>},
|
||||||
{"close", wrap<close>},
|
{"close", wrap<close>},
|
||||||
};
|
};
|
||||||
|
|
||||||
PropertyMap<T> const properties = {
|
PropertyMap<T> const properties = {
|
||||||
{"path", {wrap<get_path>, nullptr}},
|
{"path", {wrap<get_path>, nullptr}},
|
||||||
{"schemaVersion", {wrap<get_schema_version>, nullptr}},
|
{"schemaVersion", {wrap<get_schema_version>, nullptr}},
|
||||||
{"schema", {wrap<get_schema>, nullptr}},
|
{"schema", {wrap<get_schema>, nullptr}},
|
||||||
{"readOnly", {wrap<get_read_only>, nullptr}},
|
{"readOnly", {wrap<get_read_only>, nullptr}},
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string validated_notification_name(ContextType ctx, const ValueType &value) {
|
static std::string validated_notification_name(ContextType ctx, const ValueType &value) {
|
||||||
std::string name = Value::validated_to_string(ctx, value, "notification name");
|
std::string name = Value::validated_to_string(ctx, value, "notification name");
|
||||||
@ -217,13 +217,13 @@ public:
|
|||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ObjectSchema& validated_object_schema_for_value(ContextType ctx, const SharedRealm &realm, const ValueType &value) {
|
static const ObjectSchema& validated_object_schema_for_value(ContextType ctx, const SharedRealm &realm, const ValueType &value) {
|
||||||
std::string object_type;
|
std::string object_type;
|
||||||
|
|
||||||
if (Value::is_constructor(ctx, value)) {
|
if (Value::is_constructor(ctx, value)) {
|
||||||
FunctionType constructor = Value::to_constructor(ctx, value);
|
FunctionType constructor = Value::to_constructor(ctx, value);
|
||||||
|
|
||||||
auto delegate = get_delegate<T>(realm.get());
|
auto delegate = get_delegate<T>(realm.get());
|
||||||
for (auto &pair : delegate->m_constructors) {
|
for (auto &pair : delegate->m_constructors) {
|
||||||
if (FunctionType(pair.second) == constructor) {
|
if (FunctionType(pair.second) == constructor) {
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
}
|
}
|
||||||
return *object_schema;
|
return *object_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string normalize_path(std::string path) {
|
static std::string normalize_path(std::string path) {
|
||||||
if (path.size() && path[0] != '/' && path[0] != '.') {
|
if (path.size() && path[0] != '/' && path[0] != '.') {
|
||||||
return default_realm_file_directory() + "/" + path;
|
return default_realm_file_directory() + "/" + path;
|
||||||
@ -282,7 +282,7 @@ inline typename T::Function RealmClass<T>::create_constructor(ContextType ctx) {
|
|||||||
s_constructor = Protected<FunctionType>(ctx, realm_constructor);
|
s_constructor = Protected<FunctionType>(ctx, realm_constructor);
|
||||||
return realm_constructor;
|
return realm_constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void convert_outdated_datetime_columns(const SharedRealm &realm) {
|
static inline void convert_outdated_datetime_columns(const SharedRealm &realm) {
|
||||||
realm::util::Optional<int> old_file_format_version = realm->file_format_upgraded_from_version();
|
realm::util::Optional<int> old_file_format_version = realm->file_format_upgraded_from_version();
|
||||||
if (old_file_format_version && old_file_format_version < 5) {
|
if (old_file_format_version && old_file_format_version < 5) {
|
||||||
@ -294,7 +294,7 @@ static inline void convert_outdated_datetime_columns(const SharedRealm &realm) {
|
|||||||
if (!realm->is_in_transaction()) {
|
if (!realm->is_in_transaction()) {
|
||||||
realm->begin_transaction();
|
realm->begin_transaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t row_index = 0; row_index < table->size(); row_index++) {
|
for (size_t row_index = 0; row_index < table->size(); row_index++) {
|
||||||
if (table->is_null(property.table_column, row_index)) {
|
if (table->is_null(property.table_column, row_index)) {
|
||||||
continue;
|
continue;
|
||||||
@ -337,7 +337,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
else {
|
else {
|
||||||
config.path = js::default_path();
|
config.path = js::default_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const String read_only_string = "readOnly";
|
static const String read_only_string = "readOnly";
|
||||||
ValueType read_only_value = Object::get_property(ctx, object, read_only_string);
|
ValueType read_only_value = Object::get_property(ctx, object, read_only_string);
|
||||||
if (!Value::is_undefined(ctx, read_only_value) && Value::validated_to_boolean(ctx, read_only_value, "readOnly")) {
|
if (!Value::is_undefined(ctx, read_only_value) && Value::validated_to_boolean(ctx, read_only_value, "readOnly")) {
|
||||||
@ -372,7 +372,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
create_object<T, RealmClass<T>>(ctx, old_realm_ptr),
|
create_object<T, RealmClass<T>>(ctx, old_realm_ptr),
|
||||||
create_object<T, RealmClass<T>>(ctx, realm_ptr)
|
create_object<T, RealmClass<T>>(ctx, realm_ptr)
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Function<T>::call(ctx, migration_function, 2, arguments);
|
Function<T>::call(ctx, migration_function, 2, arguments);
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
realm_ptr->reset();
|
realm_ptr->reset();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
old_realm->close();
|
old_realm->close();
|
||||||
old_realm_ptr->reset();
|
old_realm_ptr->reset();
|
||||||
realm_ptr->reset();
|
realm_ptr->reset();
|
||||||
@ -403,7 +403,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
else {
|
else {
|
||||||
throw std::runtime_error("Invalid arguments when constructing 'Realm'");
|
throw std::runtime_error("Invalid arguments when constructing 'Realm'");
|
||||||
}
|
}
|
||||||
|
|
||||||
config.path = normalize_path(config.path);
|
config.path = normalize_path(config.path);
|
||||||
ensure_directory_exists_for_file(config.path);
|
ensure_directory_exists_for_file(config.path);
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
js_binding_context->m_defaults = std::move(defaults);
|
js_binding_context->m_defaults = std::move(defaults);
|
||||||
js_binding_context->m_constructors = std::move(constructors);
|
js_binding_context->m_constructors = std::move(constructors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for datetime -> timestamp conversion
|
// Fix for datetime -> timestamp conversion
|
||||||
convert_outdated_datetime_columns(realm);
|
convert_outdated_datetime_columns(realm);
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||||
validate_argument_count(argc, 1, 2);
|
validate_argument_count(argc, 1, 2);
|
||||||
|
|
||||||
realm::Realm::Config config;
|
realm::Realm::Config config;
|
||||||
config.path = normalize_path(Value::validated_to_string(ctx, arguments[0]));
|
config.path = normalize_path(Value::validated_to_string(ctx, arguments[0]));
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
@ -443,7 +443,7 @@ void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size
|
|||||||
std::string encryptionKey = NativeAccessor::to_binary(ctx, encryptionKeyValue);
|
std::string encryptionKey = NativeAccessor::to_binary(ctx, encryptionKeyValue);
|
||||||
config.encryption_key = std::vector<char>(encryptionKey.begin(), encryptionKey.end());
|
config.encryption_key = std::vector<char>(encryptionKey.begin(), encryptionKey.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto version = realm::Realm::get_schema_version(config);
|
auto version = realm::Realm::get_schema_version(config);
|
||||||
if (version == ObjectStore::NotVersioned) {
|
if (version == ObjectStore::NotVersioned) {
|
||||||
return_value.set(-1);
|
return_value.set(-1);
|
||||||
@ -453,12 +453,15 @@ void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RealmClass<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
void RealmClass<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||||
validate_argument_count(argc, 0);
|
validate_argument_count(argc, 0);
|
||||||
|
#if REALM_ENABLE_SYNC
|
||||||
for(auto &user : SyncManager::shared().all_users()) {
|
for(auto &user : SyncManager::shared().all_users()) {
|
||||||
user->log_out();
|
user->log_out();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
delete_all_realms();
|
delete_all_realms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
{
|
{
|
||||||
"variables": {
|
"variables": {
|
||||||
"use_realm_debug": "<!(echo $REALMJS_USE_DEBUG_CORE)",
|
"use_realm_debug": "<!(echo $REALMJS_USE_DEBUG_CORE)"
|
||||||
"realm_enable_sync%": "0"
|
|
||||||
},
|
},
|
||||||
|
"conditions": [
|
||||||
|
["OS=='mac'", {
|
||||||
|
"variables": {
|
||||||
|
"realm_enable_sync%": "1"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"variables": {
|
||||||
|
"realm_enable_sync%": "0"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
],
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"target_name": "realm-core",
|
"target_name": "realm-core",
|
||||||
@ -18,7 +28,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"all_dependent_settings": {
|
"all_dependent_settings": {
|
||||||
"defines": [ "REALM_HAVE_CONFIG", "REALM_PLATFORM_NODE=1", "REALM_ENABLE_SYNC=1" ]
|
"defines": [ "REALM_HAVE_CONFIG", "REALM_PLATFORM_NODE=1", "REALM_ENABLE_SYNC=<(realm_enable_sync)" ]
|
||||||
},
|
},
|
||||||
"variables": {
|
"variables": {
|
||||||
"prefix": "<!(echo $REALM_CORE_PREFIX)"
|
"prefix": "<!(echo $REALM_CORE_PREFIX)"
|
||||||
@ -72,28 +82,29 @@
|
|||||||
},
|
},
|
||||||
"target_name": "vendored-realm",
|
"target_name": "vendored-realm",
|
||||||
"type": "none",
|
"type": "none",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"action_name": "download-realm",
|
||||||
|
"inputs": [ ],
|
||||||
|
"outputs": [ "<(module_root_dir)/vendor/core-node" ],
|
||||||
|
"action": [ "<(module_root_dir)/scripts/download-core.sh", "node" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
"conditions": [
|
"conditions": [
|
||||||
["realm_enable_sync", {
|
["realm_enable_sync", {
|
||||||
"all_dependent_settings": {
|
"all_dependent_settings": {
|
||||||
"include_dirs": [ "<(module_root_dir)/vendor/realm-sync/include" ],
|
"include_dirs": [ "<(module_root_dir)/vendor/sync/include" ],
|
||||||
"library_dirs": [ "<(module_root_dir)/vendor/realm-sync/osx" ]
|
"library_dirs": [ "<(module_root_dir)/vendor/sync/osx" ]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"all_dependent_settings": {
|
"all_dependent_settings": {
|
||||||
"include_dirs": [ "<(module_root_dir)/vendor/core-node/include" ],
|
"include_dirs": [ "<(module_root_dir)/vendor/core-node/include" ],
|
||||||
"library_dirs": [ "<(module_root_dir)/vendor/core-node" ]
|
"library_dirs": [ "<(module_root_dir)/vendor/core-node" ]
|
||||||
},
|
},
|
||||||
"actions": [
|
|
||||||
{
|
|
||||||
"action_name": "download-realm",
|
|
||||||
"inputs": [ ],
|
|
||||||
"outputs": [ "<(module_root_dir)/vendor/core-node" ],
|
|
||||||
"action": [ "<(module_root_dir)/scripts/download-core.sh", "node" ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user