Skip to content

Commit 63992c0

Browse files
sansyroxfacebook-github-bot
authored andcommitted
Migrating RNTester to Packages Directory (facebook#29567)
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
1 parent f8e5423 commit 63992c0

File tree

343 files changed

+213
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

343 files changed

+213
-174
lines changed

.circleci/config.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ commands:
148148
steps:
149149
- run:
150150
name: Setup CocoaPods cache
151-
# Copy RNTester/Podfile.lock since it can be changed by pod install
152-
command: cp RNTester/Podfile.lock RNTester/Podfile.lock.bak
151+
# Copy packages/rn-tester/Podfile.lock since it can be changed by pod install
152+
command: cp packages/rn-tester/Podfile.lock packages/rn-tester/Podfile.lock.bak
153153
- restore_cache:
154154
keys:
155-
- v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }}
155+
- v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}
156156
- v1-pods-{{ .Environment.CIRCLE_JOB }}-
157157
- steps: << parameters.steps >>
158158
- save_cache:
159159
paths:
160-
- RNTester/Pods
161-
key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }}
160+
- packages/rn-tester/Pods
161+
key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}
162162

163163
download_gradle_dependencies:
164164
steps:
@@ -372,7 +372,7 @@ jobs:
372372
- run_yarn
373373

374374
- run: |
375-
cd RNTester
375+
cd packages/rn-tester
376376
bundle check || bundle install
377377
- run:
378378
name: Boot iPhone Simulator
@@ -419,11 +419,11 @@ jobs:
419419
steps:
420420
- run:
421421
name: Generate RNTesterPods Workspace
422-
command: cd RNTester && pod install --verbose
422+
command: cd packages/rn-tester && pod install --verbose
423423

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

428428
# -------------------------
429429
# Runs iOS unit tests
@@ -535,7 +535,7 @@ jobs:
535535

536536
- run:
537537
name: Assemble RNTester App
538-
command: ./gradlew RNTester:android:app:assembleRelease
538+
command: ./gradlew packages:rn-tester:android:app:assembleRelease
539539

540540
# -------------------------
541541
# Run Android tests
@@ -668,7 +668,7 @@ jobs:
668668
- run: echo "Failing tests may be moved here temporarily."
669669
- run:
670670
name: Android Build
671-
command: ./gradlew.bat RNTester:android:app:assembleRelease
671+
command: ./gradlew.bat packages:rn-tester:android:app:assembleRelease
672672

