Skip to content

Commit

Permalink
Migrating RNTester to Packages Directory (facebook#29567)
Browse files Browse the repository at this point in the history
Summary:
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
This PR aims to migrate the RNTester App to `packages` directory. But is currently, open to inspect the CI issues and resolve the merge conflicts.

Currently done
 - Working on iOS
 - Working on Android
 - Detox Tests working on iOS

Need to work on
 - Errors generated by the CI builds

[General] [Changed] - Migrated the RNTester App to the packages directory.

Pull Request resolved: facebook#29567

Test Plan: It runs on both ios and android for now and the detox iOS builds are working.

Reviewed By: cpojer

Differential Revision: D23034761

Pulled By: rickhanlonii

fbshipit-source-id: e04bb06e1c7ef15d340206090d1575a871b9e6f5
  • Loading branch information
sansyrox authored and facebook-github-bot committed Aug 20, 2020
1 parent f8e5423 commit 63992c0
Show file tree
Hide file tree
Showing 343 changed files with 213 additions and 174 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,17 @@ commands:
steps:
- run:
name: Setup CocoaPods cache
# Copy RNTester/Podfile.lock since it can be changed by pod install
command: cp RNTester/Podfile.lock RNTester/Podfile.lock.bak
# Copy packages/rn-tester/Podfile.lock since it can be changed by pod install
command: cp packages/rn-tester/Podfile.lock packages/rn-tester/Podfile.lock.bak
- restore_cache:
keys:
- v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }}
- v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}
- v1-pods-{{ .Environment.CIRCLE_JOB }}-
- steps: << parameters.steps >>
- save_cache:
paths:
- RNTester/Pods
key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }}
- packages/rn-tester/Pods
key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}

download_gradle_dependencies:
steps:
Expand Down Expand Up @@ -372,7 +372,7 @@ jobs:
- run_yarn

- run: |
cd RNTester
cd packages/rn-tester
bundle check || bundle install
- run:
name: Boot iPhone Simulator
Expand Down Expand Up @@ -419,11 +419,11 @@ jobs:
steps:
- run:
name: Generate RNTesterPods Workspace
command: cd RNTester && pod install --verbose
command: cd packages/rn-tester && pod install --verbose

- run:
name: Generate RNTesterPods Xcode Workspace
command: pushd RNTester && pod install --verbose && popd
command: pushd packages/rn-tester && pod install --verbose && popd

# -------------------------
# Runs iOS unit tests
Expand Down Expand Up @@ -535,7 +535,7 @@ jobs:

- run:
name: Assemble RNTester App
command: ./gradlew RNTester:android:app:assembleRelease
command: ./gradlew packages:rn-tester:android:app:assembleRelease

# -------------------------
# Run Android tests
Expand Down Expand Up @@ -668,7 +668,7 @@ jobs:
- run: echo "Failing tests may be moved here temporarily."
- run:
name: Android Build
command: ./gradlew.bat RNTester:android:app:assembleRelease
command: ./gradlew.bat packages:rn-tester:android:app:assembleRelease

