diff --git a/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm b/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm index 5ef8d583ff9107..549e41a9b91b5f 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm @@ -12,9 +12,7 @@ @implementation RCTLegacyInteropComponents + (NSArray *)legacyInteropComponents { - return @[ - @"RNTMyLegacyNativeView" - ]; + return @[ @"RNTMyLegacyNativeView" ]; } @end diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index fd5795848269a0..b595f3ccdc18c0 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -3,6 +3,13 @@ PODS: - CocoaAsyncSocket (7.6.5) - DoubleConversion (1.1.6) - FBLazyVector (1000.0.0) + - FBReactNativeSpec (1000.0.0): + - RCT-Folly (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-Core (= 1000.0.0) + - React-jsi (= 1000.0.0) + - ReactCommon/turbomodule/core (= 1000.0.0) - Flipper (0.182.0): - Flipper-Folly (~> 2.6) - Flipper-Boost-iOSX (1.76.0.1.11) @@ -71,40 +78,6 @@ PODS: - hermes-engine/JSI (1000.0.0) - hermes-engine/Public (1000.0.0) - libevent (2.1.12) - - MyNativeView (0.0.1): - - glog - - hermes-engine - - RCT-Folly (= 2021.07.22.00) - - RCTRequired - - RCTTypeSafety - - React-Codegen - - React-Core - - React-debug - - React-Fabric - - React-graphics - - React-NativeModulesApple - - React-RCTFabric - - React-utils - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - Yoga - - NativeCxxModuleExample (0.0.1): - - glog - - hermes-engine - - RCT-Folly (= 2021.07.22.00) - - RCTRequired - - RCTTypeSafety - - React-Codegen - - React-Core - - React-debug - - React-Fabric - - React-graphics - - React-NativeModulesApple - - React-RCTFabric - - React-utils - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - Yoga - OCMock (3.9.1) - OpenSSL-Universal (1.1.1100) - RCT-Folly (2021.07.22.00): @@ -150,6 +123,7 @@ PODS: - React-callinvoker (1000.0.0) - React-Codegen (1000.0.0): - DoubleConversion + - FBReactNativeSpec - glog - hermes-engine - RCT-Folly @@ -162,6 +136,7 @@ PODS: - React-jsi - React-jsiexecutor - React-NativeModulesApple + - React-rncore - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core @@ -925,7 +900,6 @@ PODS: - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - React-logger - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - Yoga - React-graphics (1000.0.0): @@ -994,15 +968,10 @@ PODS: - RCTTypeSafety - React-Core - React-CoreModules - - React-debug - - React-Fabric - - React-graphics - React-hermes - React-NativeModulesApple - - React-RCTFabric - React-RCTImage - React-RCTNetwork - - React-utils - ReactCommon/turbomodule/core - React-RCTBlob (1000.0.0): - hermes-engine @@ -1112,21 +1081,8 @@ PODS: - React-perflogger (= 1000.0.0) - ScreenshotManager (0.0.1): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - - RCTRequired - - RCTTypeSafety - - React-Codegen - React-Core - - React-debug - - React-Fabric - - React-graphics - - React-NativeModulesApple - - React-RCTFabric - - React-utils - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - Yoga - SocketRocket (0.6.0) - Yoga (1.14.0) - YogaKit (1.18.1): @@ -1136,6 +1092,7 @@ DEPENDENCIES: - boost (from `../react-native/third-party-podspecs/boost.podspec`) - DoubleConversion (from `../react-native/third-party-podspecs/DoubleConversion.podspec`) - FBLazyVector (from `../react-native/Libraries/FBLazyVector`) + - FBReactNativeSpec (from `../react-native/React/FBReactNativeSpec`) - Flipper (= 0.182.0) - Flipper-Boost-iOSX (= 1.76.0.1.11) - Flipper-DoubleConversion (= 3.2.0.1) @@ -1159,8 +1116,6 @@ DEPENDENCIES: - glog (from `../react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../react-native/sdks/hermes-engine/hermes-engine.podspec`) - libevent (~> 2.1.12) - - MyNativeView (from `NativeComponentExample`) - - NativeCxxModuleExample (from `NativeCxxModuleExample`) - OCMock (~> 3.9.1) - OpenSSL-Universal (= 1.1.1100) - RCT-Folly (from `../react-native/third-party-podspecs/RCT-Folly.podspec`) @@ -1233,15 +1188,13 @@ EXTERNAL SOURCES: :podspec: "../react-native/third-party-podspecs/DoubleConversion.podspec" FBLazyVector: :path: "../react-native/Libraries/FBLazyVector" + FBReactNativeSpec: + :path: "../react-native/React/FBReactNativeSpec" glog: :podspec: "../react-native/third-party-podspecs/glog.podspec" hermes-engine: :podspec: "../react-native/sdks/hermes-engine/hermes-engine.podspec" :tag: '' - MyNativeView: - :path: NativeComponentExample - NativeCxxModuleExample: - :path: NativeCxxModuleExample RCT-Folly: :podspec: "../react-native/third-party-podspecs/RCT-Folly.podspec" RCTRequired: @@ -1329,7 +1282,8 @@ SPEC CHECKSUMS: boost: 57d2868c099736d80fcd648bf211b4431e51a558 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 - FBLazyVector: 8eb2e2d89cd6c6feda3f99deb360de3cedbefdbc + FBLazyVector: f4492a543c5a8fa1502d3a5867e3f7252497cfe8 + FBReactNativeSpec: 7a256eec25705f77ac6d6c6187ec2d89a180fa6c Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 @@ -1340,54 +1294,52 @@ SPEC CHECKSUMS: FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 99bd064df01718db56b8f75e6b5ea3051c7dad0a - hermes-engine: 4ea4b12e82d2ccfd03b29e3d9191b716b4c8f476 + hermes-engine: 3d4707423e276e19d41573fc74ac39cf57c56b17 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - MyNativeView: cb2f1f136719eea7b8cb6f0974ae78b3729e21bb - NativeCxxModuleExample: 7d581c85667a446c17b7d09bf9a980d093f7a711 OCMock: 9491e4bec59e0b267d52a9184ff5605995e74be8 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c RCT-Folly: b0d1393cb3763d71efca99db314c65f0072eb0fe - RCTRequired: 1ec30aab83a578ad913d2c3db0d8864abffcc101 - RCTTypeSafety: 76ee5ef0dc7cc5bf228a383dcaf491cf8dc0b1d1 - React: b00d13dc8c46b186f9c222ca7b7fe0176d695097 - React-callinvoker: a43dfeaccffdb31a34beb90e00e17dd6c1f35ecb - React-Codegen: 01bcf81f8b84f5d2f960612c07276b716869024b - React-Core: ed526fb6d76e4bade80f401b56a98273652b68ea - React-CoreModules: 3896c3ad50019c5d5724801b73196ba79e39b9a7 - React-cxxreact: 99b737e08ac1c71b97464efa59ef09f5792628a5 - React-debug: cb43fe8df78495a7062887a16cbbf8a3a50b368e - React-Fabric: f462f339646844f43e99acdc199a589816f58642 - React-FabricImage: 4e6caa059ec2f05812fa4f8fc798cb7965aae581 - React-graphics: f1d305958d1bb2f81809fbb1be2024e4335e6282 - React-hermes: 79ea9681bc3eca757c3ff6bb306e5293898f119a - React-ImageManager: e131315c5602a7c154b849a7263274a1cdf3c5db - React-jsi: 5abc3a8ed39d25bc480e9143ec1dd5f817038691 - React-jsiexecutor: e964be7d39c11e1c40bd59a2cdd3165b5850b33e - React-jsinspector: 5dc2d561e38d0d56f386d6fe40c57763f0a92c02 - React-logger: 7d5d24cf7c1f27a7cd2a393f96de6ebb70e73b1d - React-NativeModulesApple: c4da909641fc96131970b56e6b2c4e7dd93bcfb6 - React-perflogger: 142ef16d7e7006f0c1b20e51b38f29afd177fb57 - React-RCTActionSheet: b331b30d8a9a52cf146a18a04e1aa82c033b3d49 - React-RCTAnimation: 2f4c5b7b960a2e0119f73f69a7c991fffb118ce5 - React-RCTAppDelegate: 6b42bb52aaf0387dd3e0b72e99b4260c78cb82a8 - React-RCTBlob: 314bedb3b837af1866421656d447b93bca001d3b - React-RCTFabric: f69e1b8a28277e302636a6522556a6e15dc0cef3 - React-RCTImage: 3f84437e51736bc2da439521eb66f6965ea8a46e - React-RCTLinking: e48d2f6a4bec4cfb47b4683bd420cdfdf41b96f4 - React-RCTNetwork: f2c8d59c79f4c13ca52289ace7d5c0fd606d88e2 - React-RCTPushNotification: 7e5091642a30e242a0a2123f3a5e7c186a4ebb6e - React-RCTSettings: 37f176122b8d0c2acef97d875afcc61db027b083 - React-RCTTest: fd2d3d99c35f3feaa1329a1bfb1b381996f2e3d2 - React-RCTText: 2731e1fb0cd2c769841e9001605a04b103cb4d0f - React-RCTVibration: 1e0c469143c6a9b15f8ec28a9c4944c1df919c95 - React-rncore: 928e8fca664a49a3aed82a56f1a253ad9fe55c34 - React-runtimeexecutor: 0d7d45462087b3c9fcfcafa9239478b3e680f3e0 - React-utils: ad76b21e7f4b9b1d4fb7fd998fd749c7c3285048 - ReactCommon: 90b071698fe9c0f2df6d6d92b8a762442a7e7016 - ReactCommon-Samples: 2918b144544a51cac1b7b76b068fd6f10237c659 - ScreenshotManager: 529c80993e4923e724119c4cc7861e552334224e + RCTRequired: 82c56a03b3efd524bfdb581a906add903f78f978 + RCTTypeSafety: 034ade4e3b36be976b8378f825ccadbe104fa852 + React: cb6dc75e09f32aeddb4d8fb58a394a67219a92fe + React-callinvoker: bae59cbd6affd712bbfc703839dad868ff35069d + React-Codegen: 42dae0c7801d765934f76cfbaefcb5742524cc98 + React-Core: b04375fb8581bb80b6c87c25061a1998c61b0006 + React-CoreModules: fa9b32bbc7818672a7ca91eeef4867e133b566ec + React-cxxreact: 21b73aa1e245d6c701e62150312c3748756bbf42 + React-debug: d1cd203242675d48eecec6c2553933c0e0a3874f + React-Fabric: e85af38574589ce0d1a353623ecda0f94435da16 + React-FabricImage: 8552a7e0919bc2ab09c6869a7507ad7a46e552d9 + React-graphics: a85048af7e210ec4fed185ef201726f7b4825cc0 + React-hermes: fa4837e1d1e55f462ad3e485794056189b495d7e + React-ImageManager: 528eb68fe16f08d4c76cd32949e6bcd9e4aeae4b + React-jsi: ae20bc6ced4999f64acc5163cbfa67f878f346f4 + React-jsiexecutor: 754993beb8627912e5b25344cad02ed11a616d9f + React-jsinspector: bede0a6ac88f2463eafc1301239fe943adf06fa7 + React-logger: c20eb15d006d5c303cf6bfbb11243c8d579d9f56 + React-NativeModulesApple: 518f3f3d2d9e4944f99df30e601f8774d1fa1663 + React-perflogger: c294d51cfc18b90caa1604ef3a0fe2dd76b9e15e + React-RCTActionSheet: 943bd5f540f3af1e5a149c13c4de81858edf718a + React-RCTAnimation: a430a8c32e7947b7b014f7bd1ef6825168ad4841 + React-RCTAppDelegate: c847ea72bc6fd48b7b6693755c232a3cecbbc970 + React-RCTBlob: 9de0f88a876429c31b96b63975173c60978b5586 + React-RCTFabric: 911e88ea1b9f0b083b1502fb8dabda0a68142d42 + React-RCTImage: 8addd5fae983149d4506fbf8b36be30585adadf4 + React-RCTLinking: aec004e7f55b71be0f68913b1d993964fc8013e1 + React-RCTNetwork: 67229afd0642c55d4493cad5129238a7a1599441 + React-RCTPushNotification: 9e4bba7bb3a4682281216a81f3342caecf84cef7 + React-RCTSettings: 9b6f5a70aa3b859b2686794c3441e278b4f6e0a6 + React-RCTTest: d4004e03f9e5ca2607eb05bee5a0618b189a127a + React-RCTText: 6d0a9927391dc26325c2edf60ef7d36f637e709c + React-RCTVibration: ae65884c71d67f356396d6fcc44eec48b5afef70 + React-rncore: fe8c75a4beb121d0f923f0a45a17910083ccb681 + React-runtimeexecutor: e1c32bc249dd3cf3919cb4664fd8dc84ef70cff7 + React-utils: 2c3b06a36a63d6fce240ac5cb1de003b95222810 + ReactCommon: de6e7a92ad50207b08bcf696a61d9b509876e131 + ReactCommon-Samples: 13b7118480fb9abeee8a98bc1cceff06984cfde4 + ScreenshotManager: d39b964a374e5012e2b8c143e29ead86b1da6a3c SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 - Yoga: 076fc03a42d8cdec9de1c68f00216d54548adc81 + Yoga: 239f77be94241af2a02e7018fe6165a715bc25f1 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: e220946495183a79874329aff76ec197027be224 diff --git a/scripts/test-e2e-local-clean.js b/scripts/test-e2e-local-clean.js index 462afa78f792c2..f2b7d87f206477 100644 --- a/scripts/test-e2e-local-clean.js +++ b/scripts/test-e2e-local-clean.js @@ -44,7 +44,8 @@ if (isPackagerRunning() === 'running') { console.info('\n** Cleaning Gradle build artifacts **\n'); exec('./gradlew clean'); exec('rm -rf /tmp/maven-local'); -exec('rm -rf /tmp/hermes-ios-debug.tar.gz'); +exec('rm -rf /tmp/maven-local.zip'); +exec('rm -rf /tmp/rntester.apk'); // iOS console.info('\n** Nuking the derived data folder **\n'); @@ -52,17 +53,16 @@ exec('rm -rf ~/Library/Developer/Xcode/DerivedData'); console.info('\n** Removing the hermes-engine pod cache **\n'); exec('rm -rf ~/Library/Caches/CocoaPods/Pods/External/hermes-engine'); +exec('rm -rf /tmp/hermes-ios-debug.tar.gz'); // RNTester Pods console.info('\n** Removing the RNTester Pods **\n'); exec('rm -rf packages/rn-tester/Pods'); -// I'm not sure we want to also remove the lock file -// exec('rm -rf packages/rn-tester/Podfile.lock'); - // RNTestProject console.info('\n** Removing the RNTestProject folder **\n'); exec('rm -rf /tmp/RNTestProject'); +exec('rm -rf /tmp/packaged-react-native.tar.gz'); // final clean up console.info('\n** Final git level wipe **\n'); diff --git a/scripts/test-e2e-local.js b/scripts/test-e2e-local.js index 1a6a8ddd5e516c..c06ea65f73216c 100644 --- a/scripts/test-e2e-local.js +++ b/scripts/test-e2e-local.js @@ -16,10 +16,9 @@ * and to make it more accessible for other devs to play around with. */ -const {exec, exit, pushd, popd, pwd, cd, cp} = require('shelljs'); +const {exec, pushd, popd, pwd, cd} = require('shelljs'); const updateTemplatePackage = require('../scripts/update-template-package'); const yargs = require('yargs'); -const fs = require('fs'); const { maybeLaunchAndroidEmulator, @@ -28,15 +27,6 @@ const { CircleCIArtifacts, } = require('./testing-utils'); -const { - generateAndroidArtifacts, - generateiOSArtifacts, -} = require('./release-utils'); - -const { - downloadHermesSourceTarball, - expandHermesSourceTarball, -} = require('react-native/scripts/hermes/hermes-utils.js'); const argv = yargs .option('t', { @@ -60,10 +50,10 @@ const argv = yargs required: true, }).argv; -async function main () { +async function main() { /* - * see the test-local-e2e.js script for clean up process - */ + * see the test-local-e2e.js script for clean up process + */ // command order: we ask the user to select if they want to test RN tester // or RNTestProject @@ -73,19 +63,19 @@ async function main () { // let's check if Metro is already running, if it is let's kill it and start fresh if (isPackagerRunning() === 'running') { - exec("lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill"); + exec( + "lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill", + ); } - const branchName = "0.72-stable" - /*exec('git rev-parse --abbrev-ref HEAD', { - silent: true, - }) - .stdout.trim(); - */ + const branchName = exec('git rev-parse --abbrev-ref HEAD', { + silent: true, + }).stdout.trim(); + const onReleaseBranch = branchName.endsWith('-stable'); const circleCIArtifacts = new CircleCIArtifacts(argv.circleciToken); - await circleCIArtifacts.initialize(branchName) + await circleCIArtifacts.initialize(branchName); if (argv.target === 'RNTester') { // FIXME: make sure that the commands retains colors @@ -100,7 +90,6 @@ async function main () { } version of RNTester iOS with the new Architecture enabled`, ); - // remember that for this to be successful // you should have run bundle install once // in your local setup @@ -113,20 +102,23 @@ async function main () { // download hermes source code from manifold circleCIArtifacts.downloadArtifact(hermesURL, hermesPath); console.info(`Downloaded Hermes in ${hermesPath}`); - exec(`HERMES_ENGINE_TARBALL_PATH=${hermesPath} RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi`) + exec( + `HERMES_ENGINE_TARBALL_PATH=${hermesPath} RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi`, + ); } else { exec( `USE_HERMES=0 CI=${onReleaseBranch} RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --ansi`, ); } - // if everything succeeded so far, we can launch Metro and the app // start the Metro server in a separate window launchPackagerInSeparateWindow(pwd()); // launch the app on iOS simulator - exec('npx react-native run-ios --scheme RNTester --simulator "iPhone 14"'); + exec( + 'npx react-native run-ios --scheme RNTester --simulator "iPhone 14"', + ); } else { // we do the android path here @@ -138,16 +130,16 @@ async function main () { } version of RNTester Android with the new Architecture enabled`, ); - const downloadPath = "/tmp/rntester.apk"; + const downloadPath = '/tmp/rntester.apk'; - const rntesterAPKURL = argv.hermes ? - await circleCIArtifacts.artifactURLForHermesRNTesterAPK() : - await circleCIArtifacts.artifactURLForJSCRNTesterAPK() + const rntesterAPKURL = argv.hermes + ? await circleCIArtifacts.artifactURLForHermesRNTesterAPK() + : await circleCIArtifacts.artifactURLForJSCRNTesterAPK(); - console.info("Start Downloading APK"); + console.info('Start Downloading APK'); circleCIArtifacts.downloadArtifact(rntesterAPKURL, downloadPath); - exec(`adb install ${downloadPath}`) + exec(`adb install ${downloadPath}`); // launch the app on Android simulator // TODO: we should find a way to make it work like for iOS, via npx react-native run-android @@ -174,11 +166,12 @@ async function main () { // base setup required (specular to publish-npm.js) // we need to add the unique timestamp to avoid npm/yarn to use some local caches - const baseVersion = require('../packages/react-native/package.json').version; + const baseVersion = + require('../packages/react-native/package.json').version; - // in local testing, 1000.0.0 mean we are on main, every other case means we are - // working on a release version - const buildType = baseVersion !== '1000.0.0' ? 'release' : 'dry-run'; + // // in local testing, 1000.0.0 mean we are on main, every other case means we are + // // working on a release version + // const buildType = baseVersion !== '1000.0.0' ? 'release' : 'dry-run'; const dateIdentifier = new Date() .toISOString() @@ -188,56 +181,33 @@ async function main () { const releaseVersion = `${baseVersion}-${dateIdentifier}`; - // this is needed to generate the Android artifacts correctly - const exitCode = exec( - `node scripts/set-rn-version.js --to-version ${releaseVersion} --build-type ${buildType}`, - ).code; - - if (exitCode !== 0) { - console.error( - `Failed to set the RN version. Version ${releaseVersion} is not valid for ${buildType}`, - ); - process.exit(exitCode); - } - // Generate native files for Android - generateAndroidArtifacts(releaseVersion); + // generateAndroidArtifacts(releaseVersion); + const mavenLocalURL = await circleCIArtifacts.artifactURLForMavenLocal(); + const packagedReactNativeURL = + await circleCIArtifacts.artifactURLForPackagedReactNative(); + const hermesURL = await circleCIArtifacts.artifactURLHermesDebug(); + + const mavenLocalPath = '/tmp/maven-local.zip'; + const packagedReactNativePath = '/tmp/packaged-react-native.tar.gz'; + const hermesPath = '/tmp/hermes-ios-debug.tar.gz'; + + console.info('[Download] Maven Local Artifacts'); + circleCIArtifacts.downloadArtifact(mavenLocalURL, mavenLocalPath); + console.info('[Download] Packaged React Native'); + circleCIArtifacts.downloadArtifact( + packagedReactNativeURL, + packagedReactNativePath, + ); + console.info('[Download] Hermes'); + circleCIArtifacts.downloadArtifact(hermesURL, hermesPath); // Setting up generating native iOS (will be done later) const repoRoot = pwd(); const reactNativePackagePath = `${repoRoot}/packages/react-native`; - const jsiFolder = `${reactNativePackagePath}/ReactCommon/jsi`; - const hermesCoreSourceFolder = `${reactNativePackagePath}/sdks/hermes`; - - if (!fs.existsSync(hermesCoreSourceFolder)) { - console.info('The Hermes source folder is missing. Downloading...'); - downloadHermesSourceTarball(); - expandHermesSourceTarball(); - } - - // need to move the scripts inside the local hermes cloned folder - // cp sdks/hermes-engine/utils/*.sh /utils/. - cp( - `${reactNativePackagePath}/sdks/hermes-engine/utils/*.sh`, - `${reactNativePackagePath}/sdks/hermes/utils/.`, - ); - - // for this scenario, we only need to create the debug build - // (env variable PRODUCTION defines that podspec side) - const buildTypeiOSArtifacts = 'Debug'; - - // the android ones get set into /private/tmp/maven-local - const localMavenPath = '/private/tmp/maven-local'; - - // Generate native files for iOS - const tarballOutputPath = generateiOSArtifacts( - jsiFolder, - hermesCoreSourceFolder, - buildTypeiOSArtifacts, - localMavenPath, - ); const localNodeTGZPath = `${reactNativePackagePath}/react-native-${releaseVersion}.tgz`; + exec(`cp ${packagedReactNativePath} ${localNodeTGZPath}`); updateTemplatePackage({ 'react-native': `file:${localNodeTGZPath}`, }); @@ -252,18 +222,20 @@ async function main () { ); cd('RNTestProject'); + + // TODO: test whether that's works. On the local test it doesn't, but I'm forcing a version which is weird. exec('yarn install'); // need to do this here so that Android will be properly setup either way exec( - 'echo "REACT_NATIVE_MAVEN_LOCAL_REPO=/private/tmp/maven-local" >> android/gradle.properties', + `echo "REACT_NATIVE_MAVEN_LOCAL_REPO=${mavenLocalPath}" >> android/gradle.properties`, ); // doing the pod install here so that it's easier to play around RNTestProject cd('ios'); exec('bundle install'); exec( - `HERMES_ENGINE_TARBALL_PATH=${tarballOutputPath} USE_HERMES=${ + `HERMES_ENGINE_TARBALL_PATH=${hermesPath} USE_HERMES=${ argv.hermes ? 1 : 0 } bundle exec pod install --ansi`, ); @@ -281,4 +253,3 @@ async function main () { } main(); -// exit(0); diff --git a/scripts/testing-utils.js b/scripts/testing-utils.js index e7d089a7d21d7a..27c962ef50af98 100644 --- a/scripts/testing-utils.js +++ b/scripts/testing-utils.js @@ -13,7 +13,7 @@ const {exec} = require('shelljs'); const os = require('os'); const {spawn} = require('node:child_process'); -const util = require('util') +const util = require('util'); const asyncRequest = require('request'); const request = util.promisify(asyncRequest); @@ -132,15 +132,17 @@ class CircleCIArtifacts { } async initialize(branchName) { - console.info(`Getting CircleCI infoes`); + console.info('Getting CircleCI infoes'); const pipeline = await this.#getLastCircleCIPipelineID(branchName); - const packageAndReleaseWorkflow = await this.#getPackageAndReleaseWorkflow(pipeline.id); + const packageAndReleaseWorkflow = await this.#getPackageAndReleaseWorkflow( + pipeline.id, + ); this.#throwIfPendingOrUnsuccessfulWorkflow(packageAndReleaseWorkflow); const testsWorkflow = await this.#getTestsWorkflow(pipeline.id); this.#throwIfPendingOrUnsuccessfulWorkflow(testsWorkflow); const jobsPromises = [ this.#getCircleCIJobs(packageAndReleaseWorkflow.id), - this.#getCircleCIJobs(testsWorkflow.id) + this.#getCircleCIJobs(testsWorkflow.id), ]; const jobsResults = await Promise.all(jobsPromises); @@ -150,7 +152,9 @@ class CircleCIArtifacts { async #throwIfPendingOrUnsuccessfulWorkflow(workflow) { if (workflow.status !== 'success') { - throw new Error(`The ${workflow.name} workflow status is ${workflow.status}. Please, wait for it to be finished before start testing or fix it`); + throw new Error( + `The ${workflow.name} workflow status is ${workflow.status}. Please, wait for it to be finished before start testing or fix it`, + ); } } @@ -159,96 +163,114 @@ class CircleCIArtifacts { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/facebook/react-native/pipeline', qs: { - 'branch': branchName + branch: branchName, }, - headers: this.circleCIHeaders + headers: this.circleCIHeaders, }; const response = await request(options); - if (response.error) throw new Error(error); + if (response.error) { throw new Error(error); } - const lastPipeline = JSON.parse(response.body).items[0] - return { id: lastPipeline.id, number: lastPipeline.number }; + const lastPipeline = JSON.parse(response.body).items[0]; + return {id: lastPipeline.id, number: lastPipeline.number}; } async #getSpecificWorkflow(pipelineId, workflowName) { const options = { method: 'GET', url: `https://circleci.com/api/v2/pipeline/${pipelineId}/workflow`, - headers: this.circleCIHeaders + headers: this.circleCIHeaders, }; const response = await request(options); - if (response.error) throw new Error(error); + if (response.error) { throw new Error(error); } const body = JSON.parse(response.body); return body.items.find(workflow => workflow.name === workflowName); } - async #getPackageAndReleaseWorkflow(pipelineId){ - return this.#getSpecificWorkflow(pipelineId, 'package_and_publish_release_dryrun'); + async #getPackageAndReleaseWorkflow(pipelineId) { + return this.#getSpecificWorkflow( + pipelineId, + 'package_and_publish_release_dryrun', + ); } - async #getTestsWorkflow(pipelineId){ + async #getTestsWorkflow(pipelineId) { return this.#getSpecificWorkflow(pipelineId, 'tests'); } - async #getCircleCIJobs(workflowId){ + async #getCircleCIJobs(workflowId) { const options = { method: 'GET', url: `https://circleci.com/api/v2/workflow/${workflowId}/job`, - headers: this.circleCIHeaders + headers: this.circleCIHeaders, }; const response = await request(options); - if (response.error) throw new Error(error); + if (response.error){ throw new Error(error); } const body = JSON.parse(response.body); - return body.items + return body.items; } - async #getJobsArtifacts(jobNumber){ + async #getJobsArtifacts(jobNumber) { const options = { method: 'GET', url: `https://circleci.com/api/v2/project/gh/facebook/react-native/${jobNumber}/artifacts`, - headers: this.circleCIHeaders + headers: this.circleCIHeaders, }; const response = await request(options); - if (response.error) throw new Error(error); + if (response.error){ throw new Error(error); } const body = JSON.parse(response.body); - return body.items + return body.items; } async #findUrlForJob(jobName, artifactPath) { - const job = this.jobs.find(job => job.name === jobName); + const job = this.jobs.find(j => j.name === jobName); const artifacts = await this.#getJobsArtifacts(job.job_number); - return artifacts.find(artifact => artifact.path.indexOf(artifactPath) > -1).url; + return artifacts.find(artifact => artifact.path.indexOf(artifactPath) > -1) + .url; } async artifactURLHermesDebug() { - return this.#findUrlForJob('build_hermes_macos-Debug', 'hermes-ios-debug.tar.gz'); + return this.#findUrlForJob( + 'build_hermes_macos-Debug', + 'hermes-ios-debug.tar.gz', + ); } async artifactURLForMavenLocal() { - return this.#findUrlForJob('build_and_publish_npm_package-2', 'maven-local.zip'); + return this.#findUrlForJob( + 'build_and_publish_npm_package-2', + 'maven-local.zip', + ); } async artifactURLForPackagedReactNative() { - return this.#findUrlForJob('build_and_publish_npm_package-2', 'react-native-1000.0.0-'); + return this.#findUrlForJob( + 'build_and_publish_npm_package-2', + 'react-native-1000.0.0-', + ); } async artifactURLForHermesRNTesterAPK() { - return this.#findUrlForJob('test_android', 'rntester-apk/hermes/release/app-hermes-arm64-v8a-release.apk'); + return this.#findUrlForJob( + 'test_android', + 'rntester-apk/hermes/release/app-hermes-arm64-v8a-release.apk', + ); } async artifactURLForJSCRNTesterAPK() { - return this.#findUrlForJob('test_android', 'rntester-apk/jsc/release/app-jsc-arm64-v8a-release.apk'); + return this.#findUrlForJob( + 'test_android', + 'rntester-apk/jsc/release/app-jsc-arm64-v8a-release.apk', + ); } - async downloadArtifact(artifactURL, destination) { + downloadArtifact(artifactURL, destination) { exec(`rm -rf ${destination}`); exec(`curl ${artifactURL} -Lo ${destination}`); } - } module.exports = {