Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/test cocoapods integration #18091

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ node_modules

/coverage
/third-party
/RNTester/Pods
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem "cocoapods", "~> 1.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 */; };
Expand Down Expand Up @@ -157,7 +157,7 @@
1980B7311E80D21C004DC789 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = include/RCTAnimation;
dstPath = include/React;
dstSubfolderSpec = 16;
files = (
194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */,
Expand Down Expand Up @@ -204,7 +204,7 @@
13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStyleAnimatedNode.m; sourceTree = "<group>"; };
13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTTransformAnimatedNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTransformAnimatedNode.m; sourceTree = "<group>"; };
13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = "<group>"; };
13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTValueAnimatedNode.m; sourceTree = "<group>"; };
193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDiffClampAnimatedNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDiffClampAnimatedNode.m; sourceTree = "<group>"; };
Expand Down
2 changes: 1 addition & 1 deletion Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <Foundation/Foundation.h>

#import <RCTAnimation/RCTValueAnimatedNode.h>
#import "RCTValueAnimatedNode.h"
#import <React/RCTBridgeModule.h>
#import <React/RCTUIManager.h>

Expand Down
2 changes: 1 addition & 1 deletion Libraries/WebSocket/RCTReconnectingWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import <React/RCTConvert.h>
#import <React/RCTDefines.h>
#import <fishhook/fishhook.h>
#import "fishhook.h"

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
#import <os/log.h>
Expand Down
51 changes: 51 additions & 0 deletions RNTester/Podfile
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ReactCommon/yoga/yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions scripts/objc-test-ios-cocoapods-install.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions scripts/objc-test-ios-cocoapods.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" \
Expand All @@ -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
Expand Down