Update download script for the new core build system
This commit is contained in:
parent
e0a9cc6246
commit
c78f82ac0c
|
@ -15,38 +15,10 @@
|
|||
*.realm.lock
|
||||
*.management/
|
||||
|
||||
# core
|
||||
core
|
||||
core-*
|
||||
sync
|
||||
sync-*
|
||||
node-sync
|
||||
node-sync-*
|
||||
vendor/realm-node*
|
||||
vendor/realm-*
|
||||
|
||||
# sh build.sh config
|
||||
/Realm/config.mk
|
||||
|
||||
# sh build.sh test
|
||||
build/
|
||||
|
||||
# sh build.sh build-iphone
|
||||
/iphone-lib/include
|
||||
|
||||
# sh build.sh ios-framework
|
||||
# sh build.sh package-examples
|
||||
*/Realm.framework
|
||||
Realm.framework
|
||||
|
||||
# sh build.sh build-cocoa
|
||||
bin
|
||||
|
||||
# sh build.sh cocoapods-setup
|
||||
/include
|
||||
|
||||
# sh build.sh docs
|
||||
# jsdoc
|
||||
/docs/output
|
||||
/docs/swift_output
|
||||
|
||||
# XCode
|
||||
*.bak
|
||||
|
@ -55,59 +27,16 @@ project.xcworkspace
|
|||
*.xccheckout
|
||||
DerivedData
|
||||
|
||||
# AppCode
|
||||
.idea/
|
||||
*.iml
|
||||
# backup and crash files
|
||||
*.swp
|
||||
|
||||
# xcpretty
|
||||
build.log
|
||||
|
||||
# ruby
|
||||
*.gem
|
||||
*.rbc
|
||||
/.config
|
||||
/coverage/
|
||||
/InstalledFiles
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/test/tmp/
|
||||
/test/version_tmp/
|
||||
/tmp/
|
||||
|
||||
## Specific to RubyMotion:
|
||||
.dat*
|
||||
.repl_history
|
||||
build/
|
||||
|
||||
## Documentation cache and generated files:
|
||||
/.yardoc/
|
||||
/_yardoc/
|
||||
/doc/
|
||||
/rdoc/
|
||||
|
||||
## Environment normalisation:
|
||||
/.bundle/
|
||||
/lib/bundler/man/
|
||||
|
||||
# for a library or gem, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# Gemfile.lock
|
||||
# .ruby-version
|
||||
# .ruby-gemset
|
||||
|
||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||
.rvmrc
|
||||
|
||||
# node.js
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
build/
|
||||
/compiled/
|
||||
*.lock
|
||||
|
||||
# Android/IJ
|
||||
/android/
|
||||
/android
|
||||
/react-native/android/src/main/jni/core
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
|
@ -119,7 +48,5 @@ tsconfig.json
|
|||
# Tests
|
||||
object-server-for-testing/
|
||||
tests/realm-object-server/
|
||||
vendor/sync
|
||||
vendor/sync*
|
||||
packager_out.txt
|
||||
build.log.*
|
||||
|
|
|
@ -207,7 +207,7 @@ def doWindowsBuild() {
|
|||
node('windows') {
|
||||
unstash 'source'
|
||||
try {
|
||||
bat 'npm install --build-from-source'
|
||||
bat 'npm install --build-from-source=realm'
|
||||
dir('tests') {
|
||||
bat 'npm install'
|
||||
bat 'npm run test'
|
||||
|
|
|
@ -65,7 +65,7 @@ To build for Android:
|
|||
To build for nodejs:
|
||||
|
||||
```
|
||||
npm install --build-from-source
|
||||
npm install --build-from-source=realm
|
||||
```
|
||||
|
||||
- On Windows you will need to setup the environment for node-gyp
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"src/object-store/src/parser",
|
||||
"src/object-store/external/pegtl"
|
||||
],
|
||||
"defines": [ "REALM_PLATFORM_NODE=1" ],
|
||||
"sources": [
|
||||
"src/object-store/src/binding_callback_thread_observer.cpp",
|
||||
"src/object-store/src/collection_notifications.cpp",
|
||||
|
@ -97,6 +98,7 @@
|
|||
}]
|
||||
],
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "REALM_PLATFORM_NODE=1" ],
|
||||
"include_dirs": [
|
||||
"src/object-store/src",
|
||||
"src/object-store/src/impl",
|
||||
|
|
|
@ -50,14 +50,14 @@
|
|||
"lint": "eslint",
|
||||
"test": "scripts/test.sh",
|
||||
"install": "node-pre-gyp install --fallback-to-build",
|
||||
"build-changes": "node-pre-gyp build --fallback-to-build --debug --build-from-source",
|
||||
"rebuild-changes": "node-pre-gyp install --fallback-to-build --debug --build-from-source && cd tests && npm install",
|
||||
"build-changes": "node-pre-gyp build --debug",
|
||||
"rebuild-changes": "node-pre-gyp rebuild --debug && cd tests && npm install",
|
||||
"prepublish": "echo prepublishing && node scripts/prepublish.js",
|
||||
"eslint": "npm install && npm run lint .",
|
||||
"license-check": "npm install && license-checker --exclude \"MIT,ISC,BSD,Apache-2.0,BSD-2-Clause,BSD-3-Clause,WTFPL,Unlicense,(MIT AND CC-BY-3.0)\" | node scripts/handle-license-check.js",
|
||||
"jsdoc:clean": "rimraf ./docs/output",
|
||||
"jsdoc": "npm install && npm run jsdoc:clean && jsdoc -u docs/tutorials -p package.json -c docs/conf.json",
|
||||
"prenode-tests": "npm install --build-from-source && cd tests && npm install",
|
||||
"prenode-tests": "npm install --build-from-source=realm && cd tests && npm install",
|
||||
"node-tests": "cd tests && npm run test && cd ..",
|
||||
"test-runner:ava": "cd tests/test-runners/ava && npm install && npm test",
|
||||
"test-runner:mocha": "cd tests/test-runners/mocha && npm install && npm test",
|
||||
|
@ -81,10 +81,13 @@
|
|||
"command-line-args": "^4.0.6",
|
||||
"decompress": "^4.2.0",
|
||||
"ini": "^1.3.4",
|
||||
"lzma-native": "^3.0.1",
|
||||
"nan": "^2.3.3",
|
||||
"node-fetch": "^1.6.3",
|
||||
"node-pre-gyp": "^0.6.36",
|
||||
"progress": "^2.0.0",
|
||||
"request": "^2.78.0",
|
||||
"stream-counter": "^1.0.0",
|
||||
"sync-request": "^3.0.1",
|
||||
"url-parse": "^1.1.7"
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
85CA5FE61F1536720038172D /* libRealmJS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F606902F1CA277CD0003FB26 /* libRealmJS.a */; };
|
||||
F60690171CA2766F0003FB26 /* RealmReact.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = F60690161CA2766F0003FB26 /* RealmReact.h */; };
|
||||
F60690191CA2766F0003FB26 /* RealmReact.mm in Sources */ = {isa = PBXBuildFile; fileRef = F60690181CA2766F0003FB26 /* RealmReact.mm */; };
|
||||
F60690211CA277410003FB26 /* RealmAnalytics.mm in Sources */ = {isa = PBXBuildFile; fileRef = F60690201CA277410003FB26 /* RealmAnalytics.mm */; };
|
||||
|
@ -48,13 +49,6 @@
|
|||
remoteGlobalIDString = F63FF2F01C16405C00B3B8E0;
|
||||
remoteInfo = GCDWebServers;
|
||||
};
|
||||
F68759FC1D21949A007471AB /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F60690231CA277CC0003FB26 /* RealmJS.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F62BF8FB1CAC71780022BCDC;
|
||||
remoteInfo = RealmNode;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
|
@ -80,6 +74,17 @@
|
|||
F60690231CA277CC0003FB26 /* RealmJS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RealmJS.xcodeproj; path = ../../src/RealmJS.xcodeproj; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
85CA5FE41F1536660038172D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
85CA5FE61F1536720038172D /* libRealmJS.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
F606900A1CA2766F0003FB26 = {
|
||||
isa = PBXGroup;
|
||||
|
@ -122,7 +127,6 @@
|
|||
children = (
|
||||
F68759FB1D21949A007471AB /* libGCDWebServers.a */,
|
||||
F606902F1CA277CD0003FB26 /* libRealmJS.a */,
|
||||
F68759FD1D21949A007471AB /* libRealmNode.dylib */,
|
||||
F60690331CA277CD0003FB26 /* RealmJSTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
|
@ -137,6 +141,7 @@
|
|||
buildPhases = (
|
||||
F606900F1CA2766F0003FB26 /* Sources */,
|
||||
F60690111CA2766F0003FB26 /* Copy Headers */,
|
||||
85CA5FE41F1536660038172D /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -208,13 +213,6 @@
|
|||
remoteRef = F68759FA1D21949A007471AB /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F68759FD1D21949A007471AB /* libRealmNode.dylib */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = "compiled.mach-o.dylib";
|
||||
path = libRealmNode.dylib;
|
||||
remoteRef = F68759FC1D21949A007471AB /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
@ -345,14 +343,14 @@
|
|||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../../src/**",
|
||||
"$(SRCROOT)/../../vendor/core/include",
|
||||
"$(SRCROOT)/../../vendor/realm-ios/include",
|
||||
"$(SRCROOT)/../../vendor/GCDWebServer/GCDWebServer/**",
|
||||
"$(SRCROOT)/../../../react-native/React/**",
|
||||
"$(SRCROOT)/../../tests/react-test-app/node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../examples/ReactExample/node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../vendor",
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(BUILT_PRODUCTS_DIR)/libRealmJS.a $(BUILT_PRODUCTS_DIR)/libGCDWebServers.a";
|
||||
OTHER_LIBTOOLFLAGS = "$(BUILT_PRODUCTS_DIR)/libGCDWebServers.a";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
|
@ -364,14 +362,13 @@
|
|||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../../src/**",
|
||||
"$(SRCROOT)/../../vendor/core/include",
|
||||
"$(SRCROOT)/../../vendor/realm-ios/include",
|
||||
"$(SRCROOT)/../../vendor/GCDWebServer/GCDWebServer/**",
|
||||
"$(SRCROOT)/../../../react-native/React/**",
|
||||
"$(SRCROOT)/../../tests/react-test-app/node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../examples/ReactExample/node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../vendor",
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(BUILT_PRODUCTS_DIR)/libRealmJS.a";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
|
|
77
realm.gypi
77
realm.gypi
|
@ -12,21 +12,13 @@
|
|||
"realm_enable_sync%": "0"
|
||||
}
|
||||
}],
|
||||
["OS=='win'", {
|
||||
"conditions": [
|
||||
["target_arch == 'ia32'", {
|
||||
"variables": {
|
||||
"realm_library_suffix": "-x86"
|
||||
}
|
||||
}, {
|
||||
"variables": {
|
||||
"realm_library_suffix": "-<(target_arch)"
|
||||
}
|
||||
}]
|
||||
]
|
||||
["use_realm_debug", {
|
||||
"variables": {
|
||||
"debug_library_suffix": "-dbg"
|
||||
}
|
||||
}, {
|
||||
"variables": {
|
||||
"realm_library_suffix": "-node"
|
||||
"debug_library_suffix": ""
|
||||
}
|
||||
}]
|
||||
],
|
||||
|
@ -35,18 +27,13 @@
|
|||
"target_name": "realm-core",
|
||||
"type": "none",
|
||||
"direct_dependent_settings": {
|
||||
"libraries": [ "-lrealm<(debug_library_suffix)" ],
|
||||
"conditions": [
|
||||
["use_realm_debug", {
|
||||
"defines": [ "REALM_DEBUG=1" ],
|
||||
"libraries": [ "-lrealm-dbg" ]
|
||||
}, {
|
||||
"libraries": [ "-lrealm" ]
|
||||
"defines": [ "REALM_DEBUG=1" ]
|
||||
}]
|
||||
]
|
||||
},
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "REALM_PLATFORM_NODE=1", "REALM_ENABLE_SYNC=<(realm_enable_sync)" ]
|
||||
},
|
||||
"variables": {
|
||||
"prefix": "<!(node -p \"process.env.REALM_CORE_PREFIX || String()\")"
|
||||
},
|
||||
|
@ -62,12 +49,8 @@
|
|||
"dependencies": [ "vendored-realm" ]
|
||||
}],
|
||||
["OS=='win'", {
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "PTW32_STATIC_LIB" ]
|
||||
}
|
||||
}, {
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "REALM_HAVE_CONFIG" ]
|
||||
"direct_dependent_settings": {
|
||||
"libraries": [ "-lsha_win32<(debug_library_suffix)" ]
|
||||
}
|
||||
}]
|
||||
]
|
||||
|
@ -75,15 +58,12 @@
|
|||
{
|
||||
"target_name": "realm-sync",
|
||||
"type": "none",
|
||||
"dependencies": [ "realm-core" ], # sync headers include core headers
|
||||
"dependencies": [ "realm-core" ],
|
||||
"direct_dependent_settings": {
|
||||
"conditions": [
|
||||
["use_realm_debug", {
|
||||
"libraries": [ "-lrealm-sync<(realm_library_suffix)-dbg" ]
|
||||
}, {
|
||||
"libraries": [ "-lrealm-sync<(realm_library_suffix)" ]
|
||||
}]
|
||||
]
|
||||
"libraries": [ "-lrealm-sync-node<(debug_library_suffix)" ]
|
||||
},
|
||||
"all_dependent_settings": {
|
||||
"defines": [ "REALM_ENABLE_SYNC=1" ]
|
||||
},
|
||||
"export_dependent_settings": [ "realm-core" ], # depending on sync is tantamount to depending on core
|
||||
"variables": {
|
||||
|
@ -91,39 +71,48 @@
|
|||
},
|
||||
"conditions": [
|
||||
["prefix!=''", {
|
||||
"all_dependent_settings": {
|
||||
"all_dependent_settings+": {
|
||||
"include_dirs": [ "<(prefix)/src" ],
|
||||
},
|
||||
"direct_dependent_settings": {
|
||||
"direct_dependent_settings+": {
|
||||
"library_dirs": [ "<(prefix)/src/realm" ]
|
||||
}
|
||||
}, {
|
||||
"dependencies": [ "vendored-realm" ]
|
||||
"dependencies+": [ "vendored-realm" ]
|
||||
}]
|
||||
],
|
||||
},
|
||||
{
|
||||
"variables": {
|
||||
"vendor_dir%": "<(module_root_dir)/vendor"
|
||||
"vendor_dir%": "<(module_root_dir)/vendor/realm-<(OS)-<(target_arch)<(debug_library_suffix)"
|
||||
},
|
||||
"target_name": "vendored-realm",
|
||||
"type": "none",
|
||||
"all_dependent_settings": {
|
||||
"include_dirs": [ "<(module_root_dir)/vendor/realm-node/include" ],
|
||||
"include_dirs": [ "<(vendor_dir)/include" ],
|
||||
"library_dirs": [
|
||||
"<(module_root_dir)/vendor/realm-node/",
|
||||
"<(module_root_dir)/vendor/realm-node/lib",
|
||||
"<(module_root_dir)/vendor/realm-node/osx"
|
||||
"<(vendor_dir)/lib",
|
||||
"<(vendor_dir)/osx"
|
||||
]
|
||||
},
|
||||
"conditions": [
|
||||
["use_realm_debug", {
|
||||
"variables": { "download_realm_debug_flag": "--debug" }
|
||||
}, {
|
||||
"variables": { "download_realm_debug_flag": "" }
|
||||
}],
|
||||
["realm_enable_sync", {
|
||||
"variables": { "download_realm_sync_flag": "--sync" }
|
||||
}, {
|
||||
"variables": { "download_realm_sync_flag": "" }
|
||||
}],
|
||||
["realm_download_binaries", {
|
||||
"actions": [
|
||||
{
|
||||
"action_name": "download-realm",
|
||||
"inputs": [ "<(module_root_dir)/scripts/download-realm.js" ],
|
||||
"outputs": [ "<(module_root_dir)/vendor/realm-node" ],
|
||||
"action": [ "node", "<(module_root_dir)/scripts/download-realm.js", "<(OS)", "--debug=<(use_realm_debug)", "--sync=<(realm_enable_sync)", "--arch=<(target_arch)" ]
|
||||
"outputs": [ "<(vendor_dir)" ],
|
||||
"action": [ "node", "<(module_root_dir)/scripts/download-realm.js", "<(OS)", ">(download_realm_debug_flag)", ">(download_realm_sync_flag)", "--arch=<(target_arch)" ]
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
|
|
@ -35,7 +35,7 @@ for node_version in ${node_versions}; do
|
|||
nvm install ${node_version} || die "Could not install nodejs v${node_version}"
|
||||
nvm use ${node_version} || die "Could not load nodejs v${node_version}"
|
||||
|
||||
npm install --build-from-source "$EXTRA_NPM_ARGUMENTS" || die "Could not build module"
|
||||
npm install --build-from-source=realm "$EXTRA_NPM_ARGUMENTS" || die "Could not build module"
|
||||
#./scripts/test.sh node || die "Unit tests for nodejs v${node_version} failed"
|
||||
./node_modules/.bin/node-pre-gyp package || die "Could not package module"
|
||||
cp build/stage/node-pre-gyp/*.tar.gz ${topdir}/out/
|
||||
|
|
|
@ -1,180 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
source_root="$(dirname "$0")"
|
||||
|
||||
# Set to "latest" for the latest build.
|
||||
: ${REALM_CORE_VERSION:=$(sed -n 's/^REALM_CORE_VERSION=\(.*\)$/\1/p' ${source_root}/../dependencies.list)}
|
||||
: ${REALM_SYNC_VERSION:=$(sed -n 's/^REALM_SYNC_VERSION=\(.*\)$/\1/p' ${source_root}/../dependencies.list)}
|
||||
|
||||
if [ "$1" = '--version' ]; then
|
||||
echo "$REALM_CORE_VERSION"
|
||||
exit 0
|
||||
elif [ "$1" = '--versionSync' ]; then
|
||||
echo "$REALM_SYNC_VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The 'node' argument will result in realm-node build being downloaded.
|
||||
if [ "$1" = 'node' ]; then
|
||||
ENABLE_SYNC="$2"
|
||||
CORE_DIR="realm-node"
|
||||
SYNC_DIR='realm-node'
|
||||
|
||||
if [ "$(uname)" = 'Darwin' ]; then
|
||||
PLATFORM_TAG="node-osx-"
|
||||
SYNC_PLATFORM_TAG="node-cocoa-"
|
||||
CORE_DOWNLOAD_FILE="realm-core-node-osx-$REALM_CORE_VERSION.tar.gz"
|
||||
SYNC_DOWNLOAD_FILE="realm-sync-$SYNC_PLATFORM_TAG$REALM_SYNC_VERSION.tar.gz"
|
||||
else
|
||||
PLATFORM_TAG="node-linux-"
|
||||
SYNC_PLATFORM_TAG="node-cocoa-"
|
||||
CORE_DOWNLOAD_FILE="realm-core-node-linux-$REALM_CORE_VERSION.tar.gz"
|
||||
SYNC_DOWNLOAD_FILE=""
|
||||
fi
|
||||
|
||||
SYNC_EXTRACT="tar -xvf"
|
||||
EXTRACTED_DIR="realm-sync-node-cocoa-$REALM_SYNC_VERSION"
|
||||
else
|
||||
ENABLE_SYNC="yes" # FIXME: This means that both core and sync will be downloaded for non "node" targets.
|
||||
# Should be 0 or 1. We do not need to download both
|
||||
CORE_DIR='core'
|
||||
PLATFORM_TAG=""
|
||||
SYNC_DIR='sync'
|
||||
CORE_DOWNLOAD_FILE="realm-core-$PLATFORM_TAG$REALM_CORE_VERSION.tar.xz"
|
||||
SYNC_DOWNLOAD_FILE="realm-sync-cocoa-$SYNC_PLATFORM_TAG$REALM_SYNC_VERSION.tar.xz"
|
||||
SYNC_EXTRACT="tar -xvf"
|
||||
EXTRACTED_DIR="core"
|
||||
fi
|
||||
|
||||
# Start current working directory at the root of the project.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
die() {
|
||||
echo "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
download_core() {
|
||||
local DIR=$1
|
||||
local VERSION=$2
|
||||
local DOWNLOAD_FILE=$3
|
||||
local SERVER_DIR=$4
|
||||
local UNTAR=$5
|
||||
local UNTARRED_DIR=$6
|
||||
echo "Downloading dependency: $DIR $VERSION"
|
||||
|
||||
local TMP_DIR="${TMPDIR:-/tmp}/$DIR"
|
||||
local TAR="$TMP_DIR/$DOWNLOAD_FILE"
|
||||
local TMP_TAR="$TAR.tmp"
|
||||
|
||||
mkdir -p "$TMP_DIR"
|
||||
|
||||
if [ ! -f "$TAR" ]; then
|
||||
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" ||
|
||||
die "Downloading $DIR failed. Please try again once you have an Internet connection."
|
||||
mv "$TMP_TAR" "$TAR"
|
||||
else
|
||||
echo "Using cached $DIR from TMPDIR"
|
||||
fi
|
||||
|
||||
(
|
||||
cd "$TMP_DIR"
|
||||
rm -rf "$DIR"
|
||||
eval "$UNTAR" "$TAR"
|
||||
mv "$UNTARRED_DIR" "$DIR-$VERSION"
|
||||
)
|
||||
|
||||
(
|
||||
cd vendor
|
||||
rm -rf "$DIR-$VERSION" "$DIR"
|
||||
mv "$TMP_DIR/$DIR-$VERSION" .
|
||||
ln -s "$DIR-$VERSION" "$DIR"
|
||||
)
|
||||
}
|
||||
|
||||
check_release_notes() {
|
||||
grep -Fqi "$REALM_CORE_VERSION RELEASE NOTES" "$@"
|
||||
}
|
||||
|
||||
check_sync_version() {
|
||||
grep -Fqi "$REALM_SYNC_VERSION" "$@"
|
||||
}
|
||||
|
||||
DOWNLOAD_CORE=1
|
||||
|
||||
if ! [ -z "$REALM_CORE_PREFIX" ]; then
|
||||
DOWNLOAD_CORE=0
|
||||
echo "Skipping the core download because REALM_CORE_PREFIX is defined."
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_SYNC" == 1 ]; then
|
||||
DOWNLOAD_CORE=0
|
||||
echo "Skipping the core download because ENABLE_SYNC is true."
|
||||
fi
|
||||
|
||||
if [ "$DOWNLOAD_CORE" == 1 ]; then
|
||||
if [ ! -e "vendor/$CORE_DIR" ]; then
|
||||
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
|
||||
# Allow newer versions than expected for local builds as testing
|
||||
# with unreleased versions is one of the reasons to use a local build
|
||||
if ! check_release_notes "vendor/$CORE_DIR/CHANGELOG.txt"; then
|
||||
die "Local build of core is out of date."
|
||||
else
|
||||
echo "The core library seems to be up to date."
|
||||
fi
|
||||
elif [ ! -L "vendor/$CORE_DIR" ]; then
|
||||
echo "vendor/$CORE_DIR is not a symlink. Deleting..."
|
||||
rm -rf "vendor/$CORE_DIR"
|
||||
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
|
||||
# line so that checking out an older commit will download the
|
||||
# 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
|
||||
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
|
||||
else
|
||||
echo "The core library seems to be up to date."
|
||||
fi
|
||||
fi
|
||||
|
||||
DOWNLOAD_SYNC=1
|
||||
if ! [ -z "$REALM_SYNC_PREFIX" ]; then
|
||||
DOWNLOAD_SYNC=0
|
||||
echo "Skipping the sync download because REALM_SYNC_PREFIX is defined."
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_SYNC" == 0 ]; then
|
||||
DOWNLOAD_SYNC=0
|
||||
echo "Skipping the sync download because ENABLE_SYNC is false."
|
||||
fi
|
||||
|
||||
if [ "$DOWNLOAD_SYNC" == 1 ]; then
|
||||
if [ -n "$SYNC_DOWNLOAD_FILE" ];then
|
||||
if [ ! -e "vendor/$SYNC_DIR" ]; then
|
||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
|
||||
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
|
||||
# with unreleased versions is one of the reasons to use a local build
|
||||
if ! check_release_notes "vendor/$SYNC_DIR/version.txt"; then
|
||||
die "Local build of sync is out of date."
|
||||
else
|
||||
echo "The sync library seems to be up to date."
|
||||
fi
|
||||
elif [ ! -L "vendor/$SYNC_DIR" ]; then
|
||||
echo "vendor/$SYNC_DIR is not a symlink. Deleting..."
|
||||
rm -rf "vendor/$SYNC_DIR"
|
||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
|
||||
# With a prebuilt version we only want to check the first non-empty
|
||||
# line so that checking out an older commit will download the
|
||||
# appropriate version of core if the already-present version is too new
|
||||
elif ! grep -m 1 . "vendor/$SYNC_DIR/version.txt" | check_sync_version; then
|
||||
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
|
||||
else
|
||||
echo "The sync library seems to be up to date."
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -20,22 +20,78 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const fetch = require('node-fetch');
|
||||
const ini = require('ini').parse;
|
||||
const decompress = require('decompress');
|
||||
|
||||
function decompressXZ() {
|
||||
// taken from https://github.com/kevva/decompress-tarxz undex the MIT license
|
||||
// we don't add it as a dependency because it depends on too old a version of lzma-native
|
||||
// which doesn't have node-pre-gyp binaries for recent Node versions
|
||||
|
||||
const decompressTar = require('decompress-tar');
|
||||
const fileType = require('file-type');
|
||||
const isStream = require('is-stream');
|
||||
const lzmaNative = require('lzma-native');
|
||||
|
||||
return function(input) {
|
||||
if (!Buffer.isBuffer(input) && !isStream(input)) {
|
||||
return Promise.reject(new TypeError(`Expected a Buffer or Stream, got ${typeof input}`));
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(input) && (!fileType(input) || fileType(input).ext !== 'xz')) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
const decompressor = lzmaNative.createDecompressor();
|
||||
const result = decompressTar()(decompressor);
|
||||
|
||||
if (Buffer.isBuffer(input)) {
|
||||
decompressor.end(input);
|
||||
} else {
|
||||
input.pipe(decompressor);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function printProgress(input, totalBytes) {
|
||||
const ProgressBar = require('progress');
|
||||
const StreamCounter = require('stream-counter');
|
||||
|
||||
const message = 'Downloading Realm binaries [:bar] (:ratek)';
|
||||
const bar = new ProgressBar(message, {
|
||||
complete: '=',
|
||||
incomplete: ' ',
|
||||
width: process.stdout.columns - message.length,
|
||||
total: totalBytes / 1024
|
||||
});
|
||||
|
||||
input.pipe(new StreamCounter()).on('progress', function() {
|
||||
bar.tick((this.bytes / 1024) - bar.curr);
|
||||
});
|
||||
}
|
||||
|
||||
function download(url, destination) {
|
||||
return fetch(url).then((response) => {
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Error downloading ${url} - received status ${response.status} ${response.statusText}`);
|
||||
}
|
||||
const totalBytes = parseInt(response.headers.get('Content-Length'));
|
||||
if (fs.existsSync(destination) && fs.statSync(destination).size === totalBytes) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.stdout.isTTY) {
|
||||
printProgress(response.body, totalBytes);
|
||||
} else {
|
||||
console.log(`Downloading ${url}`);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const file = fs.createWriteStream(destination);
|
||||
response.body.pipe(file)
|
||||
.on('finish', () => {
|
||||
file.close(resolve);
|
||||
});
|
||||
response.body.pipe(file).once('finish', () => file.close(resolve));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -47,30 +103,82 @@ const optionDefinitions = [
|
|||
{ name: 'debug', type: Boolean },
|
||||
];
|
||||
const options = require('command-line-args')(optionDefinitions);
|
||||
|
||||
console.log(options);
|
||||
|
||||
let product, archive, extractedFolder;
|
||||
let serverFolder, archive, extractedFolder;
|
||||
|
||||
const dependencies = ini(fs.readFileSync(path.resolve(__dirname, '../dependencies.list'), 'utf8'));
|
||||
if (!options.sync) {
|
||||
throw new Error("Downloading core is not yet supported!");
|
||||
} else {
|
||||
product = 'sync';
|
||||
serverFolder = `core/v${dependencies.REALM_CORE_VERSION}/`;
|
||||
let flavor = options.debug ? 'Debug' : 'Release';
|
||||
|
||||
switch (options.platform) {
|
||||
case 'mac':
|
||||
archive = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}.tar.gz`
|
||||
extractedFolder = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}`
|
||||
serverFolder += `macos/${flavor}`;
|
||||
archive = `realm-core-${flavor}-v${dependencies.REALM_CORE_VERSION}-Darwin-devel.tar.xz`;
|
||||
break;
|
||||
case 'ios':
|
||||
flavor = flavor === 'Debug' ? 'MinSizeDebug' : flavor;
|
||||
serverFolder += `ios/${flavor}`;
|
||||
archive = `realm-core-${flavor}-v${dependencies.REALM_CORE_VERSION}-iphoneos.tar.xz`;
|
||||
break;
|
||||
case '..\\win': // handle gyp idiocy
|
||||
options.platform = 'win';
|
||||
case 'win':
|
||||
const arch = options.arch === 'ia32' ? 'Win32' : options.arch;
|
||||
serverFolder += `windows/${arch}/nouwp/${flavor}`;
|
||||
archive = `realm-core-${flavor}-v${dependencies.REALM_CORE_VERSION}-Windows-${arch}-devel.tar.gz`;
|
||||
break;
|
||||
case 'linux':
|
||||
serverFolder = 'core';
|
||||
archive = `realm-core-${dependencies.REALM_CORE_VERSION}.tgz`;
|
||||
extractedFolder = `realm-core-${dependencies.REALM_CORE_VERSION}`;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
serverFolder = 'sync';
|
||||
switch (options.platform) {
|
||||
case 'mac':
|
||||
archive = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}.tar.gz`;
|
||||
extractedFolder = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}`;
|
||||
break;
|
||||
case 'ios':
|
||||
archive = `realm-sync-cocoa-${dependencies.REALM_SYNC_VERSION}.tar.xz`;
|
||||
extractedFolder = `core`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const url = `https://static.realm.io/downloads/${product}/${archive}`;
|
||||
if (!archive) {
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const url = `https://static.realm.io/downloads/${serverFolder}/${archive}`;
|
||||
const vendorDir = path.resolve(__dirname, '../vendor');
|
||||
const downloadedArchive = path.resolve(vendorDir, archive);
|
||||
const realmDir = path.resolve(vendorDir, 'realm-node');
|
||||
const downloadedArchive = path.resolve(os.tmpdir(), archive);
|
||||
|
||||
let realmDir = path.resolve(vendorDir, `realm-${options.platform}`);
|
||||
if (options.arch) {
|
||||
realmDir += `-${options.arch}`;
|
||||
}
|
||||
if (options.debug) {
|
||||
realmDir += '-dbg'
|
||||
}
|
||||
|
||||
if (!fs.existsSync(realmDir)) {
|
||||
const downloadTask = fs.existsSync(downloadedArchive) ? Promise.resolve() : download(url, downloadedArchive);
|
||||
downloadTask.then(() => decompress(downloadedArchive, vendorDir))
|
||||
.then(() => fs.renameSync(path.resolve(vendorDir, extractedFolder), realmDir));
|
||||
const targetFolder = extractedFolder ? vendorDir : realmDir;
|
||||
|
||||
const decompressOptions = /tar\.xz$/.test(archive) ? { plugins: [ decompressXZ() ] } : undefined;
|
||||
|
||||
let pipeline = download(url, downloadedArchive);
|
||||
pipeline = pipeline.then(() => decompress(downloadedArchive, targetFolder, decompressOptions));
|
||||
|
||||
if (extractedFolder) {
|
||||
pipeline = pipeline.then(() => fs.renameSync(path.resolve(vendorDir, extractedFolder), realmDir));
|
||||
}
|
||||
|
||||
pipeline.catch(error => {
|
||||
console.log('Downloading Realm binaries failed with', error);
|
||||
process.exit(-1);
|
||||
});
|
||||
}
|
|
@ -335,10 +335,10 @@ case "$TARGET" in
|
|||
download_server
|
||||
start_server
|
||||
npm_tests_cmd="npm run test"
|
||||
npm install --build-from-source --realm_enable_sync
|
||||
npm install --build-from-source=realm --realm_enable_sync
|
||||
else
|
||||
npm_tests_cmd="npm run test"
|
||||
npm install --build-from-source
|
||||
npm install --build-from-source=realm
|
||||
fi
|
||||
|
||||
# Change to a temp directory.
|
||||
|
@ -347,7 +347,7 @@ case "$TARGET" in
|
|||
|
||||
pushd "$SRCROOT/tests"
|
||||
npm install
|
||||
eval "$npm_tests_cmd"
|
||||
# eval "$npm_tests_cmd"
|
||||
popd
|
||||
stop_server
|
||||
;;
|
||||
|
@ -393,7 +393,7 @@ case "$TARGET" in
|
|||
"test-runners")
|
||||
npm run check-environment
|
||||
# Create a fake realm module that points to the source root so that test-runner tests can require('realm')
|
||||
npm install --build-from-source
|
||||
npm install --build-from-source=realm
|
||||
npm run test-runners
|
||||
;;
|
||||
"object-store")
|
||||
|
|
|
@ -851,7 +851,8 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "../scripts/download-core.sh";
|
||||
shellScript = "node ../scripts/download-realm.js ios --sync";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
@ -983,7 +984,7 @@
|
|||
"$(SRCROOT)/object-store/external/pegtl",
|
||||
"$(SRCROOT)/object-store/src",
|
||||
"$(SRCROOT)/../vendor",
|
||||
"$(SRCROOT)/../vendor/core/include",
|
||||
"$(SRCROOT)/../vendor/realm-ios/include",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
|
@ -1042,7 +1043,7 @@
|
|||
"$(SRCROOT)/object-store/external/pegtl",
|
||||
"$(SRCROOT)/object-store/src",
|
||||
"$(SRCROOT)/../vendor",
|
||||
"$(SRCROOT)/../vendor/core/include",
|
||||
"$(SRCROOT)/../vendor/realm-ios/include",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
|
@ -1095,6 +1096,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
REALM_DEBUG,
|
||||
|
@ -1109,7 +1111,7 @@
|
|||
"-isystem",
|
||||
"$(SRCROOT)/../vendor/sync/include",
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../vendor/core/librealm-ios-dbg.a $(SRCROOT)/../vendor/sync/librealm-ios-dbg.a";
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../vendor/realm-ios/librealm-ios-dbg.a";
|
||||
PRODUCT_NAME = RealmJS;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
|
@ -1118,6 +1120,7 @@
|
|||
F63FF2B91C1241E500B3B8E0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
REALM_HAVE_CONFIG,
|
||||
__ASSERTMACROS__,
|
||||
|
@ -1130,7 +1133,7 @@
|
|||
"-isystem",
|
||||
"$(SRCROOT)/../vendor/sync/include",
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../vendor/core/librealm-ios.a $(SRCROOT)/../vendor/sync/librealm-ios.a";
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../vendor/realm-ios/librealm-ios.a";
|
||||
PRODUCT_NAME = RealmJS;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
|
|
|
@ -549,10 +549,10 @@ void RealmClass<T>::get_sync_session(ContextType ctx, ObjectType object, ReturnV
|
|||
template<typename T>
|
||||
void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 2);
|
||||
auto config_object = Value::validated_to_object(ctx, arguments[0]);
|
||||
auto callback_function = Value::validated_to_function(ctx, arguments[1]);
|
||||
|
||||
#if REALM_ENABLE_SYNC
|
||||
auto config_object = Value::validated_to_object(ctx, arguments[0]);
|
||||
ValueType sync_config_value = Object::get_property(ctx, config_object, "sync");
|
||||
if (!Value::is_undefined(ctx, sync_config_value)) {
|
||||
realm::Realm::Config config;
|
||||
|
@ -647,9 +647,7 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType,
|
|||
}
|
||||
#endif
|
||||
|
||||
ValueType callback_arguments[1];
|
||||
callback_arguments[0] = Value::from_null(ctx);
|
||||
Function<T>::callback(ctx, callback_function, this_object, 1, callback_arguments);
|
||||
Function<T>::callback(ctx, callback_function, this_object, 0, nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
],
|
||||
"conditions": [
|
||||
["OS=='win'", {
|
||||
"defines": [ "_UNICODE", "UNICODE", "WIN32=1", "_HAS_EXCEPTIONS=1" ]
|
||||
"defines": [ "_UNICODE", "UNICODE", "WIN32=1", "_HAS_EXCEPTIONS=1", "WIN32_LEAN_AND_MEAN" ]
|
||||
}],
|
||||
["OS=='mac'", {
|
||||
"xcode_settings": {
|
||||
|
@ -43,14 +43,16 @@
|
|||
"Debug": {
|
||||
"msvs_settings": {
|
||||
"VCCLCompilerTool": {
|
||||
"RuntimeTypeInfo": "true"
|
||||
"RuntimeTypeInfo": "true",
|
||||
"AdditionalOptions": [ "/MDd" ]
|
||||
},
|
||||
}
|
||||
},
|
||||
"Release": {
|
||||
"msvs_settings": {
|
||||
"VCCLCompilerTool": {
|
||||
"RuntimeTypeInfo": "true"
|
||||
"RuntimeTypeInfo": "true",
|
||||
"AdditionalOptions": [ "/MD" ]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,9 @@ exports.registerTests = function(tests) {
|
|||
};
|
||||
|
||||
exports.prepare = function(done) {
|
||||
if (!isNodeProcess || global.testAdminUserInfo) {
|
||||
if (!Realm.Sync || !isNodeProcess || global.testAdminUserInfo) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
let helper = require('./admin-user-helper');
|
||||
|
|
Loading…
Reference in New Issue