# -------------------------
# JOBS: Coverage
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"**/__mocks__/**/*.js",
"**/__tests__/**/*.js",
"jest/**/*.js",
"RNTester/**/*.js",
"packages/rn-tester/**/*.js",
],
"globals": {
// Expose some Jest globals for test helpers
Expand Down
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ project.xcworkspace

# Gradle
/build/
/RNTester/android/app/build/
/RNTester/android/app/gradle/
/RNTester/android/app/gradlew
/RNTester/android/app/gradlew.bat
/packages/rn-tester/android/app/build/
/packages/rn-tester/android/app/gradle/
/packages/rn-tester/android/app/gradlew
/packages/rn-tester/android/app/gradlew.bat
/ReactAndroid/build/
/ReactAndroid/gradle/
/ReactAndroid/gradlew
Expand Down Expand Up @@ -75,7 +75,8 @@ package-lock.json

# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
RNTester/build
/packages/rn-tester/build
/packages/rn-tester/android/app/build/*

# Libs that shouldn't have Xcode project
/Libraries/FBLazyVector/**/*.xcodeproj
Expand All @@ -87,11 +88,11 @@ RNTester/build
# CocoaPods
/template/ios/Pods/
/template/ios/Podfile.lock
/RNTester/Gemfile.lock
/packages/rn-tester/Gemfile.lock

# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
RNTester/Pods/*
!RNTester/Pods/__offline_mirrors
/packages/rn-tester/Pods/*
!/packages/rn-tester/Pods/__offline_mirrors__

# react-native-codegen
/packages/react-native-codegen/lib
Expand Down
4 changes: 2 additions & 2 deletions bots/report-bundle-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function getFileSize(path) {
*/
function android_getApkSize(engine, arch) {
return getFileSize(
`RNTester/android/app/build/outputs/apk/${engine}/release/app-${engine}-${arch}-release.apk`,
`packages/rn-tester/android/app/build/outputs/apk/${engine}/release/app-${engine}-${arch}-release.apk`,
);
}

Expand Down Expand Up @@ -171,7 +171,7 @@ function report(target) {
reportSizeStats(
{
'ios-universal': getFileSize(
'RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/RNTester',
'packages/rn-tester/build/Build/Products/Release-iphonesimulator/RNTester.app/RNTester',
),
},
'\\| ios \\| - \\| universal \\|',
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
'/node_modules/',
'<rootDir>/template',
'Libraries/Renderer',
'RNTester/e2e',
'packages/rn-tester/e2e',
],
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
haste: {
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit",
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
"build-ios-e2e": "detox build -c ios.sim.release",
"test-ios-e2e": "detox test -c ios.sim.release RNTester/e2e",
"test-ios-e2e": "detox test -c ios.sim.release packages/rn-tester/e2e",
"test-ios": "./scripts/objc-test.sh test"
},
"workspaces": [
Expand Down Expand Up @@ -119,36 +119,36 @@
},
"detox": {
"test-runner": "jest",
"runner-config": "RNTester/e2e/config.json",
"runner-config": "packages/rn-tester/e2e/config.json",
"specs": "",
"configurations": {
"android.emu.release": {
"binaryPath": "RNTester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk",
"testBinaryPath": "RNTester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk",
"build": "./gradlew RNTester:android:app:assembleRelease RNTester:android:app:assembleAndroidTest -DtestBuildType=release",
"binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk",
"testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk",
"build": "./gradlew :packages:rn-tester:android:app:assembleRelease RNTester:android:app:assembleAndroidTest -DtestBuildType=release",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
},
"android.emu.debug": {
"binaryPath": "RNTester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk",
"testBinaryPath": "RNTester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk",
"build": "./gradlew RNTester:android:app:assembleDebug RNTester:android:app:assembleAndroidTest -DtestBuildType=debug",
"binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk",
"testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk",
"build": "./gradlew :packages:rn-tester:android:app:assembleDebug RNTester:android:app:assembleAndroidTest -DtestBuildType=debug",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
},
"ios.sim.release": {
"binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
"binaryPath": "packages/rn-tester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
"build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet",
"type": "ios.simulator",
"name": "iPhone 8"
},
"ios.sim.debug": {
"binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
"binaryPath": "packages/rn-tester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
"build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet",
"type": "ios.simulator",
"name": "iPhone 8"
}
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions packages/rn-tester/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")

yarn_workspace(
name = "yarn-workspace",
srcs = glob(
["**/*.js"],
exclude = [
"**/__fixtures__/**",
"**/__flowtests__/**",
"**/__mocks__/**",
"**/__server_snapshot_tests__/**",
"**/__tests__/**",
"**/node_modules/**",
"**/node_modules/.bin/**",
"**/.*",
"**/.*/**",
"**/.*/.*",
"**/*.xcodeproj/**",
"**/*.xcworkspace/**",
],
),
visibility = ["PUBLIC"],
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

'use strict';

import type {TurboModule} from '../../Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../Libraries/TurboModule/TurboModuleRegistry';
import type {TurboModule} from '../../../Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../../Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
+getConstants: () => {||};
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 7 additions & 6 deletions RNTester/Podfile → packages/rn-tester/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../scripts/react_native_pods'
require_relative '../../scripts/react_native_pods'

source 'https://cdn.cocoapods.org/'
platform :ios, '10.0'
Expand All @@ -12,12 +12,13 @@ def pods()
project 'RNTesterPods.xcodeproj'

# Enable TurboModule
use_react_native!(path: "..")
pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon'
prefix_path = "../.."
use_react_native!(path:prefix_path)
pod 'ReactCommon/turbomodule/samples', :path => "#{prefix_path}/ReactCommon"

# Additional Pods which aren't included in the default Podfile
pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS'
pod 'Yoga',:path => '../ReactCommon/yoga', :modular_headers => true
pod 'React-RCTPushNotification', :path => "#{prefix_path}/Libraries/PushNotificationIOS"
pod 'Yoga',:path => "#{prefix_path}/ReactCommon/yoga", :modular_headers => true
# Additional Pods which are classed as unstable
#
# To use fabric: add `fabric_enabled` option to the use_react_native method above, like below
Expand Down Expand Up @@ -56,7 +57,7 @@ def frameworks_pre_install(installer)
end

def codegen_pre_install(installer)
system("../scripts/generate-native-modules-specs.sh")
system("../../scripts/generate-native-modules-specs.sh")
end

pre_install do |installer|
Expand Down
Loading

0 comments on commit 63992c0

Please sign in to comment.