Граф коммитов

391 Коммитов

Автор SHA1 Сообщение Дата
Héctor Ramos 7054e58de4 iOS: fix ios-configure-glog.sh syntax issue
Summary:
A `cat` to file was removed accidentally, preventing the configuration script from executing successfully as part of a `pod install`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24024824

fbshipit-source-id: 94af0c6e663320bfac04ee8f6fb37bd4bdc379a4
2020-09-30 13:27:02 -07:00
Héctor Ramos c92e767435 TurboModule iOS: Remove module filters
Summary:
These native modules are now filtered downstream in `combine-js-to-schema-cli.js`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24003572

fbshipit-source-id: d858dbf4a4b6d522ed528f9c2262f37243317160
2020-09-29 21:48:08 -07:00
simek 2160377574 remove most of tvOS remnants from the code (#29407)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018

This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

## 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
-->

* **[Internal] [Removed]** - remove most of tvOS remnants from the code:
  * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
* **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
* **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
* **[iOS] [Removed]** - remove deprecated and TV related props from View:
  * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
* **[iOS] [Removed]** - remove `BackHandler` utility implementation

Pull Request resolved: https://github.com/facebook/react-native/pull/29407

Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

Reviewed By: PeteTheHeat

Differential Revision: D22619441

Pulled By: shergin

fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
2020-09-28 21:26:41 -07:00
Makar Kotlov 83777cb4fb Fix Xcode bundler in staging and release (#29477)
Summary:
Revert "feat: improve monorepo support by removing redundant PROJECT_ROOT (https://github.com/facebook/react-native/issues/28354)"

This reverts commit a8e85026cf.

This commit a8e85026cf somehow broke the bundler when making a staging or release build in Xcode that results in unresolved files and main.jsbundle nonexistance issue. I figured this out by replacing react-native-xcode.sh from RN v0.63.2 by the one from v0.62.2 where everything works just fine and then reverting the changes line by line. It seems like this pr will fix similar issues stated here https://stackoverflow.com/questions/62806319/main-jsbundle-does-not-exist-this-must-be-a-bug-with-main-jsbundle-issue-afte/62829256#62829256 and here https://github.com/facebook/react-native/issues/29205

## Changelog

[iOS] [Fixed] - fix "main.jsbundle does not exist" issue

Pull Request resolved: https://github.com/facebook/react-native/pull/29477

Test Plan:
With react-native-xcode.sh from RN v0.63.2
![image](https://user-images.githubusercontent.com/32848434/88342113-7ce55d80-cd47-11ea-9dab-bf41ec6d6ab5.png)

With my changes
![image](https://user-images.githubusercontent.com/32848434/88342376-f0876a80-cd47-11ea-9c08-96b892784da1.png)

Reviewed By: sammy-SC

Differential Revision: D23817847

Pulled By: hramos

fbshipit-source-id: 4b729c1231d30e89073b2520aeadee944c84421c
2020-09-22 06:16:38 -07:00
Kevin Gozali 8cca54a7a7 Codegen Android: adjust JNI output to compile from Gradle
Summary:
This adjusted the C++ output for Android codegen (NativeModule specs) so we can compile it with ndk-build in Gradle:
* Use `#include` instead of `#import` for header files
* Added `#pragma once`
* Removed direct include of `<fb/fbjni.h>` -- this is not necessary
* Added generated Android.mk file based on library name

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23809082

fbshipit-source-id: 11ddfea7b48c8b2eb6efe885641ace4fc327d50d
2020-09-21 11:09:12 -07:00
Michel Weststrate d8b70b19b3 Update Flipper (#29787)
Summary:
The current Flipper version included in new React Native is quite old, causing some bugs to be present which have long been solved, such as freezing the UI after inspecting it.
Fixes

This fixes https://github.com/facebook/react-native/issues/29492 /
https://github.com/facebook/flipper/issues/1399

## 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
-->

[general][changed] - Update Flipper to 0.54

Pull Request resolved: https://github.com/facebook/react-native/pull/29787

Test Plan:
Updated the RN 0.63.2 based test project https://github.com/mweststrate/flipper-issue-1399-repo with `use_flipper!('Flipper' => '0.54.0')` (in `ios/Podspec`) / `FLIPPER_VERSION=0.52.1` in `gradle.properties` in the test project https://github.com/mweststrate/flipper-issue-1399-repo and verified that everything builds and connects correctly, and that the bug is no longer present.

Tried to run RN-tester project in this repo. For iOS this succeeded, on Android I got a build error:

```
make: Leaving directory '/Users/mweststrate/Desktop/react-native/ReactAndroid/src/main/jni/react/jni'
make: Entering directory '/Users/mweststrate/Desktop/react-native/ReactAndroid/src/main/jni/react/jni'
fcntl(): Bad file descriptor
[armeabi-v7a] Compile++ thumb: folly_json <= FileUtil.cpp
/Users/mweststrate/Desktop/react-native/ReactAndroid/build/third-party-ndk/folly/folly/FileUtil.cpp:37:14: error: no matching function for call to 'wrapNoInt'
make: Leaving directory '/Users/mweststrate/Desktop/react-native/ReactAndroid/src/main/jni/react/jni'
  return int(wrapNoInt(open, name, flags, mode));
             ^~~~~~~~~
/Users/mweststrate/Desktop/react-native/ReactAndroid/build/third-party-ndk/folly/folly/detail/FileUtilDetail.h:34:9: note: candidate template ignored: couldn't infer template argument 'F'
ssize_t wrapNoInt(F f, Args... args) {
        ^
1 error generated.
make: *** [/opt/android_sdk/ndk/21.3.6528147/build/core/build-binary.mk:478: /Users/mweststrate/Desktop/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/folly_json/folly/FileUtil.o] Error 1
make: *** Waiting for unfinished jobs....
fcntl(): Bad file descriptor
make: Entering directory '/Users/mweststrate/Desktop/react-native/ReactAndroid/src/main/jni/react/jni'
[armeabi-v7a] Compile++ thumb: folly_json <= Demangle.cpp
```

No idea if it is related. I guess not since without making the change I got the same error.

Reviewed By: mweststrate

Differential Revision: D23767388

Pulled By: fkgozali

fbshipit-source-id: 35f0d3ddec41942f5bbc96cb391975d84729ef5e
2020-09-18 12:24:07 -07:00
Kevin Gozali 22e3f020fd Codegen: create java dirs based on javaPackageName for .java spec files
Summary:
Move the directory creation logic to the CLI. This needs to be processed by RNCodegen.js eventually.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D23618550

fbshipit-source-id: e7dc4f5fc37e5ad12b5c6ae8ea31fc9ef16d74b9
2020-09-11 01:14:17 -07:00
Kevin Gozali 0351c57e6a Codegen: Generate module C++ lookup function for JNI next to the spec classes
Summary:
The TurboModule system requires a lookup function to map the spec name (name used in JS) to the C++ TurboModule subclass. This is a pure C function. For now, generate one lookup function per set of modules found in the codegen schema.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D23618281

fbshipit-source-id: 889e07bdd4f2e5e93c4d14e60225f5b0c6683917
2020-09-11 01:14:17 -07:00
Frieder Bluemle fb354cba05 Remove .gitattributes and normalize line endings (#29792)
Summary:
The nested `.gitattributes` file in `packages/react-native-codegen/android/` caused some confusion on Linux and macOS, causing Git to show `packages/react-native-codegen/android/gradlew.bat` as modified (CRLF removed, LF added).

Instead of relying on repo-local `.gitattributes` files to convert endings in the working directory, the files should be committed to source control with the correct line endings in the first place. There is no reason to convert LF endings in .sh and many other file to CRLF on Windows (maybe this was an issue a long time ago, but unless Notepad is used this won't be a problem for practically all modern editors).

Also fixed the line endings of `scripts/launchPackager.bat` which was incorrectly committed as LF.

## Changelog

[Internal] [Fixed] - Line endings and .gitattributes

Pull Request resolved: https://github.com/facebook/react-native/pull/29792

Test Plan: Clone repo on Linux, macOS, and Windows, and make sure no modified files show up.

Reviewed By: fkgozali

Differential Revision: D23546135

Pulled By: mdvacca

fbshipit-source-id: 1572fcb959212f212b137066f1aa66f0bb6e86c3
2020-09-04 13:44:40 -07:00
Kevin Gozali 02fed06340 Codegen: Add JNI C++ generator for TurboModule subclasses
Summary:
This adds the C++ classes for Android, just like checked in here: https://github.com/facebook/react-native/tree/master/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni

The whitespace/formatting is slightly different but the functionality should be preserved.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23489368

fbshipit-source-id: 60c112a48b6de2d2eb19f7d1bcc894048334610f
2020-09-03 16:11:08 -07:00
Héctor Ramos 5fdb558104 Use Xcode 11.6.0 and CocoaPods 1.9.3 (#28837)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28837

CocoaPods 1.9.3 is the version that is distributed by Circle CI to macOS machines alongside Xcode 11.6.0.

The upgrade to CocoaPods and Xcode is therefore tightly coupled due to our dependency on Circle for our open source CI.

With the upgrade to Xcode 11.6.0, we also bump our target OS to ensure iOS tests use an iOS Simulator that is part of the image.

Reference:
* Circle CI macOS Xcode 11.6.0 image manifest (new version): https://circle-macos-docs.s3.amazonaws.com/image-manifest/v3299/index.html
* Circle CI macOS Xcode 11.3.1 image manifest (previous version): https://circle-macos-docs.s3.amazonaws.com/image-manifest/v2244/index.html

> Source: https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions

Changelog:
[Internal] Bump Xcode version used for iOS tests.

Reviewed By: fkgozali

Differential Revision: D21415049

fbshipit-source-id: 7a5532e69cfef25999a5b31a09d844f48be9827c
2020-09-02 14:27:48 -07:00
Eloy Durán 941bc0ec19 Upstream RN macOS Hermes integration bits (#29748)
Summary:
Microsoft’s RN for macOS fork supports the Hermes engine nowadays https://github.com/microsoft/react-native-macos/pull/473. As a longer term work item, we’ve started moving bits that are not invasive for iOS but _are_ a maintenance burden on us—mostly when merging—upstream. Seeing as this one is a recent addition, it seemed like a good candidate to start with.

As to the actual changes, these include:

* Sharing Android’s Hermes executor with the objc side of the codebase.
* Adding a CocoaPods subspec to build the Hermes inspector source and its dependencies (`Folly/Futures`, `libevent`).
* Adding the bits to the Xcode build phase script that creates the JS bundle for release builds to compile Hermes bytecode and source-maps…
* …coincidentally it turns out that the Xcode build phase script did _not_ by default output source-maps for iOS, which is now fixed too.

All of the Hermes bits are automatically enabled, on macOS, when providing the `hermes-engine-darwin` [npm package](https://www.npmjs.com/package/hermes-engine-darwin) and enabling the Hermes pods.

## Changelog

[General] [Added] - Upstream RN macOS Hermes integration bits

Pull Request resolved: https://github.com/facebook/react-native/pull/29748

Test Plan:
Building RNTester for iOS and Android still works as before.

To test the actual changes themselves, you’ll have to use the macOS target in RNTester in the macOS fork, or create a new application from `master`:

<img width="812" alt="Screenshot 2020-08-18 at 16 55 06" src="https://user-images.githubusercontent.com/2320/90547606-160f6480-e18c-11ea-9a98-edbbaa755800.png">

Reviewed By: TheSavior

Differential Revision: D23304618

Pulled By: fkgozali

fbshipit-source-id: 4ef0e0f60d909f3c59f9cfc87c667189df656a3b
2020-08-27 01:18:33 -07:00
stealthanthrax 63992c0b96 Migrating RNTester to Packages Directory (#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: https://github.com/facebook/react-native/pull/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
2020-08-19 17:57:08 -07:00
Christoph Nakazawa f3930a93d5 Split React Native repo into product/infra packages
Summary: Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D23165627

fbshipit-source-id: f371c070f8b297c218d2989ff3b553a8b83c18ea
2020-08-18 12:10:09 -07:00
Kevin Gozali 77e0ba2fb0 codegen: add Android NativeModule generator base structure
Summary:
* Allow generate-native-modules-specs-cli.js to generate Android specific files
* Add stub impl for Java spec generation (the output are still incomplete, see the next diffs for missing impl + tests)
* Adjust the CLI to only produce modules stuffs, there's no need to produce components code

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22860936

fbshipit-source-id: 38aae390189f143f6c6216995437ac1ff15a1788
2020-07-31 19:04:54 -07:00
Nico Burns dc2df75426 Make flipper pods configurations configurable (#29074)
Summary:
This PR allows the use_flipper! helper function to be used in projects that
have more than just Debug/Release configurations. For example, a project
may have DevDebug, DevRelease, ProdDebug, and ProdRelease configurations.
These projects can now do:

```ruby
use_flipper!(configurations: ['DevDebug', 'ProdDebug'])
```

## Changelog

[iOS][Added] Ability to set which configuration to enable flipper for when using  use_flipper!

Pull Request resolved: https://github.com/facebook/react-native/pull/29074

Test Plan:
I don't know how to run code in this repository, so I copy and pasted this function into the Podfile of an existing project. My complete Podfile is as below:

```ruby
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/react-native-community/cli-platform-ios/native_modules'

project 'marketplace',
  'Dev.Debug' => :debug,
  'Dev.Release' => :release,
  'Prod.Debug' => :debug,
  'Prod.Release' => :release

def use_flipper!(versions = {}, configurations: ['Debug'])
  versions['Flipper'] ||= '~> 0.33.1'
  versions['DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.1'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.0'
  pod 'FlipperKit', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configurations => configurations
  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['Flipper'], :configurations => configurations
  pod 'Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], :configurations => configurations
  pod 'Flipper-Folly', versions['Flipper-Folly'], :configurations => configurations
  pod 'Flipper-Glog', versions['Flipper-Glog'], :configurations => configurations
  pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configurations => configurations
  pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configurations => configurations
  pod 'FlipperKit/Core', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configurations => configurations
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'marketplace' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  #use_frameworks!

  pod 'FBLazyVector', :path => '../node_modules/react-native/Libraries/FBLazyVector'
  pod 'FBReactNativeSpec', :path => '../node_modules/react-native/Libraries/FBReactNativeSpec'
  pod 'RCTRequired', :path => '../node_modules/react-native/Libraries/RCTRequired'
  pod 'RCTTypeSafety', :path => '../node_modules/react-native/Libraries/TypeSafety'
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/callinvoker', :path => '../node_modules/react-native/ReactCommon'
  pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'Intercom', '~> 6.0.0'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'react-native-netinfo', :podspec => '../node_modules/react-native-community/netinfo/react-native-netinfo.podspec'
  pod 'BugsnagReactNative', :podspec => '../node_modules/bugsnag-react-native/BugsnagReactNative.podspec'
  pod 'rn-fetch-blob', :podspec => '../node_modules/rn-fetch-blob/rn-fetch-blob.podspec'

  use_native_modules!

  pod 'react-native-intercom', :path => '../node_modules/react-native-intercom'
  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'react-native-camera', :path => '../node_modules/react-native-camera'

  pod 'RNCPushNotificationIOS', :path => '../node_modules/react-native-community/push-notification-ios'

  pod 'RNDateTimePicker', :path => '../node_modules/react-native-community/datetimepicker'

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!(configurations: ['Dev.Debug', 'Prod.Debug'])

  post_install do |installer|

    flipper_post_install(installer)

    installer.pods_project.targets.each do |target|

      # The following is needed to ensure the "archive" step works in XCode.
      # It removes React & Yoga from the Pods project, as it is already included in the main project.
      # Without this, you'd see errors when you archive like:
      # "Multiple commands produce ... libReact.a"
      # "Multiple commands produce ... libyoga.a"

      targets_to_ignore = %w(React yoga)

      if targets_to_ignore.include? target.name
        target.remove_from_project
      end
    end
  end
end
```

I then ran `pod install`:

```
nico:ios/ (dev*) $ pod install                                                                                [20:14:43]
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Detected React Native module pods for BVLinearGradient, RNCAsyncStorage, RNCPicker, RNCPushNotificationIOS, RNDateTimePicker, RNFBApp, RNFBAuth, RNFBDatabase, RNFBDynamicLinks, RNFBFirestore, RNFBStorage, RNSVG, RNVectorIcons, ReactNativeNavigation, react-native-camera, react-native-cameraroll, react-native-config, react-native-flipper, react-native-get-random-values, react-native-image-resizer, and react-native-intercom
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 73 dependencies from the Podfile and 88 total pods installed.

[!] use_native_modules! skipped the react-native dependency 'react-native-photo-view'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good
    example of a package.json driven podspec. See
    https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

[!] use_native_modules! skipped the react-native dependency 'detox'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good
    example of a package.json driven podspec. See
    https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library
```

Reviewed By: cpojer

Differential Revision: D22795421

Pulled By: passy

fbshipit-source-id: 89ba555eadc4918e9ac464a19a318198b237e01e
2020-07-29 02:51:32 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Christoph Nakazawa a77f2c40d1 Create `@react-native/polyfills` package.
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22625944

fbshipit-source-id: 1d97550c92115eb637da57e8f38c28e8139f3a8b
2020-07-22 03:02:45 -07:00
Frieder Bluemle e629e94b46 Update Android build tools to 29.0.3 (#29350)
Summary:
A small patch update of the Android build tools from 29.0.2 to 29.0.3. It's the default for newly generated Android projects.

## Changelog

[Android] [Changed] - Update Android build tools to 29.0.3

Pull Request resolved: https://github.com/facebook/react-native/pull/29350

Test Plan: Build project

Reviewed By: JoshuaGross

Differential Revision: D22521075

Pulled By: mdvacca

fbshipit-source-id: 967bbfc6e45c6457d4867282ba311f86dea96208
2020-07-16 12:07:36 -07:00
Christoph Nakazawa 6d6c68c2c6 "The Metro Server" -> Metro
Summary:
Pet Peeve: Metro is a brand name. You don't say "the Metro server" just like you don't say "the iPhone phone". This is a leftover from when it used to be called "the packager server".

Note: It makes sense to refer to "the Metro server" when talking about it in the context of Metro's features, like if you are discussing "Metro's bundling" and "Metro's server". However, when talking about the tool itself, just Metro is enough.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22330966

fbshipit-source-id: 667618363c641884df543d88cac65d1e44956ad3
2020-07-02 14:51:18 -07:00
Héctor Ramos c2d827f160 Codegen: Allow use of arbitrary Yarn binary in codegen script
Summary:
Splits the codegen script into functions, and makes use of $YARN_BINARY for portability (defaults to `yarn` if not provided).

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D22148360

fbshipit-source-id: 9e86b3e0f7f77bf3a635bf6be204170333dd5e65
2020-06-30 19:07:03 -07:00
Petr Bela e73208e2ca Better error message when missing entry file (#29012)
Summary:
If the entry file has been renamed (e.g., to `index.ts`), the script currently fails silently and prints out that the bundle file does not exist.

This change will print the correct error message instead.

## Changelog

[iOS] [Fixed] - Better error message when missing entry file
Pull Request resolved: https://github.com/facebook/react-native/pull/29012

Test Plan: N/A

Reviewed By: hramos

Differential Revision: D22109657

Pulled By: TheSavior

fbshipit-source-id: edd7b6f88becc954ee41ed01ae43efb4481adc95
2020-06-18 13:35:36 -07:00
Héctor Ramos 2e756e024f Remove flow-node requirement from native modules codegen script
Summary:
Use transpiled `react-native-codegen` scripts. By avoiding use of flow-node, we no longer need to upgrade flow-remove-types in order to run the native modules codegen script.

The interface for the script remains the same:

```
./scripts/generate-native-modules-specs.sh [optionalOutputDir]
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21629705

fbshipit-source-id: 7714a67e36c8151a3b0b49285b6a6c93a525d7bc
2020-05-20 18:48:49 -07:00
Ramanpreet Nara eb2a561ecb Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21598852

fbshipit-source-id: 60da5d0f7758eaf13907a080b7d8756688f40723
2020-05-15 15:25:23 -07:00
Keegan Mendonca 2b0208b399 Revert D21585006: Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Differential Revision:
D21585006

Original commit changeset: e3339273af5d

fbshipit-source-id: cb4ff227edcc16842c7539bf71c912cd4ec478e0
2020-05-14 21:48:44 -07:00
Ramanpreet Nara 9f3c7af400 Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21585006

fbshipit-source-id: e3339273af5dfd65a1454d87213d1221de6a4651
2020-05-14 20:54:57 -07:00
Ramanpreet Nara 0486640571 Introduce NativeModulePerfLogger
Summary:
## Description
This diff introduces `NativeModulePerfLogger`, its BUCK, Cocoapod, android-ndk targets. This diff also wires up those targets into the React Native bridge and TurboModules targets, so that we get signal on if the code compiles.

This diff also introduces `TurboModulePerfLogger`, which is a namespace that holds the `NativeModulePerfLogger` that'll do perf-logging for TurboModules.

## How will perflogging work on iOS?
1. Each application will, during React Native initialization, create a NativeModule perf logger.
2. If TurboModules are enabled, we'll call `TurboModulePerfLogger::setInstance(perfLogger)`. If TurboModules are disabled, we'll call `NativeModulePerfLogger::setInstance(perfLogger)`.
3. TurboModules, when they're created and used, will log events via `TurboModulePerfLogger::getInstance()`. NativeModules (i.e: bridge modules), when they're created and used, will log events via the `NativeModulePerfLogger::getInstance()`.

> **Note:** The NativeModule system will log events for non-TurboModules as well. Maybe we should log events for only NativeModules that conform to the `TurboModule` interface, when TurboModules are disabled. This'll ensure a fair comparison between the two systems.

## How will perflogging work on Android?
Please see the subsequent diff.

allow-large-files

Changelog:
[Both][Added] - Introduce `NativeModulePerfLogger`

Reviewed By: PeteTheHeat

Differential Revision: D21318053

fbshipit-source-id: 6ddf5b5a80bdc4076d2dd6588067e2b0ec8c2c6b
2020-05-13 20:28:15 -07:00
Emily Janzer a4a47b9a1e Expose RuntimeExecutor on CatalystInstance (#28851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d
2020-05-08 16:13:42 -07:00
Héctor Ramos 91a49d8827 Add script to generate native modules specs with react-native-codegen
Summary:
Adds a script that uses `react-native-codegen` to generate FBReactNativeSpec.
The generated output should not be considered ready for production use at this time.
The goal of adding this script at this time is to demonstrate the current status of native modules specs code generation in open source.

For example, the generated output may be used in RNTester, with some modifications due to some naming differences in react-native-codegen's output when compared to the FBReactNativeSpec files generated by the old codegen.

Usage:

```
./scripts/generate-native-modules-specs.sh ./codegen-out
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21471004

fbshipit-source-id: 5ff3c57807d9ba2c91dc7fe32d227d218732b059
2020-05-08 12:23:35 -07:00
Eloy Durán 7bb1c4e1b8 Enable with CocoaPods `:configuration` (#28796)
Summary:
~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~
Fixes 17f025bc26 (commitcomment-38831234)

Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

## 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
-->

[iOS] [Changed] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/react-native/pull/28796

Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21449754

Pulled By: passy

fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625
2020-05-07 08:36:55 -07:00
Mark Lord b2b23a2017 Check en0..en8 when generating ip.txt for iOS debug builds (#28764)
Summary:
When generating ip.txt in an iOS debug build, search en0 through en8 for an IP address rather than only checking en0 and en1.  For example, on my Mac, the IP address I needed to use was on en5 and the IP address actually detected was a private network of one of my Parallels virtual machines (interface vnic0).

## 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
-->

[iOS] [Fixed] - Search en0 through en8 for the Metro Bundler's IP address when generating iOS debug builds
Pull Request resolved: https://github.com/facebook/react-native/pull/28764

Test Plan: Should make no difference to users for whom react-native-xcode.sh already worked. On a Mac with multiple virtual machines installed, should prevent ip.txt getting the private IP address of a virtual machine.

Differential Revision: D21280671

Pulled By: shergin

fbshipit-source-id: e6fe9c8344146626df96129968981462463201f7
2020-04-28 09:32:55 -07:00
simek dfdbf41cc3 chore: remove tvOS from the e2e CI tests (#28743)
Summary:
Refs https://github.com/facebook/react-native/issues/28706

This small PR removes `tvOS` platform and `HelloWorld-tvOS` references from the e2e CI tests script. Also a small typo in comment has been fixed.

CC: dlowder-salesforce

## Changelog

[Internal] [Removed] - remove tvOS from the e2e CI tests
Pull Request resolved: https://github.com/facebook/react-native/pull/28743

Test Plan: Exec during `node ./scripts/run-ci-e2e-tests.js --ios` was successful.

Differential Revision: D21252185

Pulled By: shergin

fbshipit-source-id: 56981f2c5c3038412e9f37a81084de87e296d7d2
2020-04-26 21:38:16 -07:00
sunnylqm 17f025bc26 Upgrade Flipper to 0.37.0 (#28545)
Summary:
Bump flipper to 0.37 for both iOS and Android

## Changelog

[Android] [Changed] - Upgrade Flipper to 0.37.0
[iOS] [Changed] - Upgrade Flipper to 0.37.0
Pull Request resolved: https://github.com/facebook/react-native/pull/28545

Test Plan: RNTester build pass

Reviewed By: rickhanlonii

Differential Revision: D20930069

Pulled By: hramos

fbshipit-source-id: a7cb719da3e51e6a42d27d5e64bc664398d0d3c5
2020-04-21 17:46:53 -07:00
Christoph Nakazawa 894f6b3e74 Remove unused packages from xplat/js/package.json
Summary:
We have a large amount of small packages that are completely unused, or only have one call site. This diff cleans up a lot of them and reduces node_modules by 12 MiB (down to 187).

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21088213

fbshipit-source-id: 5fa7d3da5cbe744b0d9d3e3450d6135c1488ee79
2020-04-17 09:24:08 -07:00
Mike Grabowski 90f60a83e3 chore: update `./scripts/test-manual-e2e.sh` (#28653)
Summary:
Recent changes broke the script - wrong path to open `RNTesterPods.xcworkspace` and other scripts - we change dir with `cd`.

Another change is incorrect use of `RNTesterProject.xcodeproj` instead of a `xcworkspace`.

This PR is a simple and short fix to make it run.

## Changelog

[INTERNAL] - chore: update `./scripts/test-manual-e2e.sh`
Pull Request resolved: https://github.com/facebook/react-native/pull/28653

Test Plan: Run `./scripts/test-manual-e2e.sh`. Things work.

Differential Revision: D21079792

Pulled By: hramos

fbshipit-source-id: 6bdb8be016f044852ed216ec53f80db40c84b5fd
2020-04-16 17:48:14 -07:00
Eli White fb04237b18 Revert D21064653: Remove the post install step
Differential Revision:
D21064653

Original commit changeset: da56d0754d91

fbshipit-source-id: 1086cfdeca9aa3830370ea115ba7b5f05d3fb124
2020-04-16 12:07:09 -07:00
Pritesh Nandgaonkar 44beb2a685 Remove the post install step (#28651)
Summary:
Removes the post install step for Flipper, as the latest version of YogaKit is compatible with swift 5.

cc alloy

## 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
-->

[Flipper] [Template] - Remove the post install step for Flipper
Pull Request resolved: https://github.com/facebook/react-native/pull/28651

Test Plan: Tested a newly created RN app without post install step and it built successfully.

Reviewed By: passy

Differential Revision: D21064653

Pulled By: priteshrnandgaonkar

fbshipit-source-id: da56d0754d918e30a0ebe480c77590f0139d48ac
2020-04-16 09:34:52 -07:00
Tommy Nguyen 1908d50ba4 Fix CIRCLE_PR_NUMBER may not always be set (#28640)
Summary:
This fixes build failures where `CIRCLE_PR_NUMBER` is not set. This can happen if the PR did not come from a fork.

## Changelog

[Internal] [Fixed] - Fix CIRCLE_PR_NUMBER may not always be set
Pull Request resolved: https://github.com/facebook/react-native/pull/28640

Test Plan: Report bundle size step should pass on both this PR and https://github.com/facebook/react-native/issues/28641.

Reviewed By: cpojer

Differential Revision: D21045553

Pulled By: TheSavior

fbshipit-source-id: fdfcb1bb88a96345b78ca69c49623df71d4cd608
2020-04-15 11:46:33 -07:00
George Zahariev cd347a7e0e Upgrade Prettier in Xplat to version 1.19.1
Summary:
Upgrades Prettier in Xplat to 1.19.1
Ignores upgrading packages on already on versions greater than 1.19.1

Changelog: [Internal]

allow-large-files
bypass-lint

(Note: this ignores all push blocking failures!)

Reviewed By: gkz, cpojer

Differential Revision: D20879147

fbshipit-source-id: 0deee7ac941e91e1c3c3a1e7d3d3ed20de1d657d
2020-04-09 11:01:58 -07:00
Javier Cuevas e5497ca8f6 Exclude all FlipperKit transitive dependencies from iOS Release builds (#28504)
Summary:
The `:configuration` option from `pod` only affects the specified pod and not its dependencies [1]. Therefore in order to avoid all transitive dependencies being linked in the resulting Release IPA we need to list them in the `Podfile`.

Note that this will still build Flipper's pods when doing a Release, but it won't link it in the resulting IPA.

[1] https://guides.cocoapods.org/syntax/podfile.html#pod

Fixes https://github.com/react-native-community/upgrade-support/issues/28
Related https://github.com/CocoaPods/CocoaPods/issues/9658

## Changelog

* [iOS] [Fixed] - Exclude Flipper from iOS Release builds
Pull Request resolved: https://github.com/facebook/react-native/pull/28504

Test Plan:
Create a new React Native 0.62 project, run `pod install`, then diff:
```
ProjectName/ios/Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig`
```
and
```
ProjectName/ios/Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.relaese.xcconfig
```

![image](https://user-images.githubusercontent.com/855995/78337679-a3fa0280-7591-11ea-8142-6f82cbc6be58.png)

Reviewed By: passy

Differential Revision: D20894406

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 680780f0f5a85fd8423b85a271a499bd12f06d00
2020-04-07 10:11:52 -07:00
Héctor Ramos 25836bc239 Upgrade tests to Xcode 11.3.1 (#28498)
Summary:
Upgrade Sandcastle and Circle CI tests to use Xcode 11.3.1 across the board.

Pull Request resolved: https://github.com/facebook/react-native/pull/28498
Pull Request resolved: https://github.com/facebook/react-native/pull/28501

Changelog:
[Internal] - Use Xcode 11.3.1 in iOS tests

Reviewed By: fkgozali

Differential Revision: D20821844

fbshipit-source-id: b250ca82bdf2c9fb7faa765d3e2433eb46efd692
2020-04-03 11:56:21 -07:00
Ramanpreet Nara 9b94a541d8 Get CallInvokers from the bridge
Summary:
## Context
For now, assume TurboModules doesn't exist.

**What happens when we call an async NativeModule method?**
Everytime JS calls an async NativeModule method, we don't immediately execute it. The legacy infra pushes the call into some queue managed by `MessageQueue.js`. This queue is "flushed" or "emptied" by the following events:
- **Flushed:** A C++ -> JS call. NativeModule async methods can called with an `onSuccess` and/or `onFail` callback(s). Calling `NativeToJsBridge::invokeCallback` to invoke one of these callbacks is one way for ObjC++/C++/Java to call into JS. Another way is via JSModule method calls, which are initiated by `NativeToJsBridge::callFunction`.
- **Flushed:** When `JSIExecutor::flush` is called. Since TurboModules don't exist, this only happens when we call `JSIExecutor::loadApplicationScript`.
- **Emptied:** When more than 5 ms have passed, and the queue hasn't been flushed/emptied, on the next async NativeModule method call, we add to the queue. Afterwards, we empty it, and invoke all the NativeModule method calls.

**So, what's the difference between flushed and emptied?**
> Note: These are two terms I just made up, but the distinction is important.

If the queue was "flushed", and it contained at least one NativeModule method call, `JsToNativeBridge` dispatches the `onBatchComplete` event. On Android, the UIManager module is the only module that listens to this event. This `onBatchComplete` event doesn't fire if the queue was "emptied".

**Why does any of this matter?**
1. TurboModules exist.
2. We need the TurboModules infra to have `JsToNativeBridge` dispatch `onBatchComplete`, which depends on:
   - **Problem 1:** The queue being flushed on calls into JS from Java/C++/ObjC++.
   - **Problem 2:** There being queued up NativeModule async method calls when the queue is flushed.

In D14656466, fkgozali fixed Problem 1 by making every C++/Java/Obj -> JS call from TurboModules also execute `JSIExecutor::flush()`. This means that, with TurboModules, we flush the NativeModule async method call queue as often as we do without TurboModules. So far, so good. However, we still have one big problem: As we convert more NativeModules to TurboModules, the average size of the queue of NativeModule method calls will become smaller and smaller, because more NativeModule method calls will be TurboModule method calls. This queue will more often be empty than not. Therefore, we'll end up dispatching the `onBatchComplete` event less often with TurboModules enabled. So, somehow, when we're about to flush the NativeModule method call queue, we need `JsToNativeBridge` to understand that we've executed TurboModule method calls in the batch. These calls would have normally been queued, which would have led the queue size to be non-zero. So if, during a batch, some TurboModule async method calls were executed, `JsToNativeBridge` should dispatch `onBatchComplete`.

**So, what does this diff do?**
1. Make `Instance` responsible for creating the JS `CallInvoker`.
2. Make `NativeToJsBridge` responsible for creating the native `CallInvoker`. `Instance` calls into `NativeToJsBridge` to get  the native `CallInvoker`.
3. Hook up `CatalystInstanceImpl`, the Android bridge, with the new JS `CallInvoker`, and the new native `CallInvoker`. This fixes `onBatchComplete` on Android. iOS work is pending.

Changelog:
[Android][Fixed] - Ensure `onBatchComplete` is dispatched correctly with TurboModules

Reviewed By: mdvacca

Differential Revision: D20717931

fbshipit-source-id: bc3ccbd6c135b7f084edbc6ddb4d1e3c0c7e0875
2020-04-01 11:39:18 -07:00
Héctor Ramos 8ac00b3ef8 Green CI: Fix JavaScript e2e tests, disable failing Android e2e test (#28392)
Summary:
Jobs now have a `run_disabled_tests` argument that allows for the selective execution of disabled tests. When working on re-enabling a failing test, the contributor just needs to set `run_disabled_tests` to `true` in the appropriate workflow in `.circleci/config.yml`.

Tests can be kept green by moving failing tests into the disabled section until a contributor can provide a fix, thus ensuring signal is maintained on master. For example, a failing end-to-end test might be disabled in order to allow the signal from unit tests to be provided, as opposed to flat out failing the entire job.

What was done in this PR:
* The failing `test_js_e2e` job has been fixed, and merged into the `test_js` job. An empty disabled tests section is added for future use.
* The failing `test_ios_e2e` job has been merged into `test_ios`, with all of its steps gated behind the `run_disabled_steps` argument.
* The failing Android end-to-end tests have been added to `test_android`, gated behind the `run_disabled_steps` argument
* The failing Podspecs test has been added back into `test_ios`, gated behind the `run_disabled_steps` argument

## Changelog

[Internal] [CI] -  Green CI, disabled test infrastructure work
Pull Request resolved: https://github.com/facebook/react-native/pull/28392

Test Plan: Verified on Circle CI

Reviewed By: cpojer

Differential Revision: D20665512

Pulled By: hramos

fbshipit-source-id: 831738027f90f4b23313893d8342d7e654f34726
2020-03-26 06:52:43 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Mike Grabowski a8e85026cf feat: improve monorepo support by removing redundant PROJECT_ROOT (#28354)
Summary:
Historically, React Native didn't support a lot of custom project structures apart from the standard flat directory with `ios` and `android` folders. The CLI had to be explicitly started from the project root, otherwise Metro didn't work right.

In order to resolve the project root in the most accurate way, React Native assumed that project root is always `../../` from its location in `node_modules` - this is not true when the installation gets hoisted (e.g. in a monorepo).

To address that, janicduplessis brought support for custom [`PROJECT_ROOT`](9ccde378b6) that allowed overriding the `../../` in case it wasn't true.

Today, CLI is able to automatically resolve the project root, no matter where it's started. It will traverse the tree of the directories upwards and stop as soon as it meets `package.json`.

As a result, it doesn't really matter from where we start the CLI anymore as a part of `react-native-xcode.sh`.

By replacing the default value of `$REACT_NATIVE_DIR/../../` with `$PWD, that is default for all Xcode scripts, we can make the setup for monorepo easier - nobody will need to set `$PROJECT_ROOT` in order to override the incorrect defaults.

By default, all scripts defined in Xcode run from `$PWD` directory, which is the location of the iOS project. In the future, we will be able to remove `cd` entirely.

To better understand this PR, let's look a few hypothetical structures as an example:

#### Monorepo:

> tl;dr works out of the box, no need to mess around with paths

```
- package.json
- packages/
  - my-app/
     - index.js
     - package.json
     - ios/
        - MyApp.xcodeproj
```

**Before this PR**, the `react-native-xcode.sh` will start the CLI like this:

```bash
cd $REACT_NATIVE_DIR/../../
node <absolute_path_to_cli.js> bundle --entry-point index.js
```

- Because we change the directory to the root of monorepo, CLI throws an error. All in all, there's no `react-native` dependency at the workspace root.

- Some users turn `no hoist` in an act of troubleshooting the errors, which resolves the problem - `react-native` is moved under `my-app/node_modules` which makes this mechanism resolve properly.

- Some users find out about `PROJECT_ROOT` and set it to overwrite the default value. For example, setting `export PROJECT_ROOT = "$PWD/../` will set the directory to `my-app`, which has a dependency on `react-native` in a `package.json` and makes the CLI happy.

**After this PR**, the `react-native-xcode.sh` will start the CLI like this:

```bash
cd $PWD
node <absolute_path_to_cli.js> bundle --entry-point index.js
```

- The `$PWD` is `packages/my-app/ios/` because that's where the Xcode project is located. CLI will automatically set the root to `../` because that's where it finds `package.json` with `react-native` dependency. It will pass that root to Metro, unless users have set a different one themselves. Thanks to that, all paths to JavaScript files remain working and unaffected.

- No need to set `PROJECT_ROOT` anymore.

- We don't rely on the location of `node_modules`, which is cleaner and future proof.

#### Standard:

> tl;dr no changes

```
- ios/
   - MyApp.xcodeproj
- index.js
- package.json
```

**Before this PR**, the `react-native-xcode.sh` will start the CLI like this:

```bash
cd $REACT_NATIVE_DIR/../../
node <absolute_path_to_cli.js> bundle --entry-point index.js
```

- Everything works fine. Path from `react-native` inside `node_modules` is correct - the project root is set right to `/`

**After this PR**, the `react-native-xcode.sh` will start the CLI like this:

```bash
cd $PWD
node <absolute_path_to_cli.js> bundle --entry-point index.js
```

- The root will be set to where Xcode project is located, which is `/ios`. This is the PWD for all Xcode scripts.

CLI will look for the `package.json` going upwards from `ios` folder. Will stop at `/`, find out it has `react-native` dependency, load it and its commands and proceed further.

## Changelog

[iOS] [Feature] - Better monorepo support when building release apk
Pull Request resolved: https://github.com/facebook/react-native/pull/28354

Test Plan:
- All projects (standard/monorepo) run without issues.
- PROJECT_ROOT is not needed.

CC: Titozzz (who wrote monorepo guide), alloy, bartolkaruza

Reviewed By: cpojer

Differential Revision: D20558005

Pulled By: hramos

fbshipit-source-id: 2551120beadcfd4c2f1393ce8a2c2fa6b93c9290
2020-03-20 11:36:46 -07:00
Tommy Nguyen 175589bff0 Add diffing to app bundle size reports (#28284)
Summary:
Add diffing to app bundle size reports.

## Changelog

[Internal] [Changed] - Add diffing to app bundle size reports

Pull Request resolved: https://github.com/facebook/react-native/pull/28284

Test Plan:
- App bundle size reports should now display a diff where available
  - Right now, the database contains only one entry for the last known good iOS build
- Triggering a new build should not create additional comments

Reviewed By: cpojer

Differential Revision: D20450158

Pulled By: hramos

fbshipit-source-id: 720772275f24d3ff0a49705f4dada2efe2e99bd3
2020-03-20 07:15:11 -07:00
Héctor Ramos 07def55396 fbshipit-source-id: da15f69185e724eaf7d4bc78dbc61fcdcb3074d5 2020-03-13 21:46:45 -07:00
Michel Weststrate 85a4b0f5bd Bump FlipperKit version on iOS to be compatible with react-native-flipper (#28277)
Summary:
This pull request re-applies https://github.com/facebook/react-native/pull/28225, thereby reverting 4bb17944f1, this time bumping to FlipperKit 0.33.1 which is again compatible with iOS 9 (thanks to https://github.com/facebook/flipper/pull/874)

This is the iOS counterpart of https://github.com/facebook/react-native/pull/28275

## Changelog

[iOS] [Changed] - Upgrade Flipper dependency to 0.33.1
Pull Request resolved: https://github.com/facebook/react-native/pull/28277

Test Plan:
* Bumped the version in our Flipper / RN integration test app first, that runs on 0.62-rc.5, verified everything still works there.
* CI

![Screen Shot 2020-03-10 at 12 12 46](https://user-images.githubusercontent.com/1820292/76311312-94f09f00-62c8-11ea-81db-ced6d16e096b.png)

Reviewed By: mweststrate

Differential Revision: D20369106

Pulled By: TheSavior

fbshipit-source-id: dfeb0446e7f29684a266eca5d0e29ac42cef2ef3
2020-03-10 14:16:55 -07:00
Michel Weststrate fbb94a30bc Bump FlipperKit version on iOS to be compatible with react-native-fli… (#28225)
Summary:
This diff updated FlipperKit to be compatible with the latest react-native-flipper version.

## Changelog

(nothing changes compared to what is already in the changelog for RN 0.62.0)

[iOS][Fixed] - Upgraded FlipperKit to 0.32.2 to ensure compatibility with latest `react-native-flipper`
Pull Request resolved: https://github.com/facebook/react-native/pull/28225

Test Plan:
Tested by upgrading the ReactNativeFlipperExample (https://github.com/facebook/flipper/tree/master/react-native/ReactNativeFlipperExample) to RN 0.62.0-rc.3 and verified the example plugin works. (In D20221558)

![Screen Shot 2020-03-04 at 11 26 52](https://user-images.githubusercontent.com/1820292/75875163-18167e80-5e0b-11ea-8a7d-504bb27757db.png)

Reviewed By: priteshrnandgaonkar

Differential Revision: D20249666

Pulled By: mweststrate

fbshipit-source-id: 71a61c4249f8b767c7767d5c6133436c9bc9cf26
2020-03-04 11:06:47 -08:00