mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-10 22:36:01 +00:00
Update to download and use core build for Node
This will need to be updated again with a newer version since 1.1.2 build was created on CI but is not actually on static.realm.io until a new release is made.
This commit is contained in:
parent
12517a0d1e
commit
928ab03ce4
@ -14,8 +14,11 @@ WORKDIR /usr/src/app
|
||||
COPY package.json .
|
||||
RUN npm install
|
||||
|
||||
# Make sure core is downloaded.
|
||||
COPY scripts/download-core.sh scripts/
|
||||
RUN scripts/download-core.sh node
|
||||
|
||||
# Copy only what we need to build.
|
||||
ADD realm-core-linux-0.100.3.tar.gz core/
|
||||
COPY src/ src/
|
||||
|
||||
# Build the Debug version of the module.
|
||||
|
@ -3,7 +3,27 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
: ${REALM_CORE_VERSION:=1.1.0} # set to "current" to always use the current build
|
||||
# Set to "latest" for the latest build.
|
||||
: ${REALM_CORE_VERSION:=1.1.2}
|
||||
|
||||
if [ "$1" = '--version' ]; then
|
||||
echo "$REALM_CORE_VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The 'node' argument will result in realm-node build being downloaded.
|
||||
if [ "$1" = 'node' ]; then
|
||||
CORE_DIR="core-node"
|
||||
|
||||
if [ "$(uname)" = 'Darwin' ]; then
|
||||
CORE_DOWNLOAD_FILE="realm-core-node-osx-$REALM_CORE_VERSION.tar.gz"
|
||||
else
|
||||
CORE_DOWNLOAD_FILE="realm-core-node-linux-$REALM_CORE_VERSION.tar.gz"
|
||||
fi
|
||||
else
|
||||
CORE_DIR='core'
|
||||
CORE_DOWNLOAD_FILE="realm-core-$REALM_CORE_VERSION.tar.bz2"
|
||||
fi
|
||||
|
||||
# Start current working directory at the root of the project.
|
||||
cd "$(dirname "$0")/.."
|
||||
@ -14,63 +34,56 @@ die() {
|
||||
}
|
||||
|
||||
download_core() {
|
||||
echo "Downloading dependency: core $REALM_CORE_VERSION"
|
||||
echo "Downloading dependency: $CORE_DIR $REALM_CORE_VERSION"
|
||||
|
||||
local TMP_DIR="$TMPDIR/core_bin"
|
||||
local CORE_TAR="$TMP_DIR/core-$REALM_CORE_VERSION.tar.bz2"
|
||||
local CORE_TAR="$TMP_DIR/$CORE_DOWNLOAD_FILE"
|
||||
local CORE_TMP_TAR="$CORE_TAR.tmp"
|
||||
|
||||
mkdir -p "$TMP_DIR"
|
||||
|
||||
if [ ! -f "$CORE_TAR" ]; then
|
||||
curl -f -L -s "https://static.realm.io/downloads/core/realm-core-$REALM_CORE_VERSION.tar.bz2" -o "$CORE_TMP_TAR" ||
|
||||
die "Downloading core failed. Please try again once you have an Internet connection."
|
||||
curl -f -L -s "https://static.realm.io/downloads/core/$CORE_DOWNLOAD_FILE" -o "$CORE_TMP_TAR" ||
|
||||
die "Downloading $CORE_DIR failed. Please try again once you have an Internet connection."
|
||||
mv "$CORE_TMP_TAR" "$CORE_TAR"
|
||||
else
|
||||
echo "Using cached core from TMPDIR"
|
||||
echo "Using cached $CORE_DIR from TMPDIR"
|
||||
fi
|
||||
|
||||
(
|
||||
cd "$TMP_DIR"
|
||||
rm -rf core
|
||||
tar xjf "$CORE_TAR"
|
||||
mv core "core-$REALM_CORE_VERSION"
|
||||
rm -rf "$CORE_DIR"
|
||||
tar -xzf "$CORE_TAR"
|
||||
mv core "$CORE_DIR-$REALM_CORE_VERSION"
|
||||
)
|
||||
|
||||
rm -rf "core-$REALM_CORE_VERSION" core
|
||||
mv "$TMP_DIR/core-$REALM_CORE_VERSION" .
|
||||
ln -s "core-$REALM_CORE_VERSION" core
|
||||
rm -rf "$CORE_DIR-$REALM_CORE_VERSION" "$CORE_DIR"
|
||||
mv "$TMP_DIR/$CORE_DIR-$REALM_CORE_VERSION" .
|
||||
ln -s "$CORE_DIR-$REALM_CORE_VERSION" "$CORE_DIR"
|
||||
}
|
||||
|
||||
check_release_notes() {
|
||||
grep -Fqi "$REALM_CORE_VERSION RELEASE NOTES" "$@"
|
||||
}
|
||||
|
||||
if [[ $1 = "--version" ]]; then
|
||||
echo $REALM_CORE_VERSION
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(uname)" != 'Darwin' ]; then
|
||||
echo "Skipped downloading core on a non-Apple platform."
|
||||
elif [ ! -e core ]; then
|
||||
if [ ! -e "$CORE_DIR" ]; then
|
||||
download_core
|
||||
elif [ -d core -a -d ../realm-core -a ! -L core ]; then
|
||||
elif [ -d "$CORE_DIR" -a -d ../realm-core -a ! -L "$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 core/release_notes.txt; then
|
||||
if ! check_release_notes "$CORE_DIR/release_notes.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 core ]; then
|
||||
echo "core is not a symlink. Deleting..."
|
||||
rm -rf core
|
||||
elif [ ! -L "$CORE_DIR" ]; then
|
||||
echo "$CORE_DIR is not a symlink. Deleting..."
|
||||
rm -rf "$CORE_DIR"
|
||||
download_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 . core/release_notes.txt | check_release_notes; then
|
||||
elif ! grep -m 1 . "$CORE_DIR/release_notes.txt" | check_release_notes; then
|
||||
download_core
|
||||
else
|
||||
echo "The core library seems to be up to date."
|
||||
|
@ -158,7 +158,7 @@ case "$TARGET" in
|
||||
;;
|
||||
"node")
|
||||
npm install
|
||||
scripts/download-core.sh
|
||||
scripts/download-core.sh node
|
||||
src/node/build-node.sh $CONFIGURATION
|
||||
|
||||
# Change to a temp directory.
|
||||
|
@ -648,6 +648,7 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F62BF8FF1CAC71780022BCDC /* Build configuration list for PBXNativeTarget "RealmNode" */;
|
||||
buildPhases = (
|
||||
F64A05B71D140311004ACDBE /* Download Core */,
|
||||
F62BF8F71CAC71780022BCDC /* Sources */,
|
||||
F62BF8F81CAC71780022BCDC /* Frameworks */,
|
||||
F63117A41CEA911000ECB2DE /* Build with node-gyp */,
|
||||
@ -794,6 +795,20 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "../scripts/download-core.sh";
|
||||
};
|
||||
F64A05B71D140311004ACDBE /* Download Core */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Download Core";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "../scripts/download-core.sh node";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@ -943,13 +958,10 @@
|
||||
"$(SRCROOT)/../vendor",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LIBRARY_SEARCH_PATHS = ../core;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(OTHER_CFLAGS)",
|
||||
"-isystem",
|
||||
../core/include,
|
||||
"-ftemplate-backtrace-limit=0",
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
@ -1001,12 +1013,9 @@
|
||||
"$(SRCROOT)/../vendor",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LIBRARY_SEARCH_PATHS = ../core;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(OTHER_CFLAGS)",
|
||||
"-isystem",
|
||||
../core/include,
|
||||
"-ftemplate-backtrace-limit=0",
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
@ -1024,9 +1033,9 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(OTHER_CFLAGS)",
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
core/include,
|
||||
../core/include,
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -1040,9 +1049,9 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(OTHER_CFLAGS)",
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
core/include,
|
||||
../core/include,
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -1066,11 +1075,16 @@
|
||||
/usr/local/include/node,
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/usr/local/lib,
|
||||
"../core-node",
|
||||
);
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
"../core-node/include",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lrealm",
|
||||
"-lrealm-node-dbg",
|
||||
"-luv",
|
||||
"-lv8",
|
||||
);
|
||||
@ -1095,11 +1109,16 @@
|
||||
/usr/local/include/node,
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/usr/local/lib,
|
||||
"../core-node",
|
||||
);
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
"../core-node/include",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lrealm",
|
||||
"-lrealm-node",
|
||||
"-luv",
|
||||
"-lv8",
|
||||
);
|
||||
@ -1112,6 +1131,11 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
../core/include,
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../core/librealm-ios-dbg.a";
|
||||
PRODUCT_NAME = RealmJS;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1121,6 +1145,11 @@
|
||||
F63FF2B91C1241E500B3B8E0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"$(inherited)",
|
||||
"-isystem",
|
||||
../core/include,
|
||||
);
|
||||
OTHER_LIBTOOLFLAGS = "$(SRCROOT)/../core/librealm-ios.a";
|
||||
PRODUCT_NAME = RealmJS;
|
||||
SKIP_INSTALL = YES;
|
||||
|
@ -33,11 +33,11 @@
|
||||
"../object-store/src/impl/apple",
|
||||
"../object-store/src/parser",
|
||||
"../object-store/external/pegtl",
|
||||
"../../core/include",
|
||||
"../../core-node/include",
|
||||
"../../node_modules/nan"
|
||||
],
|
||||
"library_dirs": [
|
||||
"$(srcdir)/../../core"
|
||||
"$(srcdir)/../../core-node"
|
||||
],
|
||||
"defines": [
|
||||
"REALM_HAVE_CONFIG",
|
||||
@ -50,7 +50,7 @@
|
||||
"-Wno-missing-field-initializers",
|
||||
"-Wno-return-type"
|
||||
],
|
||||
"libraries": ["-lrealm"],
|
||||
"libraries": ["-lrealm-node"],
|
||||
"xcode_settings": {
|
||||
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
|
||||
"CLANG_CXX_LIBRARY": "libc++",
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <realm.hpp>
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace realm {
|
||||
namespace query_builder {
|
||||
|
Loading…
x
Reference in New Issue
Block a user