Merge branch 'master' of github.com:realm/realm-js into feature/jwt-auth
This commit is contained in:
commit
87dff16520
|
@ -55,3 +55,5 @@ tests/realm-object-server/
|
||||||
packager_out.txt
|
packager_out.txt
|
||||||
build.log.*
|
build.log.*
|
||||||
realm-object-server/
|
realm-object-server/
|
||||||
|
tests/react-test-app/ios/out.txt
|
||||||
|
*.iml
|
||||||
|
|
36
CHANGELOG.md
36
CHANGELOG.md
|
@ -1,19 +1,47 @@
|
||||||
|
|
||||||
X.Y.Z Release notes
|
X.Y.Z Release notes
|
||||||
=============================================================
|
=============================================================
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
* None.
|
* None.
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
* Added property `Realm.isClosed` which indicates if a Realm instance is closed or not.
|
|
||||||
* [Object Server] Added JWT authenfication (#1548).
|
* [Object Server] Added JWT authenfication (#1548).
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
* Fix a bug where `Realm.open` could unexpectedly raise a "Realm at path ... already opened with different schema version" error.
|
||||||
|
|
||||||
|
### Internal
|
||||||
|
* None.
|
||||||
|
|
||||||
|
2.1.1 Release notes (2017-12-15)
|
||||||
|
=============================================================
|
||||||
|
### Breaking changes
|
||||||
|
* None.
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
* None.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
* [Object Server] Fixed a bug where long reconnection happens when a proxy in front of the sync worker returns one of those.
|
||||||
|
|
||||||
|
### Internal
|
||||||
|
* [Object Server] Updated to Realm Object Server v2.2.0 for testing.
|
||||||
|
* Updated to Realm Sync 2.1.10 (see "Bug fixes").
|
||||||
|
|
||||||
|
|
||||||
|
2.1.0 Release notes (2017-12-14)
|
||||||
|
=============================================================
|
||||||
|
### Breaking changes
|
||||||
|
* None.
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
* Added property `Realm.isClosed` which indicates if a Realm instance is closed or not.
|
||||||
|
* Added property `disableFormatUpgrade` to the Realm configuration object which disables automatic file format upgrade when opening a Realm file.
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
* None.
|
* None.
|
||||||
|
|
||||||
### Internal
|
### Internal
|
||||||
* [Object Server] Updated to Realm Object Server v2.2.0 for testing.
|
* Updated to React Native 0.50.4 (test and example apps).
|
||||||
|
|
||||||
|
|
||||||
2.0.13 Release notes (2017-12-8)
|
2.0.13 Release notes (2017-12-8)
|
||||||
=============================================================
|
=============================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
PACKAGE_NAME=realm-js
|
PACKAGE_NAME=realm-js
|
||||||
VERSION=2.0.13
|
VERSION=2.1.1
|
||||||
REALM_CORE_VERSION=4.0.2
|
REALM_CORE_VERSION=4.0.2
|
||||||
REALM_SYNC_VERSION=2.1.8
|
REALM_SYNC_VERSION=2.1.10
|
||||||
REALM_OBJECT_SERVER_VERSION=2.2.0
|
REALM_OBJECT_SERVER_VERSION=2.2.0
|
|
@ -307,6 +307,9 @@ Realm.defaultPath;
|
||||||
* what fits in memory, but it is not persistent and will be removed when the last instance
|
* what fits in memory, but it is not persistent and will be removed when the last instance
|
||||||
* is closed.
|
* is closed.
|
||||||
* @property {boolean} [readOnly=false] - Specifies if this Realm should be opened as read-only.
|
* @property {boolean} [readOnly=false] - Specifies if this Realm should be opened as read-only.
|
||||||
|
* @property {boolean} [disableFormatUpgrade=false] - Specifies if this Realm's file format should
|
||||||
|
* be automatically upgraded if it was created with an older version of the Realm library.
|
||||||
|
* If set to `true` and a file format upgrade is required, an error will be thrown instead.
|
||||||
* @property {Array<Realm~ObjectClass|Realm~ObjectSchema>} [schema] - Specifies all the
|
* @property {Array<Realm~ObjectClass|Realm~ObjectSchema>} [schema] - Specifies all the
|
||||||
* object types in this Realm. **Required** when first creating a Realm at this `path`.
|
* object types in this Realm. **Required** when first creating a Realm at this `path`.
|
||||||
* If omitted, the schema will be read from the existing Realm file.
|
* If omitted, the schema will be read from the existing Realm file.
|
||||||
|
|
|
@ -126,6 +126,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compile project(':react-native-exit-app-no-history')
|
||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile "com.android.support:appcompat-v7:23.0.1"
|
compile "com.android.support:appcompat-v7:23.0.1"
|
||||||
compile "com.facebook.react:react-native:+" // From node_modules
|
compile "com.facebook.react:react-native:+" // From node_modules
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Application;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.facebook.react.ReactApplication;
|
import com.facebook.react.ReactApplication;
|
||||||
|
import com.github.wumke.RNExitApp.RNExitAppPackage;
|
||||||
import com.facebook.react.ReactInstanceManager;
|
import com.facebook.react.ReactInstanceManager;
|
||||||
import com.facebook.react.ReactNativeHost;
|
import com.facebook.react.ReactNativeHost;
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
|
@ -27,6 +28,7 @@ public class MainApplication extends Application implements ReactApplication {
|
||||||
protected List<ReactPackage> getPackages() {
|
protected List<ReactPackage> getPackages() {
|
||||||
return Arrays.<ReactPackage>asList(
|
return Arrays.<ReactPackage>asList(
|
||||||
new MainReactPackage(),
|
new MainReactPackage(),
|
||||||
|
new RNExitAppPackage(),
|
||||||
new RealmReactPackage()
|
new RealmReactPackage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
rootProject.name = 'ReactExample'
|
rootProject.name = 'ReactExample'
|
||||||
|
include ':react-native-exit-app-no-history'
|
||||||
|
project(':react-native-exit-app-no-history').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exit-app-no-history/android')
|
||||||
|
|
||||||
include ':app'
|
include ':app'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright 2017 Realm Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Platform,
|
||||||
|
StatusBar,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
|
||||||
|
import TodoItem from './todo-item';
|
||||||
|
import TodoListView from './todo-listview';
|
||||||
|
import TodoItemsView from './todo-itemsview';
|
||||||
|
import TodoListItem from './todo-list-item';
|
||||||
|
import realm from './realm';
|
||||||
|
import styles from './styles';
|
||||||
|
|
||||||
|
import { StackNavigator } from 'react-navigation';
|
||||||
|
|
||||||
|
export default class ItemsScreen extends React.Component {
|
||||||
|
static navigationOptions = {
|
||||||
|
title: 'Current list',
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
if (Platform.OS == 'ios') {
|
||||||
|
StatusBar.setBarStyle('light-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
let properties = {
|
||||||
|
}
|
||||||
|
|
||||||
|
return <TodoItemsView items={this.props.navigation.state.params.items} {...properties} />;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -19,14 +19,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Navigator,
|
|
||||||
Platform,
|
Platform,
|
||||||
StyleSheet
|
StyleSheet
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
const { NavBarHeight, TotalNavHeight } = Navigator.NavigationBar.Styles.General;
|
|
||||||
const iOS = (Platform.OS == 'ios');
|
const iOS = (Platform.OS == 'ios');
|
||||||
|
|
||||||
|
|
||||||
export default StyleSheet.create({
|
export default StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -43,7 +42,7 @@ export default StyleSheet.create({
|
||||||
navBarView: {
|
navBarView: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
height: NavBarHeight,
|
height: 20,
|
||||||
},
|
},
|
||||||
navBarLeftArrow: {
|
navBarLeftArrow: {
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
|
@ -66,7 +65,7 @@ export default StyleSheet.create({
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
},
|
},
|
||||||
navScene: {
|
navScene: {
|
||||||
top: TotalNavHeight,
|
top: 20,
|
||||||
},
|
},
|
||||||
listItem: {
|
listItem: {
|
||||||
borderColor: '#c8c7cc',
|
borderColor: '#c8c7cc',
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Navigator,
|
|
||||||
Platform,
|
Platform,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
Text,
|
Text,
|
||||||
|
@ -31,10 +30,21 @@ import {
|
||||||
|
|
||||||
import TodoItem from './todo-item';
|
import TodoItem from './todo-item';
|
||||||
import TodoListView from './todo-listview';
|
import TodoListView from './todo-listview';
|
||||||
|
import TodoListItem from './todo-list-item';
|
||||||
|
import ItemsScreen from './items-screen'
|
||||||
import realm from './realm';
|
import realm from './realm';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
|
||||||
export default class TodoApp extends React.Component {
|
import { StackNavigator } from 'react-navigation';
|
||||||
|
import RNExitApp from 'react-native-exit-app-no-history';
|
||||||
|
|
||||||
|
const params = require("./params.json");
|
||||||
|
|
||||||
|
class HomeScreen extends React.Component {
|
||||||
|
static navigationOptions = {
|
||||||
|
title: 'Todo Lists',
|
||||||
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
@ -42,17 +52,20 @@ export default class TodoApp extends React.Component {
|
||||||
this.todoLists = realm.objects('TodoList').sorted('creationDate');
|
this.todoLists = realm.objects('TodoList').sorted('creationDate');
|
||||||
if (this.todoLists.length < 1) {
|
if (this.todoLists.length < 1) {
|
||||||
realm.write(() => {
|
realm.write(() => {
|
||||||
realm.create('TodoList', {name: 'Todo List', creationDate: new Date()});
|
realm.create('TodoList', { name: 'Todo List', creationDate: new Date() });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.todoLists.addListener((name, changes) => {
|
this.todoLists.addListener((name, changes) => {
|
||||||
console.log("changed: " + JSON.stringify(changes));
|
console.log("changed: " + JSON.stringify(changes));
|
||||||
|
if (params) {
|
||||||
|
console.error("params.json indicates a test run. Exiting application");
|
||||||
|
RNExitApp.exitApp();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
console.log("registered listener");
|
console.log("registered listener");
|
||||||
|
|
||||||
|
|
||||||
// Bind all the methods that we will be passing as props.
|
// Bind all the methods that we will be passing as props.
|
||||||
this.renderScene = this.renderScene.bind(this);
|
|
||||||
this._addNewTodoList = this._addNewTodoList.bind(this);
|
this._addNewTodoList = this._addNewTodoList.bind(this);
|
||||||
this._onPressTodoList = this._onPressTodoList.bind(this);
|
this._onPressTodoList = this._onPressTodoList.bind(this);
|
||||||
|
|
||||||
|
@ -73,37 +86,17 @@ export default class TodoApp extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
let objects = realm.objects('Todo');
|
let objects = realm.objects('Todo');
|
||||||
let extraItems = [
|
let extraItems = [
|
||||||
{name: 'Complete', items: objects.filtered('done = true')},
|
{ name: 'Complete', items: objects.filtered('done = true') },
|
||||||
{name: 'Incomplete', items: objects.filtered('done = false')},
|
{ name: 'Incomplete', items: objects.filtered('done = false') },
|
||||||
];
|
];
|
||||||
|
|
||||||
let route = {
|
let properties = {
|
||||||
title: 'My Todo Lists',
|
|
||||||
component: TodoListView,
|
|
||||||
passProps: {
|
|
||||||
ref: 'listView',
|
ref: 'listView',
|
||||||
extraItems: extraItems,
|
extraItems: extraItems,
|
||||||
onPressItem: this._onPressTodoList,
|
onPressItem: this._onPressTodoList,
|
||||||
},
|
}
|
||||||
backButtonTitle: 'Lists',
|
|
||||||
rightButtonTitle: 'Add',
|
|
||||||
onRightButtonPress: this._addNewTodoList,
|
|
||||||
};
|
|
||||||
|
|
||||||
let navigationBar = (
|
return <TodoListView items={this.todoLists} {...properties} />;
|
||||||
<Navigator.NavigationBar routeMapper={RouteMapper} style={styles.navBar} />
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Navigator
|
|
||||||
ref="nav"
|
|
||||||
initialRoute={route}
|
|
||||||
navigationBar={navigationBar}
|
|
||||||
renderScene={this.renderScene}
|
|
||||||
sceneStyle={styles.navScene}
|
|
||||||
style={styles.navigator}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderScene(route) {
|
renderScene(route) {
|
||||||
|
@ -118,7 +111,7 @@ export default class TodoApp extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
realm.write(() => {
|
realm.write(() => {
|
||||||
items.push({text: ''});
|
items.push({ text: '' });
|
||||||
});
|
});
|
||||||
|
|
||||||
this._setEditingRow(items.length - 1);
|
this._setEditingRow(items.length - 1);
|
||||||
|
@ -131,34 +124,17 @@ export default class TodoApp extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
realm.write(() => {
|
realm.write(() => {
|
||||||
realm.create('TodoList', {name: '', creationDate: new Date()});
|
realm.create('TodoList', { name: '', creationDate: new Date() });
|
||||||
});
|
});
|
||||||
|
|
||||||
this._setEditingRow(items.length - 1);
|
this._setEditingRow(items.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPressTodoList(list) {
|
_onPressTodoList(list) {
|
||||||
|
const { navigate } = this.props.navigation;
|
||||||
let items = list.items;
|
let items = list.items;
|
||||||
|
|
||||||
let route = {
|
navigate('ItemsScreen', { items: items })
|
||||||
title: list.name,
|
|
||||||
component: TodoListView,
|
|
||||||
passProps: {
|
|
||||||
ref: 'listItemView',
|
|
||||||
items: items,
|
|
||||||
rowClass: TodoItem,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check if the items are mutable (i.e. List rather than Results).
|
|
||||||
if (items.push) {
|
|
||||||
Object.assign(route, {
|
|
||||||
rightButtonTitle: 'Add',
|
|
||||||
onRightButtonPress: () => this._addNewTodoItem(list),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refs.nav.push(route);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_shouldAddNewItem(items) {
|
_shouldAddNewItem(items) {
|
||||||
|
@ -173,53 +149,14 @@ export default class TodoApp extends React.Component {
|
||||||
let listView = this.currentListView;
|
let listView = this.currentListView;
|
||||||
|
|
||||||
// Update the state on the currently displayed TodoList to edit this new item.
|
// Update the state on the currently displayed TodoList to edit this new item.
|
||||||
listView.setState({editingRow: rowIndex});
|
listView.setState({ editingRow: rowIndex });
|
||||||
listView.updateDataSource();
|
listView.updateDataSource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RouteMapper = {
|
const SimpleApp = StackNavigator({
|
||||||
LeftButton(route, navigator, index, navState) {
|
Home: { screen: HomeScreen },
|
||||||
if (index == 0) {
|
ItemsScreen: { screen: ItemsScreen }
|
||||||
return null;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
let prevRoute = navState.routeStack[index - 1];
|
export default SimpleApp;
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => navigator.pop()}>
|
|
||||||
<View style={[styles.navBarView, styles.navBarLeftButton]}>
|
|
||||||
<Text style={styles.navBarLeftArrow}>‹</Text>
|
|
||||||
<Text style={styles.navBarText}>
|
|
||||||
{prevRoute.backButtonTitle || prevRoute.title || 'Back'}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
RightButton(route) {
|
|
||||||
if (!route.rightButtonTitle) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={route.onRightButtonPress}>
|
|
||||||
<View style={[styles.navBarView, styles.navBarRightButton]}>
|
|
||||||
<Text style={styles.navBarText}>
|
|
||||||
{route.rightButtonTitle}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
Title(route) {
|
|
||||||
return (
|
|
||||||
<View style={styles.navBarView}>
|
|
||||||
<Text style={[styles.navBarText, styles.navBarTitleText]}>
|
|
||||||
{route.title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,165 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright 2016 Realm Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
|
||||||
|
import { ListView } from 'realm/react-native';
|
||||||
|
import TodoItem from './todo-item';
|
||||||
|
import realm from './realm';
|
||||||
|
import styles from './styles';
|
||||||
|
|
||||||
|
export default class TodoItemsView extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
let dataSource = new ListView.DataSource({
|
||||||
|
rowHasChanged(a, b) {
|
||||||
|
// Always re-render TodoList items.
|
||||||
|
return a.done !== b.done || a.text !== b.text || a.items || b.items;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
dataSource: this._cloneDataSource(dataSource, props),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.renderRow = this.renderRow.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(props) {
|
||||||
|
this.updateDataSource(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
let items = this.props.items;
|
||||||
|
let editingRow = this.state.editingRow;
|
||||||
|
|
||||||
|
for (let i = items.length; i--;) {
|
||||||
|
if (i == editingRow) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (this._deleteItemIfEmpty(items[i]) && i < editingRow) {
|
||||||
|
editingRow--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editingRow != this.state.editingRow) {
|
||||||
|
this.setState({editingRow});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<ListView dataSource={this.state.dataSource} renderRow={this.renderRow} enableEmptySections/>
|
||||||
|
<Text style={styles.instructions}>
|
||||||
|
Press Cmd+R to reload,{'\n'}
|
||||||
|
Cmd+D for dev menu
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderRow(item, sectionIndex, rowIndex) {
|
||||||
|
let RowClass;
|
||||||
|
let editing = false;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TodoItem
|
||||||
|
item={item}
|
||||||
|
editing={editing}
|
||||||
|
onPress={() => this._onPressRow(item, sectionIndex, rowIndex)}
|
||||||
|
onPressDelete={() => this._onPressDeleteRow(item)}
|
||||||
|
onEndEditing={() => this._onEndEditingRow(item, rowIndex)} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateDataSource(props=this.props) {
|
||||||
|
this.setState({
|
||||||
|
dataSource: this._cloneDataSource(this.state.dataSource, props),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_cloneDataSource(dataSource, props) {
|
||||||
|
let items = props.items;
|
||||||
|
let extraItems = props.extraItems;
|
||||||
|
let sections = [items ? items.snapshot() : []];
|
||||||
|
|
||||||
|
if (extraItems && extraItems.length) {
|
||||||
|
sections.push(extraItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataSource.cloneWithRowsAndSections(sections);
|
||||||
|
}
|
||||||
|
|
||||||
|
_onPressRow(item, sectionIndex, rowIndex) {
|
||||||
|
let onPressItem = this.props.onPressItem;
|
||||||
|
if (onPressItem) {
|
||||||
|
onPressItem(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no handler was provided, then default to editing the row.
|
||||||
|
if (sectionIndex == 0) {
|
||||||
|
this.setState({editingRow: rowIndex});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_onPressDeleteRow(item) {
|
||||||
|
this._deleteItem(item);
|
||||||
|
this.updateDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
_onEndEditingRow(item, rowIndex) {
|
||||||
|
if (this._deleteItemIfEmpty(item)) {
|
||||||
|
this.updateDataSource();
|
||||||
|
}
|
||||||
|
if (this.state.editingRow == rowIndex) {
|
||||||
|
this.setState({editingRow: null});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_deleteItem(item) {
|
||||||
|
let items = item.items;
|
||||||
|
|
||||||
|
realm.write(() => {
|
||||||
|
// If the item is a TodoList, then delete all of its items.
|
||||||
|
if (items && items.length) {
|
||||||
|
realm.delete(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
realm.delete(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_deleteItemIfEmpty(item) {
|
||||||
|
// The item could be a TodoList or a Todo.
|
||||||
|
if (!item.name && !item.text) {
|
||||||
|
this._deleteItem(item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,8 +42,13 @@ export default class TodoListItem extends React.Component {
|
||||||
|
|
||||||
get done() {
|
get done() {
|
||||||
let items = this.props.item.items;
|
let items = this.props.item.items;
|
||||||
|
if (items) {
|
||||||
return items.length > 0 && items.every((item) => item.done);
|
return items.length > 0 && items.every((item) => item.done);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return this.props.item.done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get text() {
|
get text() {
|
||||||
return this.props.item.name;
|
return this.props.item.name;
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default class TodoListView extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ListView dataSource={this.state.dataSource} renderRow={this.renderRow} />
|
<ListView dataSource={this.state.dataSource} renderRow={this.renderRow} enableEmptySections/>
|
||||||
<Text style={styles.instructions}>
|
<Text style={styles.instructions}>
|
||||||
Press Cmd+R to reload,{'\n'}
|
Press Cmd+R to reload,{'\n'}
|
||||||
Cmd+D for dev menu
|
Cmd+D for dev menu
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
};
|
};
|
||||||
objectVersion = 46;
|
objectVersion = 46;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
||||||
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
|
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
|
||||||
|
@ -28,6 +27,7 @@
|
||||||
8573DE511E23DDA700914396 /* ReactExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8573DE501E23DDA700914396 /* ReactExampleTests.m */; };
|
8573DE511E23DDA700914396 /* ReactExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8573DE501E23DDA700914396 /* ReactExampleTests.m */; };
|
||||||
B06E5AD59A024665BD24C8C7 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C4594A7EF1647D68ADF0ED0 /* libz.tbd */; };
|
B06E5AD59A024665BD24C8C7 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C4594A7EF1647D68ADF0ED0 /* libz.tbd */; };
|
||||||
EF9CDEC26BA64438B1A9F856 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C202449017C94855B351AE73 /* libc++.tbd */; };
|
EF9CDEC26BA64438B1A9F856 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C202449017C94855B351AE73 /* libc++.tbd */; };
|
||||||
|
F5A48833F58A45B2A8E9F550 /* libRNExitApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F25C98ECB41447FB9BA11E19 /* libRNExitApp.a */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
@ -253,6 +253,8 @@
|
||||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
||||||
8573DE501E23DDA700914396 /* ReactExampleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactExampleTests.m; sourceTree = "<group>"; };
|
8573DE501E23DDA700914396 /* ReactExampleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactExampleTests.m; sourceTree = "<group>"; };
|
||||||
C202449017C94855B351AE73 /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
C202449017C94855B351AE73 /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
||||||
|
A07E5AD22EFC47D594326945 /* RNExitApp.xcodeproj */ = {isa = PBXFileReference; name = "RNExitApp.xcodeproj"; path = "../node_modules/react-native-exit-app-no-history/ios/RNExitApp.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
|
||||||
|
F25C98ECB41447FB9BA11E19 /* libRNExitApp.a */ = {isa = PBXFileReference; name = "libRNExitApp.a"; path = "libRNExitApp.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -282,6 +284,7 @@
|
||||||
146834051AC3E58100842450 /* libReact.a in Frameworks */,
|
146834051AC3E58100842450 /* libReact.a in Frameworks */,
|
||||||
70C063557D0D491D8F4D348F /* libRealmReact.a in Frameworks */,
|
70C063557D0D491D8F4D348F /* libRealmReact.a in Frameworks */,
|
||||||
B06E5AD59A024665BD24C8C7 /* libz.tbd in Frameworks */,
|
B06E5AD59A024665BD24C8C7 /* libz.tbd in Frameworks */,
|
||||||
|
F5A48833F58A45B2A8E9F550 /* libRNExitApp.a in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -447,6 +450,7 @@
|
||||||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
||||||
146833FF1AC3E56700842450 /* React.xcodeproj */,
|
146833FF1AC3E56700842450 /* React.xcodeproj */,
|
||||||
73AD103601A44EB291AC2117 /* RealmReact.xcodeproj */,
|
73AD103601A44EB291AC2117 /* RealmReact.xcodeproj */,
|
||||||
|
A07E5AD22EFC47D594326945 /* RNExitApp.xcodeproj */,
|
||||||
);
|
);
|
||||||
name = Libraries;
|
name = Libraries;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -832,7 +836,7 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
|
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
|
@ -891,6 +895,7 @@
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactExample.app/ReactExample";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactExample.app/ReactExample";
|
||||||
|
@ -908,6 +913,7 @@
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactExample.app/ReactExample";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactExample.app/ReactExample";
|
||||||
|
|
|
@ -7,16 +7,18 @@
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "~15.4.0-rc.4",
|
"react": "16.0.0",
|
||||||
"react-native": "0.40.0",
|
"react-native": "0.50.4",
|
||||||
|
"react-navigation": "^1.0.0-beta.21",
|
||||||
|
"react-native-exit-app-no-history": "^1.0.2",
|
||||||
"realm": "file:../.."
|
"realm": "file:../.."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-jest": "18.0.0",
|
"babel-jest": "18.0.0",
|
||||||
"babel-preset-react-native": "1.9.1",
|
"babel-preset-react-native": "4.0.0",
|
||||||
|
"invariant": "^2.2.2",
|
||||||
"jest": "18.1.0",
|
"jest": "18.1.0",
|
||||||
"react-test-renderer": "~15.4.0-rc.4",
|
"react-test-renderer": "^16.2.0"
|
||||||
"invariant": "^2.2.2"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "react-native"
|
"preset": "react-native"
|
||||||
|
|
|
@ -62,14 +62,26 @@ module.exports = function(realmConstructor) {
|
||||||
//Add async open API
|
//Add async open API
|
||||||
Object.defineProperties(realmConstructor, getOwnPropertyDescriptors({
|
Object.defineProperties(realmConstructor, getOwnPropertyDescriptors({
|
||||||
open(config) {
|
open(config) {
|
||||||
|
// For local Realms we open the Realm and return it in a resolved Promise.
|
||||||
|
if (!("sync" in config)) {
|
||||||
|
let promise = Promise.resolve(new realmConstructor(config));
|
||||||
|
promise.progress = (callback) => { };
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For synced Realms we open the Realm without specifying the schema and then wait until
|
||||||
|
// the Realm has finished its initial sync with the server. We then reopen it with the correct
|
||||||
|
// schema. This avoids writing the schema to a potentially read-only Realm file, which would
|
||||||
|
// result in sync rejecting the writes. `_waitForDownload` ensures that the session is kept
|
||||||
|
// alive until our callback has returned, which prevents it from being torn down and recreated
|
||||||
|
// when we close the schemaless Realm and open it with the correct schema.
|
||||||
let syncSession;
|
let syncSession;
|
||||||
let promise = new Promise((resolve, reject) => {
|
let promise = new Promise((resolve, reject) => {
|
||||||
let realm = new realmConstructor(waitForDownloadConfig(config));
|
let realm = new realmConstructor(waitForDownloadConfig(config));
|
||||||
realm._waitForDownload(
|
realm._waitForDownload(
|
||||||
(session) => {
|
(session) => { syncSession = session; },
|
||||||
syncSession = session;
|
|
||||||
},
|
|
||||||
(error) => {
|
(error) => {
|
||||||
|
realm.close();
|
||||||
if (error) {
|
if (error) {
|
||||||
setTimeout(() => { reject(error); }, 1);
|
setTimeout(() => { reject(error); }, 1);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +103,6 @@ module.exports = function(realmConstructor) {
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ declare namespace Realm {
|
||||||
schemaVersion?: number;
|
schemaVersion?: number;
|
||||||
sync?: Realm.Sync.SyncConfiguration;
|
sync?: Realm.Sync.SyncConfiguration;
|
||||||
deleteRealmIfMigrationNeeded?: boolean;
|
deleteRealmIfMigrationNeeded?: boolean;
|
||||||
|
disableFormatUpgrade?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// object props type
|
// object props type
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "realm",
|
"name": "realm",
|
||||||
"description": "Realm is a mobile database: an alternative to SQLite and key-value stores",
|
"description": "Realm is a mobile database: an alternative to SQLite and key-value stores",
|
||||||
"version": "2.0.13",
|
"version": "2.1.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"homepage": "https://realm.io",
|
"homepage": "https://realm.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -91,7 +91,8 @@
|
||||||
"request": "^2.78.0",
|
"request": "^2.78.0",
|
||||||
"stream-counter": "^1.0.0",
|
"stream-counter": "^1.0.0",
|
||||||
"sync-request": "^3.0.1",
|
"sync-request": "^3.0.1",
|
||||||
"url-parse": "^1.1.7"
|
"url-parse": "^1.1.7",
|
||||||
|
"lzma-native": "^3.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^6.0.4",
|
"babel-eslint": "^6.0.4",
|
||||||
|
|
|
@ -9,15 +9,11 @@ set -eo pipefail
|
||||||
#use existing server if same version
|
#use existing server if same version
|
||||||
if [ -f node_modules/realm-object-server/package.json ]; then
|
if [ -f node_modules/realm-object-server/package.json ]; then
|
||||||
if grep -q "\"version\": \"$REALM_OBJECT_SERVER_VERSION\"" node_modules/realm-object-server/package.json; then
|
if grep -q "\"version\": \"$REALM_OBJECT_SERVER_VERSION\"" node_modules/realm-object-server/package.json; then
|
||||||
# echo -e "yes\n" | object-server-for-testing/reset-server-realms.command
|
|
||||||
rm -rf realm-object-server-data
|
rm -rf realm-object-server-data
|
||||||
rm -rf realm-object-server
|
rm -rf realm-object-server
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Uninstalling old version of realm-object-server"
|
|
||||||
npm uninstall realm-object-server
|
|
||||||
|
|
||||||
echo "Installing realm-object-server version: " $REALM_OBJECT_SERVER_VERSION
|
echo "Installing realm-object-server version: " $REALM_OBJECT_SERVER_VERSION
|
||||||
npm install realm-object-server@$REALM_OBJECT_SERVER_VERSION
|
npm install realm-object-server@$REALM_OBJECT_SERVER_VERSION
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
runtime = JSON.parse(%x{xcrun simctl list devices --json})['runtimes']
|
||||||
|
.select{|x| (x['identifier'].include? 'com.apple.CoreSimulator.SimRuntime.iOS') &&
|
||||||
|
(x['availability'] == "(available)")}[0]["identifier"]
|
||||||
|
|
||||||
|
puts runtime
|
|
@ -64,6 +64,6 @@ shell.exec("adb shell am start -n io.realm.react.testapp/.MainActivity");
|
||||||
|
|
||||||
shell.popd();
|
shell.popd();
|
||||||
|
|
||||||
shell.exec("adb shell \"logcat -c && logcat | grep -m 1 __REALM_REACT_ANDROID_TESTS_COMPLETED__\"");
|
shell.exec("adb shell \"logcat -c && logcat | grep -m 1 __REALM_JS_TESTS_COMPLETED__\"");
|
||||||
|
|
||||||
shell.exec("adb pull /sdcard/tests.xml");
|
shell.exec("adb pull /sdcard/tests.xml");
|
176
scripts/test.sh
176
scripts/test.sh
|
@ -23,6 +23,8 @@ if [ -n "${JENKINS_HOME}" ]; then
|
||||||
CI_RUN=true
|
CI_RUN=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SIM_DEVICE_NAME=realm-js-test
|
||||||
|
|
||||||
# Start current working directory at the root of the project.
|
# Start current working directory at the root of the project.
|
||||||
cd "$SRCROOT"
|
cd "$SRCROOT"
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ stop_server() {
|
||||||
echo stopping server
|
echo stopping server
|
||||||
if [[ ${SERVER_PID} -gt 0 ]] ; then
|
if [[ ${SERVER_PID} -gt 0 ]] ; then
|
||||||
echo server is running. killing it
|
echo server is running. killing it
|
||||||
kill -9 ${SERVER_PID} || true
|
kill -9 ${SERVER_PID} >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +77,9 @@ cleanup() {
|
||||||
# Kill started object server
|
# Kill started object server
|
||||||
stop_server || true
|
stop_server || true
|
||||||
|
|
||||||
|
echo "shutting down running simulators"
|
||||||
|
shutdown_ios_simulator >/dev/null 2>&1
|
||||||
|
|
||||||
# Quit Simulator.app to give it a chance to go down gracefully
|
# Quit Simulator.app to give it a chance to go down gracefully
|
||||||
if $startedSimulator; then
|
if $startedSimulator; then
|
||||||
osascript -e 'tell app "Simulator" to quit without saving' || true
|
osascript -e 'tell app "Simulator" to quit without saving' || true
|
||||||
|
@ -98,6 +103,10 @@ cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
open_chrome() {
|
open_chrome() {
|
||||||
|
if [ $CONFIGURATION == 'Release' ]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
local dir
|
local dir
|
||||||
for dir in "$HOME/Applications" "/Applications"; do
|
for dir in "$HOME/Applications" "/Applications"; do
|
||||||
if [ -d "$dir/Google Chrome.app" ]; then
|
if [ -d "$dir/Google Chrome.app" ]; then
|
||||||
|
@ -109,10 +118,10 @@ open_chrome() {
|
||||||
|
|
||||||
start_packager() {
|
start_packager() {
|
||||||
watchman watch-del-all || true
|
watchman watch-del-all || true
|
||||||
./node_modules/react-native/packager/packager.sh | tee "$PACKAGER_OUT" &
|
./node_modules/react-native/scripts/packager.sh | tee "$PACKAGER_OUT" &
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if grep -Fxq "React packager ready." "$PACKAGER_OUT"; then
|
if grep -Fxq "Metro Bundler ready." "$PACKAGER_OUT"; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "Waiting for packager."
|
echo "Waiting for packager."
|
||||||
|
@ -124,126 +133,67 @@ start_packager() {
|
||||||
xctest() {
|
xctest() {
|
||||||
setup_ios_simulator
|
setup_ios_simulator
|
||||||
|
|
||||||
# - Wait until the simulator is fully booted by waiting for it to launch SpringBoard
|
|
||||||
printf "Waiting for springboard to ensure device is ready..."
|
|
||||||
xcrun simctl launch "$IOS_SIM_DEVICE" com.apple.springboard 1>/dev/null 2>/dev/null || true
|
|
||||||
echo " done"
|
|
||||||
|
|
||||||
# - Run the build and test
|
# - Run the build and test
|
||||||
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$IOS_SIM_DEVICE" build || {
|
echo "Building application"
|
||||||
|
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="${IOS_SIM_DEVICE_ID}" -derivedDataPath ./build build || {
|
||||||
EXITCODE=$?
|
EXITCODE=$?
|
||||||
echo "*** Failure (exit code $EXITCODE). ***"
|
echo "*** Failure (exit code $EXITCODE). ***"
|
||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
}
|
}
|
||||||
if [ -n "$XCPRETTY" ]; then
|
|
||||||
log_temp=$(mktemp build.log.XXXXXX)
|
echo "Installing application on ${SIM_DEVICE_NAME}"
|
||||||
if [ -e "$log_temp" ]; then
|
echo "Application Path" $(pwd)/build/Build/Products/$CONFIGURATION-iphonesimulator/$1.app
|
||||||
rm "$log_temp"
|
xcrun simctl install ${SIM_DEVICE_NAME} $(pwd)/build/Build/Products/$CONFIGURATION-iphonesimulator/$1.app
|
||||||
fi
|
|
||||||
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination name="iPhone 5s" test 2>&1 | tee "$log_temp" | "$XCPRETTY" -c --no-utf --report junit --output build/reports/junit.xml || {
|
|
||||||
EXITCODE=$?
|
echo "Launching application. (output is in $(pwd)/build/out.txt)"
|
||||||
printf "*** Xcode Failure (exit code %s). The full xcode log follows: ***\n\n" "$EXITCODE"
|
xcrun simctl launch --console ${SIM_DEVICE_NAME} io.realm.$1 | tee $(pwd)/build/out.txt
|
||||||
cat "$log_temp"
|
|
||||||
printf "\n\n*** End Xcode Failure ***\n"
|
echo "Shuttting down ${SIM_DEVICE_NAME} simulator. (device is not deleted. you can use it to debug the app)"
|
||||||
exit $EXITCODE
|
shutdown_ios_simulator
|
||||||
}
|
|
||||||
rm "$log_temp"
|
check_test_results $1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_test_results() {
|
||||||
|
echo "Checking tests results"
|
||||||
|
if grep -q "REALM_FAILING_TESTS" $(pwd)/build/out.txt; then
|
||||||
|
echo "*** REALM JS TESTS FAILED. See tests results above ***"
|
||||||
|
exit 20
|
||||||
else
|
else
|
||||||
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$IOS_SIM_DEVICE" test || {
|
echo "*** $1 SUCCESS ***"
|
||||||
EXITCODE=$?
|
|
||||||
echo "*** Failure (exit code $EXITCODE). ***"
|
|
||||||
exit $EXITCODE
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ios_simulator() {
|
setup_ios_simulator() {
|
||||||
# - Ensure one version of xcode is chosen by all tools
|
#try deleting old simulator with same name.
|
||||||
if [[ -z "$DEVELOPER_DIR" ]]; then
|
echo "Preparing to create a new simulator"
|
||||||
DEV_DIR="$(xcode-select -p)"
|
delete_ios_simulator >/dev/null 2>&1
|
||||||
export DEVELOPER_DIR=$DEV_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -- Ensure that the simulator is ready
|
#parse devices
|
||||||
|
IOS_RUNTIME=$(xcrun simctl list runtimes | grep -m1 -o 'com.apple.CoreSimulator.SimRuntime.iOS.*' | sed 's/[()]//g')
|
||||||
|
echo using iOS Runtime ${IOS_RUNTIME} to create new simulator ${SIM_DEVICE_NAME}
|
||||||
|
|
||||||
if [ $CI_RUN == true ]; then
|
#create new test simulator
|
||||||
# - Kill the Simulator to ensure we are running the correct one, only when running in CI
|
IOS_SIM_DEVICE_ID=$(xcrun simctl create ${SIM_DEVICE_NAME} com.apple.CoreSimulator.SimDeviceType.iPhone-SE ${IOS_RUNTIME})
|
||||||
echo "Resetting simulator using toolchain from: $DEVELOPER_DIR"
|
#boot new test simulator
|
||||||
|
xcrun simctl boot ${SIM_DEVICE_NAME}
|
||||||
|
}
|
||||||
|
|
||||||
# Quit Simulator.app to give it a chance to go down gracefully
|
shutdown_ios_simulator() {
|
||||||
local deadline=$((SECONDS+5))
|
#shutdown test simulator
|
||||||
while pgrep -qx Simulator && [ $SECONDS -lt $deadline ]; do
|
xcrun simctl shutdown ${SIM_DEVICE_NAME} || true
|
||||||
osascript -e 'tell app "Simulator" to quit without saving' || true
|
}
|
||||||
sleep 0.25 # otherwise the pkill following will get it too early
|
|
||||||
done
|
|
||||||
|
|
||||||
# stop CoreSimulatorService
|
delete_ios_simulator() {
|
||||||
launchctl remove com.apple.CoreSimulator.CoreSimulatorService 2>/dev/null || true
|
shutdown_ios_simulator
|
||||||
sleep 0.25 # launchtl can take a small moment to kill services
|
|
||||||
|
|
||||||
# kill them with fire
|
#delete test simulator
|
||||||
while pgrep -qx Simulator com.apple.CoreSimulator.CoreSimulatorService; do
|
xcrun simctl delete ${SIM_DEVICE_NAME} || true
|
||||||
pkill -9 -x Simulator com.apple.CoreSimulator.CoreSimulatorService || true
|
|
||||||
sleep 0.05
|
|
||||||
done
|
|
||||||
|
|
||||||
# - Prod `simctl` a few times as sometimes it fails the first couple of times after switching XCode vesions
|
|
||||||
local deadline=$((SECONDS+5))
|
|
||||||
while [ -z "$(xcrun simctl list devices 2>/dev/null)" ] && [ $SECONDS -lt $deadline ]; do
|
|
||||||
: # nothing to see here, will stop cycling on the first successful run
|
|
||||||
done
|
|
||||||
|
|
||||||
# - Choose a device, if it has not already been chosen
|
|
||||||
local deadline=$((SECONDS+5))
|
|
||||||
IOS_DEVICE=""
|
|
||||||
while [ -z "$IOS_DEVICE" ] && [ $SECONDS -lt $deadline ]; do
|
|
||||||
IOS_DEVICE="$(ruby $SRCROOT/scripts/find-ios-device.rb best)"
|
|
||||||
done
|
|
||||||
if [ -z "$IOS_DEVICE" ]; then
|
|
||||||
echo "*** Failed to determine the iOS Simulator device to use ***"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export IOS_SIM_DEVICE=$IOS_DEVICE
|
|
||||||
|
|
||||||
# - Reset the device we will be using if running in CI
|
|
||||||
xcrun simctl shutdown "$IOS_SIM_DEVICE" 1>/dev/null 2>/dev/null || true # sometimes simctl gets confused
|
|
||||||
xcrun simctl erase "$IOS_SIM_DEVICE"
|
|
||||||
|
|
||||||
# - Start the target in Simulator.app
|
|
||||||
# Note: as of Xcode 7.3.1 `simctl` can not completely boot a simulator, specifically it can not bring up backboard, so GUI apps can not run.
|
|
||||||
# This is fixed in version 8 of Xcode, but we still need the compatibility
|
|
||||||
|
|
||||||
"$DEVELOPER_DIR/Applications/Simulator.app/Contents/MacOS/Simulator" -CurrentDeviceUDID "$IOS_SIM_DEVICE" & # will get killed with all other children at exit
|
|
||||||
startedSimulator=true
|
|
||||||
|
|
||||||
else
|
|
||||||
# - ensure that the simulator is running on a developer's workstation
|
|
||||||
open "$DEVELOPER_DIR/Applications/Simulator.app"
|
|
||||||
|
|
||||||
# - Select the first device booted in the simulator, since it will boot something for us
|
|
||||||
local deadline=$((SECONDS+10))
|
|
||||||
IOS_DEVICE=""
|
|
||||||
while [ -z "$IOS_DEVICE" ] && [ $SECONDS -lt $deadline ]; do
|
|
||||||
IOS_DEVICE="$(ruby $SRCROOT/scripts/find-ios-device.rb booted)"
|
|
||||||
done
|
|
||||||
if [ -z "$IOS_DEVICE" ]; then
|
|
||||||
echo "*** Failed to determine the iOS Simulator device in use ***"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export IOS_SIM_DEVICE=$IOS_DEVICE
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Wait until the boot completes
|
|
||||||
printf " waiting for simulator (%s) to boot..." "$IOS_SIM_DEVICE"
|
|
||||||
until ruby -rjson -e "exit JSON.parse(%x{xcrun simctl list devices --json})['devices'].flat_map { |d| d[1] }.any? { |d| d['availability'] == '(available)' && d['state'] == 'Booted' }"; do
|
|
||||||
sleep 0.25
|
|
||||||
done
|
|
||||||
echo " done"
|
|
||||||
echo "It will take some time before the simulator is fully ready, continuing on to other work"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cleanup now and also cleanup when this script exits.
|
# Cleanup now and also cleanup when this script exits.
|
||||||
cleanup
|
cleanup >/dev/null 2>&1
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
# Use a consistent version of Node if possible.
|
# Use a consistent version of Node if possible.
|
||||||
|
@ -298,7 +248,7 @@ case "$TARGET" in
|
||||||
start_packager
|
start_packager
|
||||||
|
|
||||||
pushd ios
|
pushd ios
|
||||||
xctest ReactTestApp
|
xctest ReactTests
|
||||||
stop_server
|
stop_server
|
||||||
;;
|
;;
|
||||||
"react-example")
|
"react-example")
|
||||||
|
@ -309,8 +259,11 @@ case "$TARGET" in
|
||||||
open_chrome
|
open_chrome
|
||||||
start_packager
|
start_packager
|
||||||
|
|
||||||
|
echo "{ \"test\" : true }" > $(pwd)/components/params.json
|
||||||
pushd ios
|
pushd ios
|
||||||
xctest ReactExample
|
xctest ReactExample
|
||||||
|
popd
|
||||||
|
echo "{}" > $(pwd)/components/params.json
|
||||||
;;
|
;;
|
||||||
"react-tests-android")
|
"react-tests-android")
|
||||||
npm run check-environment
|
npm run check-environment
|
||||||
|
@ -322,21 +275,25 @@ case "$TARGET" in
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
||||||
XCPRETTY=''
|
XCPRETTY=''
|
||||||
|
|
||||||
pushd tests/react-test-app
|
pushd react-native/android
|
||||||
|
$(pwd)/gradlew publishAndroid
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd tests/react-test-app
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
echo "Resetting logcat"
|
echo "Resetting logcat"
|
||||||
# Despite the docs claiming -c to work, it doesn't, so `-T 1` alleviates that.
|
# Despite the docs claiming -c to work, it doesn't, so `-T 1` alleviates that.
|
||||||
|
mkdir -p $(pwd)/build || true
|
||||||
adb logcat -c
|
adb logcat -c
|
||||||
adb logcat -T 1 | tee "$LOGCAT_OUT" &
|
adb logcat -T 1 | tee "$LOGCAT_OUT" | tee $(pwd)/build/out.txt &
|
||||||
|
|
||||||
./run-android.sh
|
./run-android.sh
|
||||||
|
|
||||||
echo "Start listening for Test completion"
|
echo "Start listening for Test completion"
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if grep -q "__REALM_REACT_ANDROID_TESTS_COMPLETED__" "$LOGCAT_OUT"; then
|
if grep -q "__REALM_JS_TESTS_COMPLETED__" "$LOGCAT_OUT"; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "Waiting for tests."
|
echo "Waiting for tests."
|
||||||
|
@ -353,6 +310,7 @@ case "$TARGET" in
|
||||||
echo "********* File location: $(pwd)/tests.xml *********";
|
echo "********* File location: $(pwd)/tests.xml *********";
|
||||||
cat tests.xml
|
cat tests.xml
|
||||||
|
|
||||||
|
check_test_results ReactTests
|
||||||
;;
|
;;
|
||||||
"node")
|
"node")
|
||||||
npm run check-environment
|
npm run check-environment
|
||||||
|
|
|
@ -887,9 +887,8 @@
|
||||||
outputPaths = (
|
outputPaths = (
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = "/bin/sh";
|
||||||
shellScript = "node ../scripts/download-realm.js ios --sync";
|
shellScript = "[ -z \"$NVM_DIR\" ] && export NVM_DIR=\"$HOME/.nvm\"\n\nif [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n . \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n . \"$(brew --prefix nvm)/nvm.sh\"\nfi\n \nif [[ \"$(command -v nvm)\" ]]; then\n nvm install 7.10.0\nfi\n \n node ../scripts/download-realm.js ios --sync";
|
||||||
showEnvVarsInLog = 0;
|
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
|
@ -999,7 +998,7 @@
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 2.0.13;
|
CURRENT_PROJECT_VERSION = 2.1.1;
|
||||||
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
|
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
@ -1063,7 +1062,7 @@
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 2.0.13;
|
CURRENT_PROJECT_VERSION = 2.1.1;
|
||||||
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
|
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
|
|
@ -245,9 +245,9 @@ public:
|
||||||
{"close", wrap<close>},
|
{"close", wrap<close>},
|
||||||
{"compact", wrap<compact>},
|
{"compact", wrap<compact>},
|
||||||
{"deleteModel", wrap<delete_model>},
|
{"deleteModel", wrap<delete_model>},
|
||||||
{"_waitForDownload", wrap<wait_for_download_completion>},
|
|
||||||
{"_objectForObjectId", wrap<object_for_object_id>},
|
{"_objectForObjectId", wrap<object_for_object_id>},
|
||||||
#if REALM_ENABLE_SYNC
|
#if REALM_ENABLE_SYNC
|
||||||
|
{"_waitForDownload", wrap<wait_for_download_completion>},
|
||||||
{"_subscribeToObjects", wrap<subscribe_to_objects>},
|
{"_subscribeToObjects", wrap<subscribe_to_objects>},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -520,6 +520,12 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
||||||
if (!Value::is_undefined(ctx, cache_value)) {
|
if (!Value::is_undefined(ctx, cache_value)) {
|
||||||
config.cache = Value::validated_to_boolean(ctx, cache_value, "_cache");
|
config.cache = Value::validated_to_boolean(ctx, cache_value, "_cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const String disable_format_upgrade_string = "disableFormatUpgrade";
|
||||||
|
ValueType disable_format_upgrade_value = Object::get_property(ctx, object, disable_format_upgrade_string);
|
||||||
|
if (!Value::is_undefined(ctx, disable_format_upgrade_value)) {
|
||||||
|
config.disable_format_upgrade = Value::validated_to_boolean(ctx, disable_format_upgrade_value, "disableFormatUpgrade");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -714,6 +720,7 @@ void RealmClass<T>::get_sync_session(ContextType ctx, ObjectType object, ReturnV
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if REALM_ENABLE_SYNC
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RealmClass<T>::wait_for_download_completion(ContextType ctx, ObjectType this_object, Arguments args, ReturnValue &return_value) {
|
void RealmClass<T>::wait_for_download_completion(ContextType ctx, ObjectType this_object, Arguments args, ReturnValue &return_value) {
|
||||||
args.validate_maximum(2);
|
args.validate_maximum(2);
|
||||||
|
@ -724,13 +731,27 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, ObjectType thi
|
||||||
session_callback = Value::validated_to_function(ctx, args[0]);
|
session_callback = Value::validated_to_function(ctx, args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if REALM_ENABLE_SYNC
|
|
||||||
auto realm = *get_internal<T, RealmClass<T>>(this_object);
|
auto realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||||
if (auto* sync_config = realm->config().sync_config.get()) {
|
auto* sync_config = realm->config().sync_config.get();
|
||||||
|
if (!sync_config) {
|
||||||
|
throw std::logic_error("_waitForDownload can only be used on a synchronized Realm.");
|
||||||
|
}
|
||||||
|
|
||||||
Protected<FunctionType> protected_callback(ctx, callback_function);
|
Protected<FunctionType> protected_callback(ctx, callback_function);
|
||||||
Protected<ObjectType> protected_this(ctx, this_object);
|
Protected<ObjectType> protected_this(ctx, this_object);
|
||||||
Protected<typename T::GlobalContext> protected_ctx(Context<T>::get_global_context(ctx));
|
Protected<typename T::GlobalContext> protected_ctx(Context<T>::get_global_context(ctx));
|
||||||
|
|
||||||
|
std::shared_ptr<SyncUser> user = sync_config->user;
|
||||||
|
if (user && user->state() != SyncUser::State::Error) {
|
||||||
|
if (auto session = user->session_for_on_disk_path(realm->config().path)) {
|
||||||
|
if (!Value::is_null(ctx, session_callback)) {
|
||||||
|
FunctionType session_callback_func = Value::to_function(ctx, session_callback);
|
||||||
|
auto syncSession = create_object<T, SessionClass<T>>(ctx, new WeakSession(session));
|
||||||
|
ValueType callback_arguments[1];
|
||||||
|
callback_arguments[0] = syncSession;
|
||||||
|
Function<T>::callback(protected_ctx, session_callback_func, typename T::Object(), 1, callback_arguments);
|
||||||
|
}
|
||||||
|
|
||||||
EventLoopDispatcher<WaitHandler> wait_handler([=](std::error_code error_code) {
|
EventLoopDispatcher<WaitHandler> wait_handler([=](std::error_code error_code) {
|
||||||
HANDLESCOPE
|
HANDLESCOPE
|
||||||
if (!error_code) {
|
if (!error_code) {
|
||||||
|
@ -748,24 +769,10 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, ObjectType thi
|
||||||
|
|
||||||
Function<T>::callback(protected_ctx, protected_callback, typename T::Object(), 1, callback_arguments);
|
Function<T>::callback(protected_ctx, protected_callback, typename T::Object(), 1, callback_arguments);
|
||||||
}
|
}
|
||||||
|
// Ensure that the session remains alive until the callback has had an opportunity to reopen the Realm
|
||||||
// We keep our Realm instance alive until the callback has had a chance to open its own instance.
|
// with the appropriate schema.
|
||||||
// This allows it to share the sync session that our Realm opened.
|
(void)session;
|
||||||
if (realm)
|
|
||||||
realm->close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
std::shared_ptr<SyncUser> user = sync_config->user;
|
|
||||||
if (user && user->state() != SyncUser::State::Error) {
|
|
||||||
if (auto session = user->session_for_on_disk_path(realm->config().path)) {
|
|
||||||
if (!Value::is_null(ctx, session_callback)) {
|
|
||||||
FunctionType session_callback_func = Value::to_function(ctx, session_callback);
|
|
||||||
auto syncSession = create_object<T, SessionClass<T>>(ctx, new WeakSession(session));
|
|
||||||
ValueType callback_arguments[1];
|
|
||||||
callback_arguments[0] = syncSession;
|
|
||||||
Function<T>::callback(protected_ctx, session_callback_func, typename T::Object(), 1, callback_arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
session->wait_for_download_completion(std::move(wait_handler));
|
session->wait_for_download_completion(std::move(wait_handler));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -779,12 +786,8 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, ObjectType thi
|
||||||
ValueType callback_arguments[1];
|
ValueType callback_arguments[1];
|
||||||
callback_arguments[0] = object;
|
callback_arguments[0] = object;
|
||||||
Function<T>::callback(protected_ctx, protected_callback, protected_this, 1, callback_arguments);
|
Function<T>::callback(protected_ctx, protected_callback, protected_this, 1, callback_arguments);
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Function<T>::callback(ctx, callback_function, this_object, 0, nullptr);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RealmClass<T>::objects(ContextType ctx, ObjectType this_object, Arguments args, ReturnValue &return_value) {
|
void RealmClass<T>::objects(ContextType ctx, ObjectType this_object, Arguments args, ReturnValue &return_value) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3eb19c014fdfa0f02a03d4acf71d046d29a6dfa6
|
Subproject commit d681b1fb8a8ca7a8db1ab1edc25771d984795ebe
|
|
@ -56,7 +56,7 @@ function runTests() {
|
||||||
|
|
||||||
return Object.keys(testNames).reduce((suitePromiseChain, suiteName) => {
|
return Object.keys(testNames).reduce((suitePromiseChain, suiteName) => {
|
||||||
return suitePromiseChain.then(() => {
|
return suitePromiseChain.then(() => {
|
||||||
console.log('Starting ' + suiteName);
|
console.warn('Starting ' + suiteName);
|
||||||
|
|
||||||
return testNames[suiteName].reduce((testPromiseChain, testName) => {
|
return testNames[suiteName].reduce((testPromiseChain, testName) => {
|
||||||
return testPromiseChain.then(() => {
|
return testPromiseChain.then(() => {
|
||||||
|
@ -64,7 +64,7 @@ function runTests() {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return RealmTests.runTest(suiteName, testName);
|
return RealmTests.runTest(suiteName, testName);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
console.log('+ ' + testName);
|
console.warn('+ ' + testName);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.warn('- ' + testName);
|
console.warn('- ' + testName);
|
||||||
console.warn(err.message || err);
|
console.warn(err.message || err);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
const require_method = require;
|
||||||
function node_require(module) {
|
function node_require(module) {
|
||||||
return require(module);
|
return require_method(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Realm = node_require('realm');
|
const Realm = node_require('realm');
|
||||||
|
|
|
@ -203,7 +203,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
assertType: function(value, type, depth) {
|
assertType: function(value, type, depth) {
|
||||||
this.assertEqual(typeof value, type, `Value ${value} expected to be of type ${type}`, 1 + depth || 0);
|
try {
|
||||||
|
this.assertEqual(typeof value, type, "", 1 + depth || 0);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw new Error(`Value ${value} expected to be of type ${type}`)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
assertDefined: function(value, errorMessage, depth) {
|
assertDefined: function(value, errorMessage, depth) {
|
||||||
|
|
|
@ -27,7 +27,8 @@ if( typeof Realm.Sync !== 'undefined' && Realm.Sync !== null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNodeProcess = typeof process === 'object' && process + '' === '[object process]';
|
const isNodeProcess = typeof process === 'object' && process + '' === '[object process]';
|
||||||
function node_require(module) { return require(module); }
|
const require_method = require;
|
||||||
|
function node_require(module) { return require_method(module); }
|
||||||
|
|
||||||
if (isNodeProcess && process.platform === 'win32') {
|
if (isNodeProcess && process.platform === 'win32') {
|
||||||
global.enableSyncTests = false;
|
global.enableSyncTests = false;
|
||||||
|
@ -113,7 +114,7 @@ exports.runTest = function(suiteName, testName) {
|
||||||
if (testMethod) {
|
if (testMethod) {
|
||||||
// Start fresh in case of a crash in a previous run.
|
// Start fresh in case of a crash in a previous run.
|
||||||
Realm.clearTestState();
|
Realm.clearTestState();
|
||||||
console.log("Starting test " + testName);
|
console.warn("Starting test " + testName);
|
||||||
var promise;
|
var promise;
|
||||||
try {
|
try {
|
||||||
promise = testMethod.call(testSuite);
|
promise = testMethod.call(testSuite);
|
||||||
|
|
|
@ -32,7 +32,6 @@ const DATE3 = new Date(3);
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testListConstructor: function() {
|
testListConstructor: function() {
|
||||||
const realm = new Realm({schema: [schemas.PersonObject, schemas.PersonList]});
|
const realm = new Realm({schema: [schemas.PersonObject, schemas.PersonList]});
|
||||||
|
|
||||||
realm.write(() => {
|
realm.write(() => {
|
||||||
let obj = realm.create('PersonList', {list: []});
|
let obj = realm.create('PersonList', {list: []});
|
||||||
TestCase.assertInstanceOf(obj.list, Realm.List);
|
TestCase.assertInstanceOf(obj.list, Realm.List);
|
||||||
|
@ -40,7 +39,6 @@ module.exports = {
|
||||||
});
|
});
|
||||||
|
|
||||||
TestCase.assertThrowsContaining(() => new Realm.List(), 'constructor');
|
TestCase.assertThrowsContaining(() => new Realm.List(), 'constructor');
|
||||||
|
|
||||||
TestCase.assertInstanceOf(Realm.List, Function);
|
TestCase.assertInstanceOf(Realm.List, Function);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -453,5 +453,25 @@ module.exports = {
|
||||||
TestCase.assertEqual(realm.objects('Date')[2].currentDate.getTime(), 1000000000000);
|
TestCase.assertEqual(realm.objects('Date')[2].currentDate.getTime(), 1000000000000);
|
||||||
TestCase.assertEqual(realm.objects('Date')[3].currentDate.getTime(), -1000000000000);
|
TestCase.assertEqual(realm.objects('Date')[3].currentDate.getTime(), -1000000000000);
|
||||||
TestCase.assertEqual(realm.objects('Date')[4].currentDate.toString(), stringifiedDate.toString());
|
TestCase.assertEqual(realm.objects('Date')[4].currentDate.toString(), stringifiedDate.toString());
|
||||||
|
},
|
||||||
|
|
||||||
|
testDateResolution: function() {
|
||||||
|
const dateObjectSchema = {
|
||||||
|
name: 'DateObject',
|
||||||
|
properties: {
|
||||||
|
dateCol: 'date'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var realm = new Realm({schema: [dateObjectSchema]})
|
||||||
|
realm.write(function() {
|
||||||
|
realm.create('DateObject', { dateCol: new Date('2017-12-07T20:16:03.837Z') })
|
||||||
|
})
|
||||||
|
|
||||||
|
var objects = realm.objects('DateObject')
|
||||||
|
TestCase.assertEqual(new Date('2017-12-07T20:16:03.837Z').getTime(), objects[0].dateCol.getTime())
|
||||||
|
TestCase.assertTrue(new Date('2017-12-07T20:16:03.837Z').toISOString() === objects[0].dateCol.toISOString())
|
||||||
|
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -207,6 +207,21 @@ module.exports = {
|
||||||
TestCase.assertEqual(realm.readOnly, true);
|
TestCase.assertEqual(realm.readOnly, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testRealmOpen: function() {
|
||||||
|
let realm = new Realm({schema: [schemas.TestObject], schemaVersion: 1});
|
||||||
|
realm.write(() => {
|
||||||
|
realm.create('TestObject', [1])
|
||||||
|
});
|
||||||
|
realm.close();
|
||||||
|
|
||||||
|
return Realm.open({schema: [schemas.TestObject], schemaVersion: 2}).then(realm => {
|
||||||
|
const objects = realm.objects('TestObject');
|
||||||
|
TestCase.assertEqual(objects.length, 1);
|
||||||
|
TestCase.assertEqual(objects[0].doubleCol, 1.0);
|
||||||
|
realm.close();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
testDefaultPath: function() {
|
testDefaultPath: function() {
|
||||||
const defaultPath = Realm.defaultPath;
|
const defaultPath = Realm.defaultPath;
|
||||||
let defaultRealm = new Realm({schema: []});
|
let defaultRealm = new Realm({schema: []});
|
||||||
|
@ -1181,4 +1196,12 @@ module.exports = {
|
||||||
new Realm({schema: schema, deleteRealmIfMigrationNeeded: true, migration: function(oldRealm, newRealm) {}});
|
new Realm({schema: schema, deleteRealmIfMigrationNeeded: true, migration: function(oldRealm, newRealm) {}});
|
||||||
}, "Cannot include 'migration' when 'deleteRealmIfMigrationNeeded' is set.")
|
}, "Cannot include 'migration' when 'deleteRealmIfMigrationNeeded' is set.")
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testDisableFileFormatUpgrade: function() {
|
||||||
|
Realm.copyBundledRealmFiles();
|
||||||
|
|
||||||
|
TestCase.assertThrowsContaining(() => {
|
||||||
|
new Realm({ path: 'dates-v3.realm', disableFormatUpgrade: true } );
|
||||||
|
}, 'The Realm file format must be allowed to be upgraded in order to proceed.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -415,6 +415,7 @@ module.exports = {
|
||||||
realm2.write(function() {
|
realm2.write(function() {
|
||||||
object4 = realm2.create('TestObject', {doubleCol: 1});
|
object4 = realm2.create('TestObject', {doubleCol: 1});
|
||||||
});
|
});
|
||||||
|
|
||||||
TestCase.assertThrows(function() {
|
TestCase.assertThrows(function() {
|
||||||
objects.indexOf(object4);
|
objects.indexOf(object4);
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,8 +27,9 @@ const TestCase = require('./asserts');
|
||||||
|
|
||||||
const isNodeProccess = (typeof process === 'object' && process + '' === '[object process]');
|
const isNodeProccess = (typeof process === 'object' && process + '' === '[object process]');
|
||||||
|
|
||||||
|
const require_method = require;
|
||||||
function node_require(module) {
|
function node_require(module) {
|
||||||
return require(module);
|
return require_method(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
let tmp;
|
let tmp;
|
||||||
|
@ -168,6 +169,50 @@ module.exports = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testRealmOpenWithExistingLocalRealm() {
|
||||||
|
if (!isNodeProccess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const username = uuid();
|
||||||
|
const realmName = uuid();
|
||||||
|
const expectedObjectsCount = 3;
|
||||||
|
|
||||||
|
let user, config;
|
||||||
|
return runOutOfProcess(__dirname + '/download-api-helper.js', username, realmName, REALM_MODULE_PATH)
|
||||||
|
.then(() => Realm.Sync.User.login('http://localhost:9080', username, 'password'))
|
||||||
|
.then(u => {
|
||||||
|
user = u;
|
||||||
|
const accessTokenRefreshed = this;
|
||||||
|
let successCounter = 0;
|
||||||
|
|
||||||
|
config = {
|
||||||
|
sync: { user, url: `realm://localhost:9080/~/${realmName}` },
|
||||||
|
schema: [{ name: 'Dog', properties: { name: 'string' } }],
|
||||||
|
schemaVersion: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Open the Realm with a schema version of 1, then immediately close it.
|
||||||
|
// This verifies that Realm.open doesn't hit issues when the schema version
|
||||||
|
// of an existing, local Realm is different than the one passed in the configuration.
|
||||||
|
let realm = new Realm(config);
|
||||||
|
realm.close();
|
||||||
|
|
||||||
|
config.schemaVersion = 2;
|
||||||
|
return Realm.open(config)
|
||||||
|
}).then(realm => {
|
||||||
|
let actualObjectsCount = realm.objects('Dog').length;
|
||||||
|
TestCase.assertEqual(actualObjectsCount, expectedObjectsCount, "Synced realm does not contain the expected objects count");
|
||||||
|
|
||||||
|
const session = realm.syncSession;
|
||||||
|
TestCase.assertInstanceOf(session, Realm.Sync.Session);
|
||||||
|
TestCase.assertEqual(session.user.identity, user.identity);
|
||||||
|
TestCase.assertEqual(session.config.url, config.sync.url);
|
||||||
|
TestCase.assertEqual(session.config.user.identity, config.sync.user.identity);
|
||||||
|
TestCase.assertEqual(session.state, 'active');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
testRealmOpenAsync() {
|
testRealmOpenAsync() {
|
||||||
if (!isNodeProccess) {
|
if (!isNodeProccess) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -142,6 +142,8 @@ dependencies {
|
||||||
compile "com.facebook.react:react-native:+" // From node_modules
|
compile "com.facebook.react:react-native:+" // From node_modules
|
||||||
compile project(":realm")
|
compile project(":realm")
|
||||||
compile project(":react-native-fs")
|
compile project(":react-native-fs")
|
||||||
|
compile project(':react-native-exception-handler')
|
||||||
|
compile project(':react-native-exit-app-no-history')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run this once to be able to run the application with BUCK
|
// Run this once to be able to run the application with BUCK
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.app.Application;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.facebook.react.ReactApplication;
|
import com.facebook.react.ReactApplication;
|
||||||
|
import com.masteratul.exceptionhandler.ReactNativeExceptionHandlerPackage;
|
||||||
|
import com.github.wumke.RNExitApp.RNExitAppPackage;
|
||||||
import com.facebook.react.ReactInstanceManager;
|
import com.facebook.react.ReactInstanceManager;
|
||||||
import com.facebook.react.ReactNativeHost;
|
import com.facebook.react.ReactNativeHost;
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
|
@ -20,7 +22,7 @@ public class MainApplication extends Application implements ReactApplication {
|
||||||
|
|
||||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean getUseDeveloperSupport() {
|
public boolean getUseDeveloperSupport() {
|
||||||
return BuildConfig.DEBUG;
|
return BuildConfig.DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +30,8 @@ public class MainApplication extends Application implements ReactApplication {
|
||||||
protected List<ReactPackage> getPackages() {
|
protected List<ReactPackage> getPackages() {
|
||||||
return Arrays.<ReactPackage>asList(
|
return Arrays.<ReactPackage>asList(
|
||||||
new MainReactPackage(),
|
new MainReactPackage(),
|
||||||
|
new ReactNativeExceptionHandlerPackage(),
|
||||||
|
new RNExitAppPackage(),
|
||||||
new RNFSPackage(),
|
new RNFSPackage(),
|
||||||
new RealmReactPackage()
|
new RealmReactPackage()
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,3 +7,9 @@ project(':realm').projectDir = new File(settingsDir, '../node_modules/realm/andr
|
||||||
|
|
||||||
include ':react-native-fs'
|
include ':react-native-fs'
|
||||||
project(':react-native-fs').projectDir = new File(settingsDir, '../node_modules/react-native-fs/android')
|
project(':react-native-fs').projectDir = new File(settingsDir, '../node_modules/react-native-fs/android')
|
||||||
|
|
||||||
|
include ':react-native-exception-handler'
|
||||||
|
project(':react-native-exception-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exception-handler/android')
|
||||||
|
|
||||||
|
include ':react-native-exit-app-no-history'
|
||||||
|
project(':react-native-exit-app-no-history').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exit-app-no-history/android')
|
||||||
|
|
|
@ -33,13 +33,13 @@ import { getTestNames, runTest } from './tests';
|
||||||
async function runTests() {
|
async function runTests() {
|
||||||
let testNames = getTestNames();
|
let testNames = getTestNames();
|
||||||
let rootXml = builder.create('testsuites');
|
let rootXml = builder.create('testsuites');
|
||||||
|
let failingTests = [];
|
||||||
for (let suiteName in testNames) {
|
for (let suiteName in testNames) {
|
||||||
let itemTestsuite = rootXml.ele('testsuite');
|
let itemTestsuite = rootXml.ele('testsuite');
|
||||||
let nbrTests = 0;
|
let nbrTests = 0;
|
||||||
let nbrFailures = 0;
|
let nbrFailures = 0;
|
||||||
|
|
||||||
console.log('Starting ' + suiteName);
|
console.error('Starting ' + suiteName);
|
||||||
|
|
||||||
for (let testName of testNames[suiteName]) {
|
for (let testName of testNames[suiteName]) {
|
||||||
nbrTests++;
|
nbrTests++;
|
||||||
|
@ -51,6 +51,7 @@ async function runTests() {
|
||||||
await runTest(suiteName, testName);
|
await runTest(suiteName, testName);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
failingTests.push(`${suiteName}: ${testName} : Error ${e.message}`);
|
||||||
itemTest.ele('error', {'message': e.message, 'stacktrace': e.stack}, e.toString());
|
itemTest.ele('error', {'message': e.message, 'stacktrace': e.stack}, e.toString());
|
||||||
nbrFailures++;
|
nbrFailures++;
|
||||||
}
|
}
|
||||||
|
@ -73,11 +74,19 @@ async function runTests() {
|
||||||
// write the unit tests reports
|
// write the unit tests reports
|
||||||
try {
|
try {
|
||||||
await RNFS.writeFile('/sdcard/tests.xml', xmlString, 'utf8');
|
await RNFS.writeFile('/sdcard/tests.xml', xmlString, 'utf8');
|
||||||
console.log('__REALM_REACT_ANDROID_TESTS_COMPLETED__');
|
console.log('__REALM_JS_TESTS_COMPLETED__');
|
||||||
|
if (failingTests.length !== 0) {
|
||||||
|
console.error('\n\nREALM_FAILING_TESTS\n');
|
||||||
|
console.error(failingTests);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
console.warn("Realm Tests App finished. Exiting. Disable this to debug the app locally");
|
||||||
|
RNExitApp.exitApp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReactTests extends React.Component {
|
class ReactTests extends React.Component {
|
||||||
|
|
|
@ -19,23 +19,109 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
Alert,
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
|
import builder from 'xmlbuilder';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { runTests } from './tests';
|
import { getTestNames, runTest } from './tests';
|
||||||
|
import RNFS from 'react-native-fs';
|
||||||
|
import RNExitApp from 'react-native-exit-app-no-history';
|
||||||
|
|
||||||
|
// import {setJSExceptionHandler} from 'react-native-exception-handler';
|
||||||
|
// import {setNativeExceptionHandler} from 'react-native-exception-handler/index';
|
||||||
|
|
||||||
|
// setNativeExceptionHandler((exceptionString) => {
|
||||||
|
// console.error("\nRealm Tests App FAILED. NATIVE ERROR\n");
|
||||||
|
// console.error(`\n${exceptionString}\n`);
|
||||||
|
// RNExitApp.exitApp();
|
||||||
|
// });
|
||||||
|
|
||||||
|
// //unhandled JS exceptions handler
|
||||||
|
// setJSExceptionHandler((error, isFatal) => {
|
||||||
|
// console.error("\nRealm Tests App FAILED. JS ERROR\n");
|
||||||
|
// console.error(`\n${error}\n`);
|
||||||
|
// RNExitApp.exitApp();
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function runTests() {
|
||||||
|
try {
|
||||||
|
let testNames = getTestNames();
|
||||||
|
let rootXml = builder.create('testsuites');
|
||||||
|
let failingTests = [];
|
||||||
|
for (let suiteName in testNames) {
|
||||||
|
let itemTestsuite = rootXml.ele('testsuite');
|
||||||
|
let nbrTests = 0;
|
||||||
|
let nbrFailures = 0;
|
||||||
|
|
||||||
|
console.error('Starting ' + suiteName);
|
||||||
|
|
||||||
|
for (let testName of testNames[suiteName]) {
|
||||||
|
nbrTests++;
|
||||||
|
|
||||||
|
let itemTest = itemTestsuite.ele('testcase');
|
||||||
|
itemTest.att('name', testName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await runTest(suiteName, testName);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
failingTests.push(`${suiteName}: ${testName} : Error ${e.message}`);
|
||||||
|
itemTest.ele('error', {'message': e.message, 'stacktrace': e.stack}, e.toString());
|
||||||
|
nbrFailures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update Junit XML report
|
||||||
|
itemTestsuite.att('name', suiteName);
|
||||||
|
itemTestsuite.att('tests', nbrTests);
|
||||||
|
itemTestsuite.att('failures', nbrFailures);
|
||||||
|
itemTestsuite.att('timestamp', "2016-01-22T14:40:44.874443-05:00");//TODO use real timestamp
|
||||||
|
|
||||||
|
}
|
||||||
|
// export unit tests results
|
||||||
|
let xmlString = rootXml.end({
|
||||||
|
pretty: true,
|
||||||
|
indent: ' ',
|
||||||
|
newline: '\n',
|
||||||
|
});
|
||||||
|
|
||||||
|
// write the unit tests reports
|
||||||
|
const path = RNFS.MainBundlePath + "/tests.xml";
|
||||||
|
await RNFS.writeFile(path, xmlString, 'utf8');
|
||||||
|
|
||||||
|
//using console.log output is not shown in Release builds. using console.warn
|
||||||
|
console.warn(xmlString);
|
||||||
|
console.warn('__REALM_JS_TESTS_COMPLETED__');
|
||||||
|
if (failingTests.length !== 0) {
|
||||||
|
console.error('\n\nREALM_FAILING_TESTS\n');
|
||||||
|
console.error(failingTests);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
console.warn("Realm Tests App finished. Exiting. Disable this to debug the app locally");
|
||||||
|
RNExitApp.exitApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ReactTests extends React.Component {
|
class ReactTests extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
runTests();
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.button} onPress={runTests}>
|
|
||||||
Tap to Run Tests
|
|
||||||
</Text>
|
|
||||||
<Text style={styles.instructions}>
|
<Text style={styles.instructions}>
|
||||||
|
{'\n'}REALM-JS TESTS{'\n'}
|
||||||
|
|
||||||
Press Cmd+R to reload,{'\n'}
|
Press Cmd+R to reload,{'\n'}
|
||||||
Cmd+D or shake for dev menu
|
Cmd+D or shake for dev menu
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||||
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||||
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||||
|
1A31425AAD0B4731BDD7361C /* libReactNativeExceptionHandler.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BDA39DE0BF646F2AF670F18 /* libReactNativeExceptionHandler.a */; };
|
||||||
1A9D2B80E7D649D2B5D8FE09 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E45185577984C00AA740BFE /* libz.tbd */; };
|
1A9D2B80E7D649D2B5D8FE09 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E45185577984C00AA740BFE /* libz.tbd */; };
|
||||||
|
1C2471A6B2544BF3BD9D9C10 /* libRNExitApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DAA9FCB85294F77873D2769 /* libRNExitApp.a */; };
|
||||||
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
|
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
|
||||||
66DA50ADC4F24D88856B9051 /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 629FEF95D64747E9A56D4D0C /* libRealmReact.a */; };
|
66DA50ADC4F24D88856B9051 /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 629FEF95D64747E9A56D4D0C /* libRealmReact.a */; };
|
||||||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
|
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
|
||||||
|
@ -31,6 +33,7 @@
|
||||||
855301D31E2006F700FF108E /* RealmReactTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 855301D11E2006F400FF108E /* RealmReactTests.m */; };
|
855301D31E2006F700FF108E /* RealmReactTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 855301D11E2006F400FF108E /* RealmReactTests.m */; };
|
||||||
A4CEF4BB1F7F862D00BA3B26 /* sync-v1.realm in Resources */ = {isa = PBXBuildFile; fileRef = A4CEF4BA1F7F862D00BA3B26 /* sync-v1.realm */; };
|
A4CEF4BB1F7F862D00BA3B26 /* sync-v1.realm in Resources */ = {isa = PBXBuildFile; fileRef = A4CEF4BA1F7F862D00BA3B26 /* sync-v1.realm */; };
|
||||||
E2050A7A5BE14CEA9A9E0722 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B37A7097A134D5CBB4C462A /* libc++.tbd */; };
|
E2050A7A5BE14CEA9A9E0722 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B37A7097A134D5CBB4C462A /* libc++.tbd */; };
|
||||||
|
FD7EF00801C34983A6188E6E /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBE9BC51D4A4EF79B40A51A /* libRNFS.a */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
@ -223,6 +226,90 @@
|
||||||
remoteGlobalIDString = F60690131CA2766F0003FB26;
|
remoteGlobalIDString = F60690131CA2766F0003FB26;
|
||||||
remoteInfo = RealmReact;
|
remoteInfo = RealmReact;
|
||||||
};
|
};
|
||||||
|
A474395F1FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;
|
||||||
|
remoteInfo = fishhook;
|
||||||
|
};
|
||||||
|
A47439611FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
|
||||||
|
remoteInfo = "fishhook-tvOS";
|
||||||
|
};
|
||||||
|
A47439711FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
|
||||||
|
remoteInfo = "third-party";
|
||||||
|
};
|
||||||
|
A47439731FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
|
||||||
|
remoteInfo = "third-party-tvOS";
|
||||||
|
};
|
||||||
|
A47439751FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
|
||||||
|
remoteInfo = "double-conversion";
|
||||||
|
};
|
||||||
|
A47439771FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
|
||||||
|
remoteInfo = "double-conversion-tvOS";
|
||||||
|
};
|
||||||
|
A47439791FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
|
||||||
|
remoteInfo = privatedata;
|
||||||
|
};
|
||||||
|
A474397B1FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
|
||||||
|
remoteInfo = "privatedata-tvOS";
|
||||||
|
};
|
||||||
|
A47439801FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = FC81504B0B8B47808E93B553 /* RNFS.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = F12AFB9B1ADAF8F800E0535D;
|
||||||
|
remoteInfo = RNFS;
|
||||||
|
};
|
||||||
|
A47439821FCF49A00034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = FC81504B0B8B47808E93B553 /* RNFS.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 6456441F1EB8DA9100672408;
|
||||||
|
remoteInfo = "RNFS-tvOS";
|
||||||
|
};
|
||||||
|
A47439BA1FCF55E80034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 5E54C8D078F84427A9DEE242 /* RNExitApp.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 15209BEF1D250F63000D0F44;
|
||||||
|
remoteInfo = RNExitApp;
|
||||||
|
};
|
||||||
|
A47439F11FCF586E0034D32F /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = E65B8206DCD647B896F86688 /* ReactNativeExceptionHandler.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
||||||
|
remoteInfo = ReactNativeExceptionHandler;
|
||||||
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
@ -245,8 +332,10 @@
|
||||||
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
|
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
|
||||||
193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; };
|
193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; };
|
||||||
4E45185577984C00AA740BFE /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
4E45185577984C00AA740BFE /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
||||||
|
5E54C8D078F84427A9DEE242 /* RNExitApp.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNExitApp.xcodeproj; path = "../node_modules/react-native-exit-app-no-history/ios/RNExitApp.xcodeproj"; sourceTree = "<group>"; };
|
||||||
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
|
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
|
||||||
629FEF95D64747E9A56D4D0C /* libRealmReact.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRealmReact.a; sourceTree = "<group>"; };
|
629FEF95D64747E9A56D4D0C /* libRealmReact.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRealmReact.a; sourceTree = "<group>"; };
|
||||||
|
6EBE9BC51D4A4EF79B40A51A /* libRNFS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFS.a; sourceTree = "<group>"; };
|
||||||
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
|
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
|
||||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
||||||
8553016A1E1FF6D500FF108E /* RealmJSTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RealmJSTests.mm; path = ../../ios/RealmJSTests.mm; sourceTree = "<group>"; };
|
8553016A1E1FF6D500FF108E /* RealmJSTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RealmJSTests.mm; path = ../../ios/RealmJSTests.mm; sourceTree = "<group>"; };
|
||||||
|
@ -254,7 +343,11 @@
|
||||||
855301CE1E20069D00FF108E /* dates-v5.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dates-v5.realm"; sourceTree = "<group>"; };
|
855301CE1E20069D00FF108E /* dates-v5.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dates-v5.realm"; sourceTree = "<group>"; };
|
||||||
855301D11E2006F400FF108E /* RealmReactTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RealmReactTests.m; path = ReactTests/RealmReactTests.m; sourceTree = "<group>"; };
|
855301D11E2006F400FF108E /* RealmReactTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RealmReactTests.m; path = ReactTests/RealmReactTests.m; sourceTree = "<group>"; };
|
||||||
8B37A7097A134D5CBB4C462A /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
8B37A7097A134D5CBB4C462A /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
||||||
|
9BDA39DE0BF646F2AF670F18 /* libReactNativeExceptionHandler.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libReactNativeExceptionHandler.a; sourceTree = "<group>"; };
|
||||||
|
9DAA9FCB85294F77873D2769 /* libRNExitApp.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNExitApp.a; sourceTree = "<group>"; };
|
||||||
A4CEF4BA1F7F862D00BA3B26 /* sync-v1.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sync-v1.realm"; sourceTree = "<group>"; };
|
A4CEF4BA1F7F862D00BA3B26 /* sync-v1.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sync-v1.realm"; sourceTree = "<group>"; };
|
||||||
|
E65B8206DCD647B896F86688 /* ReactNativeExceptionHandler.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeExceptionHandler.xcodeproj; path = "../node_modules/react-native-exception-handler/ios/ReactNativeExceptionHandler.xcodeproj"; sourceTree = "<group>"; };
|
||||||
|
FC81504B0B8B47808E93B553 /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -284,6 +377,9 @@
|
||||||
66DA50ADC4F24D88856B9051 /* libRealmReact.a in Frameworks */,
|
66DA50ADC4F24D88856B9051 /* libRealmReact.a in Frameworks */,
|
||||||
E2050A7A5BE14CEA9A9E0722 /* libc++.tbd in Frameworks */,
|
E2050A7A5BE14CEA9A9E0722 /* libc++.tbd in Frameworks */,
|
||||||
1A9D2B80E7D649D2B5D8FE09 /* libz.tbd in Frameworks */,
|
1A9D2B80E7D649D2B5D8FE09 /* libz.tbd in Frameworks */,
|
||||||
|
FD7EF00801C34983A6188E6E /* libRNFS.a in Frameworks */,
|
||||||
|
1C2471A6B2544BF3BD9D9C10 /* libRNExitApp.a in Frameworks */,
|
||||||
|
1A31425AAD0B4731BDD7361C /* libReactNativeExceptionHandler.a in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -346,6 +442,8 @@
|
||||||
children = (
|
children = (
|
||||||
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
|
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
|
||||||
3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,
|
3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,
|
||||||
|
A47439601FCF49A00034D32F /* libfishhook.a */,
|
||||||
|
A47439621FCF49A00034D32F /* libfishhook-tvOS.a */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -375,6 +473,12 @@
|
||||||
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
|
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
|
||||||
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
|
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
|
||||||
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
|
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
|
||||||
|
A47439721FCF49A00034D32F /* libthird-party.a */,
|
||||||
|
A47439741FCF49A00034D32F /* libthird-party.a */,
|
||||||
|
A47439761FCF49A00034D32F /* libdouble-conversion.a */,
|
||||||
|
A47439781FCF49A00034D32F /* libdouble-conversion.a */,
|
||||||
|
A474397A1FCF49A00034D32F /* libprivatedata.a */,
|
||||||
|
A474397C1FCF49A00034D32F /* libprivatedata-tvOS.a */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -400,7 +504,7 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
|
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
|
||||||
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */,
|
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -429,6 +533,9 @@
|
||||||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
||||||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
||||||
193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */,
|
193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */,
|
||||||
|
FC81504B0B8B47808E93B553 /* RNFS.xcodeproj */,
|
||||||
|
5E54C8D078F84427A9DEE242 /* RNExitApp.xcodeproj */,
|
||||||
|
E65B8206DCD647B896F86688 /* ReactNativeExceptionHandler.xcodeproj */,
|
||||||
);
|
);
|
||||||
name = Libraries;
|
name = Libraries;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -486,6 +593,31 @@
|
||||||
path = ../../data;
|
path = ../../data;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
A474394A1FCF49A00034D32F /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A47439811FCF49A00034D32F /* libRNFS.a */,
|
||||||
|
A47439831FCF49A00034D32F /* libRNFS.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
A47439951FCF55E80034D32F /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A47439BB1FCF55E80034D32F /* libRNExitApp.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
A47439CD1FCF586E0034D32F /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A47439F21FCF586E0034D32F /* libReactNativeExceptionHandler.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
@ -596,10 +728,22 @@
|
||||||
ProductGroup = 146834001AC3E56700842450 /* Products */;
|
ProductGroup = 146834001AC3E56700842450 /* Products */;
|
||||||
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ProductGroup = A47439CD1FCF586E0034D32F /* Products */;
|
||||||
|
ProjectRef = E65B8206DCD647B896F86688 /* ReactNativeExceptionHandler.xcodeproj */;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ProductGroup = 855301781E1FF78600FF108E /* Products */;
|
ProductGroup = 855301781E1FF78600FF108E /* Products */;
|
||||||
ProjectRef = 193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */;
|
ProjectRef = 193A0C4F1D2C485DBE5ACC72 /* RealmReact.xcodeproj */;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ProductGroup = A47439951FCF55E80034D32F /* Products */;
|
||||||
|
ProjectRef = 5E54C8D078F84427A9DEE242 /* RNExitApp.xcodeproj */;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ProductGroup = A474394A1FCF49A00034D32F /* Products */;
|
||||||
|
ProjectRef = FC81504B0B8B47808E93B553 /* RNFS.xcodeproj */;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
|
@ -764,10 +908,10 @@
|
||||||
remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
|
remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = {
|
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
|
||||||
isa = PBXReferenceProxy;
|
isa = PBXReferenceProxy;
|
||||||
fileType = archive.ar;
|
fileType = archive.ar;
|
||||||
path = "libRCTAnimation-tvOS.a";
|
path = libRCTAnimation.a;
|
||||||
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
|
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
|
@ -792,6 +936,90 @@
|
||||||
remoteRef = 855301941E1FF78600FF108E /* PBXContainerItemProxy */;
|
remoteRef = 855301941E1FF78600FF108E /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
|
A47439601FCF49A00034D32F /* libfishhook.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libfishhook.a;
|
||||||
|
remoteRef = A474395F1FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439621FCF49A00034D32F /* libfishhook-tvOS.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libfishhook-tvOS.a";
|
||||||
|
remoteRef = A47439611FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439721FCF49A00034D32F /* libthird-party.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libthird-party.a";
|
||||||
|
remoteRef = A47439711FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439741FCF49A00034D32F /* libthird-party.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libthird-party.a";
|
||||||
|
remoteRef = A47439731FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439761FCF49A00034D32F /* libdouble-conversion.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libdouble-conversion.a";
|
||||||
|
remoteRef = A47439751FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439781FCF49A00034D32F /* libdouble-conversion.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libdouble-conversion.a";
|
||||||
|
remoteRef = A47439771FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A474397A1FCF49A00034D32F /* libprivatedata.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libprivatedata.a;
|
||||||
|
remoteRef = A47439791FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A474397C1FCF49A00034D32F /* libprivatedata-tvOS.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = "libprivatedata-tvOS.a";
|
||||||
|
remoteRef = A474397B1FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439811FCF49A00034D32F /* libRNFS.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libRNFS.a;
|
||||||
|
remoteRef = A47439801FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439831FCF49A00034D32F /* libRNFS.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libRNFS.a;
|
||||||
|
remoteRef = A47439821FCF49A00034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439BB1FCF55E80034D32F /* libRNExitApp.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libRNExitApp.a;
|
||||||
|
remoteRef = A47439BA1FCF55E80034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
A47439F21FCF586E0034D32F /* libReactNativeExceptionHandler.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libReactNativeExceptionHandler.a;
|
||||||
|
remoteRef = A47439F11FCF586E0034D32F /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
/* End PBXReferenceProxy section */
|
/* End PBXReferenceProxy section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
@ -829,7 +1057,7 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
|
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
|
@ -889,6 +1117,9 @@
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactTests.app/ReactTests";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactTests.app/ReactTests";
|
||||||
|
@ -907,6 +1138,9 @@
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
|
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactTests.app/ReactTests";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactTests.app/ReactTests";
|
||||||
|
@ -921,6 +1155,7 @@
|
||||||
INFOPLIST_FILE = ReactTests/Info.plist;
|
INFOPLIST_FILE = ReactTests/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.realm.ReactTests;
|
||||||
PRODUCT_NAME = ReactTests;
|
PRODUCT_NAME = ReactTests;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
@ -932,6 +1167,7 @@
|
||||||
INFOPLIST_FILE = ReactTests/Info.plist;
|
INFOPLIST_FILE = ReactTests/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.realm.ReactTests;
|
||||||
PRODUCT_NAME = ReactTests;
|
PRODUCT_NAME = ReactTests;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"size" : "20x20",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"size" : "20x20",
|
||||||
|
"scale" : "3x"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
|
|
|
@ -3,18 +3,23 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-native start"
|
"start": "node node_modules/react-native/local-cli/cli.js start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "~15.4.0-rc.4",
|
"react": "16.0.0",
|
||||||
"react-native": "0.40.0",
|
"react-native": "0.50.4",
|
||||||
"react-native-fs": "^1.1.0",
|
"react-native-exception-handler": "^2.4.3",
|
||||||
|
"react-native-exit-app-no-history": "^1.0.2",
|
||||||
|
"react-native-fs": "^2.8.5",
|
||||||
"realm": "file:../..",
|
"realm": "file:../..",
|
||||||
"realm-tests": "file:../js",
|
"realm-tests": "file:../js",
|
||||||
"xmlbuilder": "^4.2.1"
|
"xmlbuilder": "^4.2.1"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"moment": "2.19.1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-preset-react-native": "1.9.1",
|
"babel-preset-react-native": "4.0.0",
|
||||||
"invariant": "^2.2.2"
|
"invariant": "^2.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export async function runTests() {
|
||||||
let passed = true;
|
let passed = true;
|
||||||
|
|
||||||
for (let suiteName in testNames) {
|
for (let suiteName in testNames) {
|
||||||
console.log('Starting ' + suiteName);
|
console.warn('Starting ' + suiteName);
|
||||||
|
|
||||||
for (let testName of testNames[suiteName]) {
|
for (let testName of testNames[suiteName]) {
|
||||||
try {
|
try {
|
||||||
|
@ -72,11 +72,11 @@ export async function runTest(suiteName, testName) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await RealmTests.runTest(suiteName, testName);
|
await RealmTests.runTest(suiteName, testName);
|
||||||
console.log('+ ' + testName);
|
console.warn('+ ' + testName);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.warn('- ' + testName);
|
console.error('- ' + testName);
|
||||||
console.warn(e.message || e);
|
console.error(e.message || e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
Loading…
Reference in New Issue