673673
# -------------------------
674674
# JOBS: Coverage

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"**/__mocks__/**/*.js",
2323
"**/__tests__/**/*.js",
2424
"jest/**/*.js",
25-
"RNTester/**/*.js",
25+
"packages/rn-tester/**/*.js",
2626
],
2727
"globals": {
2828
// Expose some Jest globals for test helpers

.gitignore

+9-8
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ project.xcworkspace
2323

2424
# Gradle
2525
/build/
26-
/RNTester/android/app/build/
27-
/RNTester/android/app/gradle/
28-
/RNTester/android/app/gradlew
29-
/RNTester/android/app/gradlew.bat
26+
/packages/rn-tester/android/app/build/
27+
/packages/rn-tester/android/app/gradle/
28+
/packages/rn-tester/android/app/gradlew
29+
/packages/rn-tester/android/app/gradlew.bat
3030
/ReactAndroid/build/
3131
/ReactAndroid/gradle/
3232
/ReactAndroid/gradlew
@@ -75,7 +75,8 @@ package-lock.json
7575

7676
# ReactCommon subdir shouldn't have Xcode project
7777
/ReactCommon/**/*.xcodeproj
78-
RNTester/build
78+
/packages/rn-tester/build
79+
/packages/rn-tester/android/app/build/*
7980

8081
# Libs that shouldn't have Xcode project
8182
/Libraries/FBLazyVector/**/*.xcodeproj
@@ -87,11 +88,11 @@ RNTester/build
8788
# CocoaPods
8889
/template/ios/Pods/
8990
/template/ios/Podfile.lock
90-
/RNTester/Gemfile.lock
91+
/packages/rn-tester/Gemfile.lock
9192

9293
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
93-
RNTester/Pods/*
94-
!RNTester/Pods/__offline_mirrors
94+
/packages/rn-tester/Pods/*
95+
!/packages/rn-tester/Pods/__offline_mirrors__
9596

9697
# react-native-codegen
9798
/packages/react-native-codegen/lib

bots/report-bundle-size.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function getFileSize(path) {
138138
*/
139139
function android_getApkSize(engine, arch) {
140140
return getFileSize(
141-
`RNTester/android/app/build/outputs/apk/${engine}/release/app-${engine}-${arch}-release.apk`,
141+
`packages/rn-tester/android/app/build/outputs/apk/${engine}/release/app-${engine}-${arch}-release.apk`,
142142
);
143143
}
144144

@@ -171,7 +171,7 @@ function report(target) {
171171
reportSizeStats(
172172
{
173173
'ios-universal': getFileSize(
174-
'RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/RNTester',
174+
'packages/rn-tester/build/Build/Products/Release-iphonesimulator/RNTester.app/RNTester',
175175
),
176176
},
177177
'\\| ios \\| - \\| universal \\|',

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
'/node_modules/',
2323
'<rootDir>/template',
2424
'Libraries/Renderer',
25-
'RNTester/e2e',
25+
'packages/rn-tester/e2e',
2626
],
2727
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
2828
haste: {

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit",
7575
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
7676
"build-ios-e2e": "detox build -c ios.sim.release",
77-
"test-ios-e2e": "detox test -c ios.sim.release RNTester/e2e",
77+
"test-ios-e2e": "detox test -c ios.sim.release packages/rn-tester/e2e",
7878
"test-ios": "./scripts/objc-test.sh test"
7979
},
8080
"workspaces": [
@@ -119,36 +119,36 @@
119119
},
120120
"detox": {
121121
"test-runner": "jest",
122-
"runner-config": "RNTester/e2e/config.json",
122+
"runner-config": "packages/rn-tester/e2e/config.json",
123123
"specs": "",
124124
"configurations": {
125125
"android.emu.release": {
126-
"binaryPath": "RNTester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk",
127-
"testBinaryPath": "RNTester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk",
128-
"build": "./gradlew RNTester:android:app:assembleRelease RNTester:android:app:assembleAndroidTest -DtestBuildType=release",
126+
"binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk",
127+
"testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk",
128+
"build": "./gradlew :packages:rn-tester:android:app:assembleRelease RNTester:android:app:assembleAndroidTest -DtestBuildType=release",
129129
"type": "android.emulator",
130130
"device": {
131131
"avdName": "Nexus_6_API_29"
132132
}
133133
},
134134
"android.emu.debug": {
135-
"binaryPath": "RNTester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk",
136-
"testBinaryPath": "RNTester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk",
137-
"build": "./gradlew RNTester:android:app:assembleDebug RNTester:android:app:assembleAndroidTest -DtestBuildType=debug",
135+
"binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk",
136+
"testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk",
137+
"build": "./gradlew :packages:rn-tester:android:app:assembleDebug RNTester:android:app:assembleAndroidTest -DtestBuildType=debug",
138138
"type": "android.emulator",
139139
"device": {
140140
"avdName": "Nexus_6_API_29"
141141
}
142142
},
143143
"ios.sim.release": {
144-
"binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
145-
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
144+
"binaryPath": "packages/rn-tester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
145+
"build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet",
146146
"type": "ios.simulator",
147147
"name": "iPhone 8"
148148
},
149149
"ios.sim.debug": {
150-
"binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
151-
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
150+
"binaryPath": "packages/rn-tester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
151+
"build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet",
152152
"type": "ios.simulator",
153153
"name": "iPhone 8"
154154
}
File renamed without changes.

packages/rn-tester/BUCK

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")
2+
3+
yarn_workspace(
4+
name = "yarn-workspace",
5+
srcs = glob(
6+
["**/*.js"],
7+
exclude = [
8+
"**/__fixtures__/**",
9+
"**/__flowtests__/**",
10+
"**/__mocks__/**",
11+
"**/__server_snapshot_tests__/**",
12+
"**/__tests__/**",
13+
"**/node_modules/**",
14+
"**/node_modules/.bin/**",
15+
"**/.*",
16+
"**/.*/**",
17+
"**/.*/.*",
18+
"**/*.xcodeproj/**",
19+
"**/*.xcworkspace/**",
20+
],
21+
),
22+
visibility = ["PUBLIC"],
23+
)
File renamed without changes.

RNTester/NativeModuleExample/NativeScreenshotManager.js packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
'use strict';
1212

13-
import type {TurboModule} from '../../Libraries/TurboModule/RCTExport';
14-
import * as TurboModuleRegistry from '../../Libraries/TurboModule/TurboModuleRegistry';
13+
import type {TurboModule} from '../../../Libraries/TurboModule/RCTExport';
14+
import * as TurboModuleRegistry from '../../../Libraries/TurboModule/TurboModuleRegistry';
1515

1616
export interface Spec extends TurboModule {
1717
+getConstants: () => {||};

RNTester/Podfile packages/rn-tester/Podfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative '../scripts/react_native_pods'
1+
require_relative '../../scripts/react_native_pods'
22

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

1414
# Enable TurboModule
15-
use_react_native!(path: "..")
16-
pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon'
15+
prefix_path = "../.."
16+
use_react_native!(path:prefix_path)
17+
pod 'ReactCommon/turbomodule/samples', :path => "#{prefix_path}/ReactCommon"
1718

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

5859
def codegen_pre_install(installer)
59-
system("../scripts/generate-native-modules-specs.sh")
60+
system("../../scripts/generate-native-modules-specs.sh")
6061
end
6162

6263
pre_install do |installer|

0 commit comments

Comments
 (0)