Skip to content

Commit

Permalink
Migrate project to workspace (wix#5675)
Browse files Browse the repository at this point in the history
* Migrate project to workspace

This commit moves all unit tests to the playground workspace

* Fix ios unit tests

* Build pods before testing

* Build typescript before running iOS tests

* Remove xcode 10 support
  • Loading branch information
guyca authored and vshkl committed Feb 5, 2020
1 parent 97a5336 commit 93e21a4
Show file tree
Hide file tree
Showing 46 changed files with 957 additions and 834 deletions.
4 changes: 0 additions & 4 deletions lib/ios/ReactNativeNavigation.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ -(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOpt
- (UIWindow *)initializeKeyWindow {
UIWindow* keyWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
if (@available(iOS 13.0, *)) {
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
keyWindow.backgroundColor = [UIColor systemBackgroundColor];
#else
keyWindow.backgroundColor = [UIColor whiteColor];
#endif
} else {
keyWindow.backgroundColor = [UIColor whiteColor];
}
Expand Down
23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"build": "rm -rf ./lib/dist && tsc",
"watch": "rm -rf ./lib/dist && tsc --watch",
"xcode": "open playground/ios/playground.xcodeproj",
"xcode": "open playground/ios/playground.xcworkspace",
"install-android": "node ./scripts/install-android",
"uninstall-android": "cd playground/android && ./gradlew uninstallAll",
"clean": "node ./scripts/clean",
Expand All @@ -30,6 +30,7 @@
"start-windows": "node ./scripts/start-windows",
"pretest-js": "npm run build",
"test-js": "node ./scripts/test-js",
"pod-install": "pod install --project-directory=playground/ios",
"test-unit-ios": "node ./scripts/test-unit --ios",
"test-unit-android": "node ./scripts/test-unit --android",
"pretest-e2e-android": "npm run build",
Expand Down Expand Up @@ -61,23 +62,25 @@
"@babel/plugin-proposal-export-default-from": "7.2.0",
"@babel/plugin-proposal-export-namespace-from": "7.2.0",
"@types/hoist-non-react-statics": "^3.0.1",
"@types/jest": "23.x.x",
"@react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.9.x",
"@types/jest": "24.x.x",
"@types/lodash": "4.x.x",
"@types/react": "16.x.x",
"@types/react-native": "0.57.7",
"@types/react-test-renderer": "16.x.x",
"detox": "14.x.x",
"react-native-ui-lib": "3.24.2",
"handlebars": "4.x.x",
"jest": "24.0.0-alpha.6",
"metro-react-native-babel-preset": "0.52.x",
"react": "16.8.6",
"react-native": "0.60.0",
"jest": "24.9.x",
"metro-react-native-babel-preset": "0.57.x",
"react": "16.9.0",
"react-native": "0.61.4",
"react-native-typescript-transformer": "1.2.12",
"react-native-view-overflow": "0.0.4",
"react-native-keyboard-tracking-view": "5.x.x",
"react-redux": "5.x.x",
"react-test-renderer": "16.6.1",
"react-test-renderer": "16.9.x",
"redux": "3.x.x",
"remx": "2.x.x",
"semver": "5.x.x",
Expand Down Expand Up @@ -133,13 +136,13 @@
},
"ios.sim.debug": {
"binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -workspace playground/ios/playground.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"type": "ios.simulator",
"name": "iPhone 11"
},
"ios.sim.release": {
"binaryPath": "playground/ios/DerivedData/playground/Build/Products/Release-iphonesimulator/playground.app",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -workspace playground/ios/playground.xcworkspace -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"type": "ios.simulator",
"name": "iPhone 11"
},
Expand Down Expand Up @@ -169,4 +172,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion playground/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#import <XCTest/XCTest.h>
#import <objc/runtime.h>
#import "RNNCommandsHandler.h"
#import "RNNNavigationOptions.h"
#import <ReactNativeNavigation/RNNCommandsHandler.h>
#import <ReactNativeNavigation/RNNNavigationOptions.h>
#import "RNNTestRootViewCreator.h"
#import "RNNComponentViewController.h"
#import "RNNStackController.h"
#import "RNNErrorHandler.h"
#import <ReactNativeNavigation/RNNComponentViewController.h>
#import <ReactNativeNavigation/RNNStackController.h>
#import <ReactNativeNavigation/RNNErrorHandler.h>
#import <OCMock/OCMock.h>
#import "RNNLayoutManager.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "RNNLayoutManager.h"
#import "UIViewController+LayoutProtocol.m"
#import "UIViewController+LayoutProtocol.h"

@interface RNNLayoutManagerTest : XCTestCase

Expand All @@ -29,6 +29,7 @@ - (void)setUp {
UIApplication* sharedApplication = [OCMockObject mockForClass:[UIApplication class]];
id mockedApplicationClass = OCMClassMock([UIApplication class]);
OCMStub(ClassMethod([mockedApplicationClass sharedApplication])).andReturn(sharedApplication);
OCMStub(sharedApplication.keyWindow).andReturn(_firstWindow);
OCMStub([sharedApplication windows]).andReturn(windows);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "RNNStackController.h"
#import "RNNComponentViewController.h"
#import <ReactNativeNavigation/RNNStackController.h>
#import <ReactNativeNavigation/RNNComponentViewController.h>
#import "RNNTestRootViewCreator.h"

@interface RNNNavigationControllerTest : XCTestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "RNNComponentViewController.h"
#import <ReactNativeNavigation/RNNComponentViewController.h>
#import "RNNReactRootViewCreator.h"
#import "RNNTestRootViewCreator.h"
#import <React/RCTConvert.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>
#import "RNNComponentViewCreator.h"
#import <ReactNativeNavigation/RNNComponentViewCreator.h>

@interface RNNTestRootViewCreator : NSObject <RNNComponentViewCreator>

Expand Down
51 changes: 51 additions & 0 deletions playground/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
use_frameworks!

def all_pods
# Pods for playground
pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../../node_modules/react-native/'
pod 'React-Core', :path => '../../node_modules/react-native/'
pod 'React-CoreModules', :path => '../../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../../node_modules/react-native/'

pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'ReactNativeNavigation', :path => '../../'
pod 'ReactNativeKeyboardTrackingView', :path => '../../node_modules/react-native-keyboard-tracking-view'
end

target 'playground' do
all_pods
end

target 'NavigationTests' do
all_pods
pod 'OCMock'
end

Loading

0 comments on commit 93e21a4

Please sign in to comment.