diff --git a/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj b/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj index 6a81162c..f9a01878 100644 --- a/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj +++ b/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj @@ -63,6 +63,20 @@ remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; remoteInfo = RCTVibration; }; + 02002CEC1C20FB4200265A80 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F63FF2F01C16405C00B3B8E0; + remoteInfo = GCDWebServers; + }; + 02002CEE1C20FB4200265A80 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F63FF2B11C1241E500B3B8E0; + remoteInfo = "RealmJS static"; + }; 0270BCAE1B7D04D700010E03 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */; @@ -239,6 +253,8 @@ 0270BC9F1B7D04D700010E03 /* Products */ = { isa = PBXGroup; children = ( + 02002CED1C20FB4200265A80 /* libGCDWebServers.a */, + 02002CEF1C20FB4200265A80 /* libRealmJS.a */, 0270BCAF1B7D04D700010E03 /* RealmJS.framework */, 0270BCB11B7D04D700010E03 /* RealmJSTests.xctest */, 0270BCB31B7D04D700010E03 /* RealmReact.framework */, @@ -504,6 +520,20 @@ remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 02002CED1C20FB4200265A80 /* libGCDWebServers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libGCDWebServers.a; + remoteRef = 02002CEC1C20FB4200265A80 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 02002CEF1C20FB4200265A80 /* libRealmJS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRealmJS.a; + remoteRef = 02002CEE1C20FB4200265A80 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 0270BCAF1B7D04D700010E03 /* RealmJS.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -594,7 +624,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "rm -rf ./node_modules/realm\n[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\"\nnpm install realm"; + shellScript = "rm -rf ./node_modules/realm\n[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\"\nsh ../../scripts/npm_install_react_native.sh\nnpm install realm"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/examples/ReactExample/package.json b/examples/ReactExample/package.json index 100f87b4..3f1ec8be 100644 --- a/examples/ReactExample/package.json +++ b/examples/ReactExample/package.json @@ -6,7 +6,7 @@ "start": "react-native start" }, "dependencies": { - "react-native": "^0.16.0", + "react-native": "0.16.0", "realm": "file:../../lib" } } diff --git a/scripts/npm_install_react_native.sh b/scripts/npm_install_react_native.sh new file mode 100644 index 00000000..7ebad331 --- /dev/null +++ b/scripts/npm_install_react_native.sh @@ -0,0 +1,21 @@ +set -o pipefail + +DIRECTORY=${1:-"."} + +if [ ! -f "${DIRECTORY}/package.json" ]; then + echo "No package.json in ${DIRECTORY}" + exit 1 +fi +VERSION=`cat ${DIRECTORY}/package.json | awk '/"react-native": "(.+)",/ { print substr($2, 2, length($2)-3) }'` + +if [ -f "${DIRECTORY}/node_modules/react-native/package.json" ]; then + CURRENT_VERSION=`cat ${DIRECTORY}/node_modules/react-native/package.json | awk '/"version": "(.+)",/ { print substr($2, 2, length($2)-3) }'` +fi + +pushd $DIRECTORY +if [ "$VERSION" != "$CURRENT_VERSION" ]; then + echo "Upgrading react-native to version $VERSION" + npm install react-native +fi +popd + diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 00000000..57376671 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,34 @@ +set -o pipefail +set -e + +while pgrep -q Simulator; do + # Kill all the current simulator processes as they may be from a + # different Xcode version + pkill Simulator 2>/dev/null || true + # CoreSimulatorService doesn't exit when sent SIGTERM + pkill -9 Simulator 2>/dev/null || true + done + +DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')" +TARGET=$1 +CONFIGURATION=${2:-"Debug"} + +if [ "$TARGET" = "realmjs" ]; then + xcodebuild -scheme RealmJS -configuration "$CONFIGURATION" -sdk iphonesimulator $DESTINATION build test +elif [ "$TARGET" = "react-tests" ]; then + pushd tests/react-test-app + #unzip ../../target=node_modules/react_tests_node_modules.zip + react-native start & + popd + + xcodebuild -scheme RealmReact -configuration "$CONFIGURATION" -sdk iphonesimulator $DESTINATION build test +elif [ "$TARGET" = "react-example" ]; then + pushd examples/ReactExample + #unzip ../../target=node_modules/react_example_node_modules.zip + react-native start & + xcodebuild -scheme ReactExample -configuration "$CONFIGURATION" -sdk iphonesimulator build $DESTINATION + popd +fi + +pkill node || true + diff --git a/tests/react-test-app/ios/ReactTests.xcodeproj/project.pbxproj b/tests/react-test-app/ios/ReactTests.xcodeproj/project.pbxproj index 92a183aa..688f32cf 100644 --- a/tests/react-test-app/ios/ReactTests.xcodeproj/project.pbxproj +++ b/tests/react-test-app/ios/ReactTests.xcodeproj/project.pbxproj @@ -71,6 +71,20 @@ remoteGlobalIDString = 13B07F861A680F5B00A75B9A; remoteInfo = ReactTests; }; + 02002CCE1C20F20B00265A80 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F63FF2F01C16405C00B3B8E0; + remoteInfo = GCDWebServers; + }; + 02002CD01C20F20B00265A80 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F63FF2B11C1241E500B3B8E0; + remoteInfo = "RealmJS static"; + }; 027799161BBF3BB700C96559 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */; @@ -241,6 +255,8 @@ 027799071BBF3BB700C96559 /* Products */ = { isa = PBXGroup; children = ( + 02002CCF1C20F20B00265A80 /* libGCDWebServers.a */, + 02002CD11C20F20B00265A80 /* libRealmJS.a */, 027799171BBF3BB700C96559 /* RealmJS.framework */, 027799191BBF3BB700C96559 /* RealmJSTests.xctest */, 0277991B1BBF3BB700C96559 /* RealmReact.framework */, @@ -497,6 +513,20 @@ remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 02002CCF1C20F20B00265A80 /* libGCDWebServers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libGCDWebServers.a; + remoteRef = 02002CCE1C20F20B00265A80 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 02002CD11C20F20B00265A80 /* libRealmJS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRealmJS.a; + remoteRef = 02002CD01C20F20B00265A80 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 027799171BBF3BB700C96559 /* RealmJS.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -587,7 +617,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "rm -rf ../node_modules/realm ../node_modules/realm-tests\n[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\"\nnpm install realm realm-tests\ncp ../../../src/object-store/parser/queryTests.json ../node_modules/realm-tests\n"; + shellScript = "[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\"\nsh ../../../scripts/npm_install_react_native.sh ..\n \nrm -rf ../node_modules/realm ../node_modules/realm-tests\nnpm install realm realm-tests\ncp ../../../src/object-store/parser/queryTests.json ../node_modules/realm-tests\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/tests/react-test-app/package.json b/tests/react-test-app/package.json index de9946b8..1170ce85 100644 --- a/tests/react-test-app/package.json +++ b/tests/react-test-app/package.json @@ -6,7 +6,7 @@ "start": "react-native start" }, "dependencies": { - "react-native": "^0.16.0", + "react-native": "0.16.0", "realm": "file:../../lib", "realm-tests": "file:../lib" }