A framework for building native macOS apps with React.
Перейти к файлу
Nicola Corti b0711f1d35 Update ReactAndroid to use the AGP NDK Apis (#32443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32443

This diff removes all the custom Gradle machinery to build the native code and delegates to AGP
the triggering of the `ndk-build` command. This means that the native build will be now invoked
with the `:ReactAndroid:externalNativeBuild<Variant>` task.

An important thing to notice is that that task will always run, and will delegate to Make the
compilation avoidance. If you invoke the task twice, the second time it will be significantly faster.
On my machine this takes ~6/7 mins the first time, and 30 seconds the second time.

There are some gotchas that are worth noting:
* The native build will run on every build now. Given the complexity of our native build graph,
even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the
targets and mention that there is no work to be done. I believe this could be impactful for local
development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI
of the target device (e.g. arm64 for a real device and so on).
This reduces the native build to ~10 seconds.
* All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be
considered invalid. Therefore they will re-extract the header files inside the folders that are
used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building
 locally, if you plan to edit react-native-gradle-plugin and relaunch
 rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here
 would be to invoke the tasks like

```
gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \
   -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \
   -x generateCodegenSchemaFromJavaScript
```

Changelog:
[Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task

Reviewed By: ShikaSD

Differential Revision: D31683721

fbshipit-source-id: fa85793c567796f4e04751e10503717a88cb0620
2021-11-01 05:59:15 -07:00
.bundle Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
.circleci Update ReactAndroid to use the AGP NDK Apis (#32443) 2021-11-01 05:59:15 -07:00
.github Fix issue form description 2021-10-25 10:48:22 -07:00
IntegrationTests Move integration test Buck targets to GitHub 2021-08-04 13:03:21 -07:00
Libraries feat: add `isAccessibilityServiceEnabled` (#31396) 2021-10-29 18:40:59 -07:00
React Move codegen output out of node_modules 2021-10-25 20:48:24 -07:00
ReactAndroid Update ReactAndroid to use the AGP NDK Apis (#32443) 2021-11-01 05:59:15 -07:00
ReactCommon Fix a build issue where codegen order is incorrect (#32480) 2021-10-27 09:45:25 -07:00
bots OSS CI: Store bundle size info for release branch as well (#32418) 2021-10-18 11:06:33 -07:00
docs Generate doc info for RN components 2019-09-19 18:36:25 -07:00
flow Inherit type of queueMicrotask from Flow 2021-10-19 11:30:58 -07:00
flow-typed/npm RN: Add `glob` Flow Definition 2021-10-20 19:25:45 -07:00
gradle/wrapper Bump Kotlin and Gradle versions (#32319) 2021-10-13 06:02:18 -07:00
jest feat: add `isAccessibilityServiceEnabled` (#31396) 2021-10-29 18:40:59 -07:00
keystores Use fb_native_wrapper for all targets 2018-10-31 11:47:42 -07:00
local-cli Update references to the CLI (#23052) 2019-01-21 09:13:08 -08:00
packages Update ReactAndroid to use the AGP NDK Apis (#32443) 2021-11-01 05:59:15 -07:00
repo-config Deploy 0.163.0 to xplat 2021-10-29 19:06:23 -07:00
scripts generate-specs-cli: Parse arguments using yargs 2021-10-29 11:07:38 -07:00
template Update ReactAndroid to use the AGP NDK Apis (#32443) 2021-11-01 05:59:15 -07:00
third-party-podspecs Remove libstdc++ dependency (#32247) 2021-10-08 14:16:54 -07:00
tools/build_defs Followup: fix rn_defs CircleCI build failures 2021-10-20 10:01:26 -07:00
.buckconfig Remove package boundary exceptions in OSS Buck config 2021-08-05 08:44:51 -07:00
.buckjavaargs limiting BUCK's memory for CI 2016-02-01 10:49:33 -08:00
.clang-format Moving ObjC specific clang-format rules to the common config 2019-02-11 13:07:09 -08:00
.editorconfig Revert removal of CRLF from Windows bat files (#31398) 2021-09-09 22:44:32 -07:00
.eslintignore Lint: fix few "no-unused-var" warnings for imports (#30157) 2020-10-26 17:19:14 -07:00
.eslintrc RN: Add `react-test-renderer` Flow Definition 2021-06-06 17:08:55 -07:00
.flowconfig Deploy 0.163.0 to xplat 2021-10-29 19:06:23 -07:00
.flowconfig.android Deploy 0.163.0 to xplat 2021-10-29 19:06:23 -07:00
.gitignore Update ReactAndroid to use the AGP NDK Apis (#32443) 2021-11-01 05:59:15 -07:00
.prettierrc RN: Normalize Prettier Configuration 2021-10-19 01:51:36 -07:00
.ruby-version Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
BUCK Enable complete_nullability on //xplat/js/react-native-github:RCTTypeSafety (#32473) 2021-10-26 17:14:24 -07:00
CODE_OF_CONDUCT.md docs: add new version convenant contribuitor guide link (#32107) 2021-08-30 10:18:11 -07:00
CONTRIBUTING.md docs: update links to forwarded page (#31903) 2021-07-27 11:05:17 -07:00
ECOSYSTEM.md docs: fix url for chainreactconf (#30199) 2020-10-19 07:35:37 -07:00
Gemfile Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
Gemfile.lock iOS Ruby Updates (#32456) 2021-10-21 15:58:18 -07:00
LICENSE Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
LICENSE-docs More licenses 2015-03-24 19:59:10 -07:00
README.md Update README.md (#32277) 2021-09-27 18:55:05 -07:00
React-Core.podspec Remove libstdc++ dependency (#32247) 2021-10-08 14:16:54 -07:00
React.podspec Resolve "fatal: not a git repository" error outside of git repositories 2021-04-15 13:30:31 -07:00
build.gradle.kts Restrict mavenCentral to exclude react-native older packages 2021-10-13 05:34:40 -07:00
cli.js Show full price instead of monthly price within the lead form 2019-03-28 16:07:19 -07:00
gradle.properties Bump Kotlin and Gradle versions (#32319) 2021-10-13 06:02:18 -07:00
gradlew Update Gradle Wrapper to 6.6 (#29613) 2020-08-26 16:37:20 -07:00
gradlew.bat Re-sync with internal repository (#32212) 2021-09-15 10:45:06 +01:00
index.js RN: Deprecate Prop Types 2021-10-21 17:45:47 -07:00
interface.js restore core lib Flow definitions for Request, Response, etc. 2021-01-06 17:24:51 -08:00
jest-preset.js Create `@react-native/polyfills` package. 2020-07-22 03:02:45 -07:00
jest.config.js RN: Remove `fbjs` Dependency 2020-08-28 12:16:26 -07:00
metro.config.js Use newer metro language: `blacklistRE` -> `blockList` (#30342) 2021-10-05 02:26:26 -07:00
package.json Deploy 0.163.0 to xplat 2021-10-29 19:06:23 -07:00
react-native.config.js Migrating RNTester to Packages Directory (#29567) 2020-08-19 17:57:08 -07:00
react.gradle Add bundleForVariant option (#32472) 2021-10-26 04:59:16 -07:00
rn-get-polyfills.js Create `@react-native/polyfills` package. 2020-07-22 03:02:45 -07:00
runXcodeTests.sh Migrating RNTester to Packages Directory (#29567) 2020-08-19 17:57:08 -07:00
settings.gradle.kts Remove `mavenLocal()` 2021-09-22 03:23:00 -07:00
template.config.js imp: Add titlePlaceholder in template.config.js (#26218) 2020-05-12 09:09:23 -07:00
yarn.lock Deploy 0.163.0 to xplat 2021-10-29 19:06:23 -07:00

README.md

React Native

Learn once, write anywhere:
Build mobile apps with React.

React Native is released under the MIT license. Current CircleCI build status. Current npm package version. PRs welcome! Follow @reactnative

Getting Started · Learn the Basics · Showcase · Contribute · Community · Support

React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.

  • Declarative. React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug.
  • Component-Based. Build encapsulated components that manage their state, then compose them to make complex UIs.
  • Developer Velocity. See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app.
  • Portability. Reuse code across iOS, Android, and other platforms.

React Native is developed and supported by many companies and individual core contributors. Find out more in our ecosystem overview.

Contents

📋 Requirements

React Native apps may target iOS 11.0 and Android 5.0 (API 21) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like Expo can be used to work around this.

🎉 Building your first React Native app

Follow the Getting Started guide. The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios:

📖 Documentation

The full documentation for React Native can be found on our website.

The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the React documentation.

The source for the React Native documentation and website is hosted on a separate repo, @facebook/react-native-website.

🚀 Upgrading

Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the Upgrading Guide for instructions.

React Native releases are discussed in the React Native Community, @react-native-community/react-native-releases.

👏 How to Contribute

The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native.

Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native.

Open Source Roadmap

You can learn more about our vision for React Native in the Roadmap.

Good First Issues

We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Discussions

Larger discussions and proposals are discussed in @react-native-community/discussions-and-proposals.

📄 License

React Native is MIT licensed, as found in the LICENSE file.

React Native documentation is Creative Commons licensed, as found in the LICENSE-docs file.