diff --git a/.circleci/config.yml b/.circleci/config.yml index cc86a51c4688e8..58f5eb01d71a3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -229,6 +229,18 @@ aliases: name: Objective-C tvOS End-to-End Test Suite command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3; + - &build-objc-ios-cocoapods-install + name: Test Cocoapods + command: ./scripts/objc-test-ios-cocoapods-install.sh + + - &build-objc-ios-cocoapods-test-app + name: Build Objective-C iOS Test App + command: ./scripts/objc-test-ios-cocoapods.sh + + - &run-objc-ios-cocoapods-tests + name: Objective-C iOS Test Suite + command: ./scripts/objc-test-ios-cocoapods.sh test + defaults: &defaults working_directory: ~/react-native @@ -354,6 +366,24 @@ jobs: - store_artifacts: path: ~/react-native/reports/junit + # Runs unit tests on iOS devices - cocoapods flavour + test_objc_ios_cocoapods: + <<: *macos_defaults + dependencies: + pre: + - xcrun instruments -w "iPhone 5s (11.1)" || true + steps: + - attach_workspace: + at: ~/react-native + - run: *build-objc-ios-cocoapods-install + - run: *build-objc-ios-cocoapods-test-app + - run: *run-objc-ios-cocoapods-tests + + - store_test_results: + path: ~/react-native/reports/junit + - store_artifacts: + path: ~/react-native/reports/junit + # Builds tvOS test app build_objc_tvos_test_app: <<: *macos_defaults @@ -612,6 +642,13 @@ workflows: requires: - checkout_code + # Test Cocoapods Integration + - test_objc_ios_cocoapods: + filters: *filter-ignore-gh-pages + requires: + - checkout_code + + # Only runs on PRs analyze: jobs: diff --git a/.gitignore b/.gitignore index 19c3bbdce24975..c49b2ceaaefd20 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,4 @@ node_modules /coverage /third-party +/RNTester/Pods diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000000000..2a5588ab1ebfe1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem "cocoapods", "~> 1.2.0" diff --git a/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj b/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj index 0ba2446271568a..1a7a346a06ddcd 100644 --- a/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj +++ b/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj @@ -34,7 +34,7 @@ 192F698F1E823F4A008692C7 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; 192F69901E823F4A008692C7 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; 192F69911E823F4A008692C7 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; + 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 192F69941E823F78008692C7 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; 192F69951E823F78008692C7 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; 192F69961E823F78008692C7 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; @@ -77,7 +77,7 @@ 1980B7291E80D1C4004DC789 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; 1980B72B1E80D1C4004DC789 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; 1980B72D1E80D1C4004DC789 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; + 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1980B7321E80D259004DC789 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; 1980B7351E80DD6F004DC789 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; 1980B7361E80DD6F004DC789 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; @@ -157,7 +157,7 @@ 1980B7311E80D21C004DC789 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = include/RCTAnimation; + dstPath = include/React; dstSubfolderSpec = 16; files = ( 194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */, @@ -204,7 +204,7 @@ 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStyleAnimatedNode.m; sourceTree = ""; }; 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTTransformAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTransformAnimatedNode.m; sourceTree = ""; }; - 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = ""; }; 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTValueAnimatedNode.m; sourceTree = ""; }; 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDiffClampAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDiffClampAnimatedNode.m; sourceTree = ""; }; diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h index ae2176684007d6..f3931e80cf8048 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h @@ -7,7 +7,7 @@ #import -#import +#import "RCTValueAnimatedNode.h" #import #import diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.m b/Libraries/WebSocket/RCTReconnectingWebSocket.m index 04e5dee57b67e7..fcd951dd59334b 100644 --- a/Libraries/WebSocket/RCTReconnectingWebSocket.m +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.m @@ -9,7 +9,7 @@ #import #import -#import +#import "fishhook.h" #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ #import diff --git a/RNTester/Podfile b/RNTester/Podfile new file mode 100644 index 00000000000000..0ec107ef2aaede --- /dev/null +++ b/RNTester/Podfile @@ -0,0 +1,51 @@ +source 'https://github.com/CocoaPods/Specs.git' + +use_frameworks! +inhibit_all_warnings! + +platform :ios, '9.0' + +project 'RNTester.xcodeproj' + +def shared_pods + pod 'yoga', :path => '../ReactCommon/yoga' + + # Third party deps podspec link + pod 'DoubleConversion', :podspec => '../third-party-podspecs/DoubleConversion.podspec' + pod 'Folly', :podspec => '../third-party-podspecs/Folly.podspec' + pod 'glog', :podspec => '../third-party-podspecs/glog.podspec' + + pod 'React', :path => '../', :subspecs => [ + 'Core', + 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43 + 'RCTText', + 'RCTNetwork', + 'RCTWebSocket', # needed for debugging + 'RCTImage', + 'RCTLinkingIOS', + 'RCTActionSheet', + 'RCTAnimation', + 'CxxBridge', + 'RCTPushNotification' + ] +end + +target 'RNTester' do + shared_pods +end + +target 'RNTesterUnitTests' do + shared_pods +end + +target 'RNTester-tvOS' do + shared_pods +end + +target 'RNTester-tvOSUnitTests' do + shared_pods +end + +target 'RNTester-tvOSIntegrationTests' do + shared_pods +end diff --git a/ReactCommon/yoga/yoga.podspec b/ReactCommon/yoga/yoga.podspec index c38f4c09796cb6..8888ae7d1addb5 100644 --- a/ReactCommon/yoga/yoga.podspec +++ b/ReactCommon/yoga/yoga.podspec @@ -41,4 +41,7 @@ Pod::Spec.new do |spec| source_files = 'yoga/**/*.{cpp,h}' source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION'] spec.source_files = source_files + + # Only expose the needed headers + spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h' end diff --git a/scripts/objc-test-ios-cocoapods-install.sh b/scripts/objc-test-ios-cocoapods-install.sh new file mode 100755 index 00000000000000..f37b1c85de0387 --- /dev/null +++ b/scripts/objc-test-ios-cocoapods-install.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -ex + +# Script used to run iOS tests. +# If not arguments are passed to the script, it will only compile +# the RNTester. +# If the script is called with a single argument "test", we'll +# also run the RNTester integration test (needs JS and packager): +# ./objc-test-ios.sh test + +SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +ROOT=$(dirname "$SCRIPTS") + +cd "$ROOT/RNTester" + +SCHEME="RNTester" +SDK="iphonesimulator" +DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.3.1" + +pod install diff --git a/scripts/objc-test-ios-cocoapods.sh b/scripts/objc-test-ios-cocoapods.sh new file mode 100755 index 00000000000000..fdef0d8eef34f5 --- /dev/null +++ b/scripts/objc-test-ios-cocoapods.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -ex + +# Script used to run iOS tests. +# If not arguments are passed to the script, it will only compile +# the RNTester. +# If the script is called with a single argument "test", we'll +# also run the RNTester integration test (needs JS and packager): +# ./objc-test-ios.sh test + +SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +ROOT=$(dirname "$SCRIPTS") + +cd "$ROOT" + +SCHEME="RNTester" +SDK="iphonesimulator" +DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.3.1" + +# If there's a "test" argument, pass it to the test script. +. ./scripts/objc-test.sh $1 workspace diff --git a/scripts/objc-test.sh b/scripts/objc-test.sh index 81614c5f6edffc..dca362e88be0da 100755 --- a/scripts/objc-test.sh +++ b/scripts/objc-test.sh @@ -12,6 +12,12 @@ set -ex SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT=$(dirname $SCRIPTS) +XCODE_PROJECT_PATH="RNTester/RNTester.xcodeproj" + +if [ "$2" = "workspace" ]; then + XCODE_PROJECT_PATH="RNTester/RNTester.xcodeproj" +fi + cd $ROOT # Create cleanup handler @@ -77,7 +83,7 @@ rm temp.bundle # the tests before running them. Switch back when this issue with xctool has # been resolved. xcodebuild \ - -project "RNTester/RNTester.xcodeproj" \ + -project $XCODE_PROJECT_PATH \ -scheme $SCHEME \ -sdk $SDK \ -destination "$DESTINATION" \ @@ -91,7 +97,7 @@ else # the tests before running them. Switch back when this issue with xctool has # been resolved. xcodebuild \ - -project "RNTester/RNTester.xcodeproj" \ + -project $XCODE_PROJECT_PATH \ -scheme $SCHEME \ -sdk $SDK \ build