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

508 Коммитов

Автор SHA1 Сообщение Дата
Nicola Corti 3b7044dd07 Bump codegen to 0.0.11 (#32534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32534

Bumping react-native-codegen to 0.0.11 as 0.0.10 was broken (published empty).

Fixes #32533

Changelog:
[Internal] [Changed] - Bump codegen to 0.0.10

Reviewed By: lunaleaps

Differential Revision: D32156067

fbshipit-source-id: 61025b1159d1430728313bd1afcd96f83ee85ff5
2021-11-04 10:33:39 -07:00
Tim Yung fba1ae1643 RN: Temporarily Disable Prettier for Some Files
Summary:
We are in the middle of a Prettier upgrade and some of the files which disagree between Prettier v1.x and v2.x are now being flagged by `eslint-plugin-prettier` as lint errors.

The correct fix here is probably to update `eslint-config-prettier` and `eslint-plugin-prettier`, but I am landing this first to unbreak CI.

Reviewed By: mendoncakeegan

Differential Revision: D32129458

fbshipit-source-id: a5206a5ef58f1d7614f9459c99b9e39109be6de9
2021-11-02 23:09:38 -07:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Tim Yung 4e587a1b7d JS: Upgrade to Prettier v2.4.1 [1/n]
Summary:
Changelog:
[General][Changed] - Upgraded to `prettier@^2.4.1`.

Reviewed By: zertosh

Differential Revision: D31854010

fbshipit-source-id: 6d7a2e758a3ddf7c758ceffb14d98eb93b0ce4b0
2021-11-02 22:14:16 -07:00
Ramanpreet Nara 27ddbd8137 Refactor: Simplify deprecated component code-gen logic in View Config generator
Summary:
**Motivation:** Readability. It was hard to tell how componentName, paperComponentName, and paperComponentNameDepreacted produced the NativeComponentRegistry.get call.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D32108276

fbshipit-source-id: ea7c9fe4dc50cdd6fec94b5cd25f7bbcfb451ef6
2021-11-02 21:27:36 -07:00
Nicola Corti 8fef52035b Bump codegen to 0.0.10
Summary:
For the sake of the playbook, I'm bumping the codegen to the latest stable.
This is needed as there was a change in the Android NDK Makefile that wasn't shipped yet.

Changelog:
[Internal] [Changed] - Bump codegen to 0.0.10

Reviewed By: hramos

Differential Revision: D32101355

fbshipit-source-id: c20268f1ea93ebad8f92f760874a43c8ceeaf9f9
2021-11-02 12:22:17 -07:00
Ramanpreet Nara 857137dc21 Create E2E tests for Component Generators
Summary:
## Rationale
- We actually don't have E2E tests that test the parser + generator together, until now.
- **Documentation Value:** These tests show how the Component Spec files in [react-native-codegen/e2e/__test_fixtures__/](https://www.internalfb.com/code/fbsource/[e32a790dfa05]/xplat/js/react-native-github/packages/react-native-codegen/e2e/__test_fixtures__/components/) map to all the different types of codegen output.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D32081445

fbshipit-source-id: 02cd17945ef63a42381d6d4adbd0a9b0eaa2a1ef
2021-11-02 10:54:11 -07:00
Ramanpreet Nara 3848f48943 Use JavaScript functions for Component templates
Summary:
## Rationale
**Disclaimer**: This is an incremental step towards more maintainable/readable react-native-codegen generators. In the future, we may want to replace these templates/string concat logic with *something better*. But until we decide what that *something better* is, let's at least get rid of all this gross string find/replace.

Benefits of using Function templates over String.prototype.replace.
- **Self-documenting**: Template Functions enumerate/describe their exact data dependencies in their signature. You no longer have to read the template implementation to see what data you need to pass into the template.
- **Improved Readability**: JavaScript syntax highlighting makes it really easy to see where/how the data is inserted into the templates. Also template variables used be prefixed/suffixed with ::, which made things really confusing in C++ code (e.g: wtf is `::_CLASSNAME_::EventEmitter::::_EVENT_NAME_::`?).
- **Simpler Interpolation**: Don't have to worry about .replaceAll vs .replace, or calling these replace functions with regexes or strings.
- **Template Type-safety**: Ensure that the correct data types are passed to the component templates (e.g: flow will complain if you accidentally pass null/undefined when a template expects a string).
- **Template Type-safety**: Ensure that we don't pass in extra data to templates (this diff catches/fixes instances of this error). Ensure that we don't forget to pass in data to the template.
- etc.

After this diff, both our Component and NativeModule generators will be using template functions. This string find/replace exists no more in react-native-codegen.

This is also a very surface-level change. I made no efforts to simplify these templates. Let's take a look at that later, as necessary.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32021441

fbshipit-source-id: f8f27069bcbf9d66dcafb7d1411da1f938eb6dcd
2021-11-01 09:00:24 -07:00
Ramanpreet Nara 58c9d8eda7 Fix "Duplicate license header lint error" in Component generators
Summary:
See title.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32019151

fbshipit-source-id: aea69a6c032cef1c99cd7641bdc10e730076e781
2021-10-29 10:43:39 -07:00
Nicola Corti a9fc0c5a9c Re-add libreact_debug to codegen makefile and add prebuilts for them
Summary:
While working updating the codeden Makefile template for Android, I've removed
the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a
simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies.

Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid`
failing to build (see the build status for https://github.com/facebook/react-native/pull/32443).

I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt
makefile (used in the playbook) to include `react_debug` prebuilts as they were missing.

Changelog:
[Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them

Reviewed By: ShikaSD

Differential Revision: D31900675

fbshipit-source-id: ff188c0498a0dca4a951a548a580ca8dd0674782
2021-10-27 09:20:35 -07:00
Nicola Corti e3a71b019f Bump react-native-codegen to 0.0.9
Summary:
Bumping the codegen to a new version to ship a change to the Android template.

Changelog:
[General] [Changed] - Bump react-native-codegen to 0.0.9

Reviewed By: hramos, mdvacca

Differential Revision: D31762139

fbshipit-source-id: 71a96210a3577c12ff3c9f9013c6e72adf4a0ecb
2021-10-22 03:09:24 -07:00
Tim Yung 9ac03361e6 RN: Add `glob` Flow Definition
Summary:
Adds the `glob` type definition via `flow-typed` so that the `combine-js-to-schema-cli.js` script does not need a Flow suppression.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D31800809

fbshipit-source-id: 3e01a096d2153639a619a7152bd06332df57f06b
2021-10-20 19:25:45 -07:00
Nicola Corti c7d0c94bf9 Update codegen template to include correct native modules and C++17
Summary:
This diff updates the Makefile generated by `react-native-codegen`
to include the correct list of modules. Specifically I've removed some modules that are unused
like `libreact_debug` and added others that are necessary for the build to compile correctly
such as `libfbjni`.

Plus I've bumped the C++ version to 17 as we had a mixture of 14 and 17 across the codebase.

Changelog:
[Internal] [Changed] - Update codegen template to include correct native modules and C++17

Reviewed By: mdvacca

Differential Revision: D31754427

fbshipit-source-id: 8490fa5c5ad298689b564f760c3fc65550c94547
2021-10-20 10:19:10 -07:00
Sota Ogo 8fcc2fa31a Update the path to use the full path so that they can be found in the OSS environment.
Summary:
I had to make this change when enabling Fabric in OSS. Without the full path, it can't find the modules like processColor within node_modules.

Changelog: Internal

Reviewed By: motiz88

Differential Revision: D31300424

fbshipit-source-id: 59b82470ec1ce63b63704931786e22b98f4bf046
2021-10-19 18:35:13 -07:00
Tim Yung ba7424d4d2 RN: Normalize Prettier Configuration
Summary:
Changelog:
[Internal]

Reviewed By: zertosh

Differential Revision: D31745469

fbshipit-source-id: b930e4aefd8d21021b7c43a48ee84d0546fb56eb
2021-10-19 01:51:36 -07:00
Joshua Gross b60e229d7f Remove compiler_flags from BUCK modules
Summary:
Nearly all of these are identical and these compiler_flags are now centralized in rn_defs.bzl. This should have NO CHANGE on build configuration, the flags have just moved for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31631766

fbshipit-source-id: be40ebeb70ae52b7ded07ca08c4a29f10a0ed925
2021-10-14 15:34:29 -07:00
Moti Zilberman 268efb1022 Use deep require instead of Haste for NativeComponentRegistry
Summary:
Changelog: [Internal]

Some environments that use codegen don't have Haste enabled, breaking the `require('NativeComponentRegistry')` call in generated view configs. Here we change it to reference an explicit path relative to `react-native`.

Reviewed By: JoshuaGross

Differential Revision: D31166063

fbshipit-source-id: cebc23d0d95b5cde76d0f8473eabc03ca82a862e
2021-09-27 13:47:28 -07:00
Héctor Ramos b494ae0703 Move react-native-codegen dependency to react-native root package.json
Summary:
The `react-native-codegen` package handles the generation of native code artifacts for modules and components in the new React Native architecture.

This change moves the dependency from being an application-level dependency to being a direct dependency of the `react-native` package.

Changelog:
[General] Move react-native-codegen dependency to react-native root package.json

Reviewed By: yungsters

Differential Revision: D31129619

fbshipit-source-id: dfa0df589c4dbca70dde6db0208485431e304809
2021-09-23 21:40:22 -07:00
Andrei Shikov e6fcbc5076 Only glob src folder of codegen for buck compilation
Summary:
RN codegen generates `lib/` folder in OSS which invalidates caches for macOS build. By only globbing `src/` folder we can avoid these issues.

Changelog:
[Internal] Exclude codegen files built in OSS to fix internal build.

Reviewed By: cortinico, motiz88

Differential Revision: D30959522

fbshipit-source-id: 6371beb3997bc15ed155a7f7871fb80c199367a3
2021-09-15 18:31:37 -07:00
Nicola Corti c3ff336326 Merge the two Gradle Plugins (#32177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32177

This diff merges the `react-native-gradle-plugin` and the `react-codegen/android` into a single plugin.
This will allow us to iterate faster on a single plugin, will create less confusion for our users (`react` vs `reactApp`)
and will help us avoid race conditions when the two plugins are applied together (as we will control the whole lifecycle of it).

Changelog:
[Internal] [Changed] - Merged the two Gradle Plugins

allow-large-files

Reviewed By: ShikaSD

Differential Revision: D30765147

fbshipit-source-id: fcb02a181c7d900daa514107c637d0ee0225976c
2021-09-15 03:21:23 -07:00
Facebook Community Bot 671068f28d
Re-sync with internal repository (#32212)
Co-authored-by: Facebook Community Bot <6422482+facebook-github-bot@users.noreply.github.com>
2021-09-15 10:45:06 +01:00
Sota Ogo 286df9000e Throw when extendsProps is empty
Summary:
If I understand the code correctly, component.extendsProps is expected to have more than 1 entry. I encounter a bug where it was an empty and produced an broken Props.h file while testing out in OSS.

```
// Example of the broken file.
class RNTMyNativeViewProps final :  {
 public:
```
In this diff, it makes it clear that the function has failed so that the codegen fails when the input is wrong.

There is probably an upstream problem that we should warn about, but this diff is just to make sure this method fails loudly.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D30847173

fbshipit-source-id: 34c894f0a7bb81e132b6ed44f51d0f92ed9a5a20
2021-09-14 11:47:38 -07:00
Sota Ogo 2a0293906f Add an error message when there is no modules to process in codegen
Summary:
Adding an error message when codegen doesn't recognize any modules to help users understand what's going on.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D30624535

fbshipit-source-id: 781f1f874a5b0c16a05191186b81c2d3892da95b
2021-09-09 17:26:19 -07:00
Timothy Yung ab2bdee735
Fix encoding for gradlew.bat files (#32178) 2021-09-09 14:33:50 -07:00
Nicola Corti b1120c6a65 Bump Gradle to 7.1.1 (#32138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32138

This is a follow up to the Gradle bump: D30486612 (85249cafe8)

Changelog:
[Android] [Changed] - Bumped Gradle to 7.1.1

Reviewed By: ShikaSD

Differential Revision: D30698411

fbshipit-source-id: ae51499c36380dca6763abeaf04ab3d6ca37456d
2021-09-02 04:31:42 -07:00
Nicola Corti 85249cafe8 Update project to build on Gradle 7.0.2 (#32073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32073

This Diff bumps the version of Gradle used to build the project to
7.0.2. Ideally we could bump to 7.2.x directly, but I'll do one minor version
at a time to exclude potential build problems.

This diff is addressing all the extra build warnings that got raised by the new version.

Changelog:
[Android][Changed] - Bumped Gradle project version to 7.0.2

Reviewed By: ShikaSD

Differential Revision: D30486612

fbshipit-source-id: 70e0f7d18e547013ca7b1d12f8dd64a633df5870
2021-08-31 13:27:27 -07:00
Neil Dhar 1bc885b8b8 Make JSI a dynamic library
Summary:
Ship libjsi as a standalone dynamic library. This prevents problems
with exception handling caused by duplicate typeinfo across multiple
shared libs, and reduces bundle size by removing duplicate copies of
JSI.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30599215

fbshipit-source-id: abad1398342a5328daa825f3f684e0067cad7a96
2021-08-27 17:16:49 -07:00
Chatura Atapattu 2c2b831716 Apply new buildifier fixes
Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30407205

fbshipit-source-id: 022a02829d59a900764b228afb9856ed1ba2cf8c
2021-08-19 20:01:02 -07:00
Nicola Corti 1f8c5607b2 Flatten the `react-native-codegen` included build. (#32007)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32007

This Diff simplifies the codegen Gradle build.
Previously the build used to have a 2-level nesting of included build.

Turns out that the `react-native-codegen/android/build.gradle` build
is just providing a task and including an inner build that contains the codegen
Gradle plugin. I've moved such plugin to the outer build.

This will also make sure that the Gradle plugin files are properly index by the
IDE when opening the build (as nested included build are not yet supported).

Changelog:
Internal - Flatten the `react-native-codegen` Gradle included build

Reviewed By: fkgozali, ShikaSD

Differential Revision: D30227784

fbshipit-source-id: af304afeeba1926f8b7b5b47cf69889d3f808f5f
2021-08-12 05:14:58 -07:00
Nicola Corti ae494e7ce1 Bump AGP to 4.2.2
Summary:
This is just a minor bump in the Android Gradle plugin.

Changelog:
[Android][Changed] - Bumped AGP to 4.2.2

allow-large-files

Reviewed By: ShikaSD

Differential Revision: D30220591

fbshipit-source-id: 217a21e4935bcd258ac3bcd45c7fb1ff5c0a1ead
2021-08-12 02:43:16 -07:00
David Vacca 809fd7eab2 Add TODO to fix and enable 'generated_tests-codegen_testsAndroid'
Summary:
Add TODO to fix and enable 'generated_tests-codegen_testsAndroid'

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D30046143

fbshipit-source-id: dbeba6f1d51b32c069bda8bb9ca976014d299dae
2021-08-02 15:36:33 -07:00
David Vacca cdce14f670 Implement PlatformColor in Fabric Android
Summary:
This diff implements PlatformColor in Fabric Android

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D29841461

fbshipit-source-id: 63a523626b021c634bc399e749b639b55730391a
2021-07-30 22:16:08 -07:00
Joshua Gross 175b1ea636 Pass PropsParserContext to prop parsing layer
Summary: Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D29921232

fbshipit-source-id: ba045f545b564aedf1b287045a0e75428de30a0f
2021-07-28 20:18:20 -07:00
Joshua Gross 5d33e65694 Pass context through to all prop parser (props structs changes)
Summary:
See previous diffs for context. This updates all of the relevant props structs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29855426

fbshipit-source-id: 30177c3380ef82ecf8f2a4321f128cfbe8a576e0
2021-07-28 20:18:20 -07:00
Dustin Shahidehpour 35a4ba01e8 explicitly set autoglob=False on programatically created targets.
Summary:
I'm going to be flipping the default from autoglob on `fb_apple_library` to `True`. This prepares the target so that there are no behavior changes.

## Changelog: [Internal]

Reviewed By: natestedman

Differential Revision: D29769271

fbshipit-source-id: a20b4f99f00613c092461979b4afe61bdca9fe37
2021-07-19 13:57:43 -07:00
Tim Yung 92c13f0d1d RN: Replace `master` with `main` in Documentation
Summary:
Updates documentation in React Native to reference `main` (or `HEAD` for URLs) instead of `master`.

Part of https://github.com/facebook/react-native/issues/31788.

Changelog:
[General][Changed] - Update documentation reference from `master` to `main` or `HEAD`.

Reviewed By: JoshuaGross

Differential Revision: D29717128

fbshipit-source-id: 0b0babd8407c6fd3d0e5431f6eaf976059731d6f
2021-07-15 15:22:57 -07:00
Andrei Shikov 01c3bcdab0 Support string type for commands
Summary:
String type seems to be already supported by codegen, but it was not included in the list for command methods.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D29306740

fbshipit-source-id: 44b267c09f471dc601759ed2f7211a9e0fc1bb90
2021-06-22 15:31:47 -07:00
Daniel Sainati 974f0a3281 pre-suppress this typing errors ahead of 154
Summary:
This pre-suppresses the 154 error diff ahead of its release, since it is large.

Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D29065246

fbshipit-source-id: f418041305a46df410dcbe3d9a4db81a61ac7014
2021-06-11 14:31:41 -07:00
Dulmandakh 70da640946 remove jcenter (#31609)
Summary:
jcenter is read-only now, and newer versions of dependencies will be published to either MavenCentral or Jitpack. This PR removes jcenter to avoid future issues, then uses MavenCentral and Jitpack as replacement. Current flipper depends on Stetho version that is not available on MavenCentral, so had to exclude and bump the version.

Both Gradle and Buck successfully download all the dependencies.

## Changelog

[Android] [Changed] - Remove jcenter

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

Test Plan: rn-tester builds and runs as expected.

Reviewed By: mdvacca

Differential Revision: D28802444

Pulled By: ShikaSD

fbshipit-source-id: 043ef079d0cda77a1f8dd732678452ed712741a4
2021-06-02 09:57:28 -07:00
Dulmandakh 547b4c92e4 Gradle 6.9, Android Gradle Plugin 4.2.1 (#31593)
Summary:
Bump Gradle to 6.9 which supports Apple Silicon, also Android Gradle Plugin 4.2.1 which defaults to Java 1.8 so no additional config required.

## Changelog

[Android] [Changed] - Bump Gradle to 6.9, Android Gradle Plugin to 4.2.1

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

Test Plan: rn-tester builds and runs as expected

Reviewed By: mdvacca

Differential Revision: D28711942

Pulled By: ShikaSD

fbshipit-source-id: 2a4616cd0f17db7616ab29dea1652717f2cd0f6d
2021-06-01 11:29:51 -07:00
Daniel Sainati 74d5d03dbd pre-suppress Flow errors in xplat ahead of 153 release
Summary:
This pre-suppresses the 153 error diff ahead of its release, since it is large.

Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D28754374

fbshipit-source-id: 1806f53bc7d804644d434583a2dcd6da63d00328
2021-06-01 09:01:26 -07:00
Erich Graham fa4045e4dd Add ios_assume_nonnull flag to react native codegen library (#31543)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31543

Changelog:
[iOS][Added] - Description

When compiling iOS apps with flag `-Wnullability-completeness` (like Lightspeed app and soon Instagram), Objective-C headers are required to either have full *explicit* nullability annotations on all members of its public API, or none at all; partially annotated headers will fail to build that module.

RN native modules are currently generated with *partial* annotations.  This works today because most apps are not compiled with `-Wnullability-completeness` turned on. But when we flip the switch for Instagram, the app doesn't build due to importing these RN partially annotated modules.

JavsScript Flow types are implied nonnull, and the current RN codegen translates Flow's [maybe/optional](https://flow.org/en/docs/types/maybe/) type to Obj-C `_Nullable` annotation, and everything else without an explicit Obj-C annotation. However this creates a mismatch with the Obj-C type system, where the implied default is *unannotated*, which is handled differently from nonnull when built with the nullability compiler flags.

There is a simple Obj-C macro that automatically adds *explicit nonnull* annotations to all members in a header: `NS_ASSUME_NONNULL_BEGIN` / `NS_ASSUME_NONNULL_END`. If we add this to *all* RN-generated headers, however, we run into issues:
1) We may erroneously assume any previously-unannotated header was meant to be nonnull and cause future bugs
2) Another compiler flag (`-Wnullable-to-nonnull-conversion`) statically analyzes Obj-C implementation code to prevent us from ever passing null to one of these headers. Much existing Obj-C code will break here, and it's ambiguous if these are true or false positives because of the first point.

Instead, in this diff we add a new BUCK flag `ios_assume_nonnull` to let module authors opt into automatic nonnull for unannotated members so that Obj-C headers are generated correctly in alignment with Flow's type system. We can migrate all libraries individually as needed and eventually make this the RN native codegen default.

Reviewed By: RSNara

Differential Revision: D28396446

fbshipit-source-id: ad3a3a97ab19183df4ef504b1c3140596c8f69ca
2021-05-20 10:07:37 -07:00
Micha Reiser 58a0f9b4e2 Upgrade babel from 7.12.3 -> 7.14.1
Summary:
Changelog:

[General] [Changed] Upgrade Babel from 7.12.3 to 7.14.1

Reviewed By: motiz88

Differential Revision: D27851184

fbshipit-source-id: 59326332d1d188f163cdb034556eea7808824360
2021-05-13 02:48:09 -07:00
Pavlos Vinieratos 73844712b6 Fixing the git attrs for all the people and all the files and all future (#31128)
Summary:
We have had problems with `.gitattributes`, `.bat` and `.pbxproj` (Xcode) files for a while. The two main concerns were:
- Xcode project files not diffing correctly.
- Windows files having messed up line endings.
This PR fixes both issues, hopefully forever.

After seeing the diffs from v0.63 -> v0.64 and the changes in https://github.com/facebook/react-native/pull/29792, I, again, felt that this is going to cause problems, so I looked into both issues.

I started with `git check-attr -a Artsy.xcodeproj/project.pbxproj` after removing the `.gitattributes` file that contained `*.pbxproj -text` and there are no "guessed" attributes that would break things, and diffing and checking in worked well with the current git version. I agree this is not needed, so I left it out.

I looked into what it was doing before, and it was telling git (for the xcode project file) to "unset text", which means (according to https://git-scm.com/docs/gitattributes#_text) that it should not try to do any line ending changes when checking in that file. At some point git must have done this, and that's why it was needed, but no more, so it's safe and good to get rid of this, as it helps with nothing anymore.

Now for the bat files. We don't need any extra instructions for `gradle` and `*.sh` files as they are guessed correctly, so these are also safe to keep removed (https://github.com/facebook/react-native/pull/29792/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393eL5).

But we do need the `*.bat` instruction. I noticed that when working on macOS there were two problems that made things funky.
- One, is that the editor (usually vscode but not the important) would convert line endings to lf when editing a bat file.
- Two, is that git thought the files are lf line endings.

To fix the first one, I added a rule in `.editorconfig` (that's whats important, when any editor just supports editorconfig, but all my editors do). I can't believe how we missed that for sooooo long {emoji:1f605}!

To fix the second, I added the `.gitattributes` instruction **and** `renormalize`d the files (https://git-scm.com/docs/git-add#Documentation/git-add.txt---renormalize and https://docs.github.com/en/github/using-git/configuring-git-to-handle-line-endings#refreshing-a-repository-after-changing-line-endings). I think the problem all along was that even though the files had crlf, git still thought they were using lf.

After the editorconfig change and the renormalization, everything behaves correctly and as expected. Changing bat files on macOS and Windows is fine now, producing only the smallest change needed, no random line ending diffs. Also here is a screenshot of one of the files actually crlf. It's these tiny things at the end of each line {emoji:1f453}.
<img width="612" alt="Screenshot 2021-03-10 at 12 20 28" src="https://user-images.githubusercontent.com/100233/110630943-ef536280-819d-11eb-9212-dbd70f038a44.png">

I have tested this on macOS and Windows, doing changes in both bat and xcode files, and verified that diffing and checking in files works well.

## 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] [Added] - Added an `.editorconfig` file to help with default line endings for Windows files.

[Internal] [Fixed] - Added a rule in `.editorconfig` and `.gitattributes` to help with default line endings for Windows files.

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

Test Plan: Feel free to go on a macOS or Windows machine (or both) and, using any editor that supports editorconfig, do any change in a `.bat` file. Then look at your git diff in terminal or gui or whatever you use, and then look at the sky and smile. It's fixed. The diff is just your change. Everything is as it should {emoji:1f49c}.

Reviewed By: nadiia

Differential Revision: D27914636

Pulled By: hramos

fbshipit-source-id: fc4e53a4fa42cb13e29686669e8de1679c2242e7
2021-04-21 11:27:32 -07:00
Samuel Susla 9ef995a14a Enable C++ 17 in React Native
Summary:
Changelog: [Internal] enable support for C++ 17.

C++ 17 in React Native targets.

Short and comprehensive list of C++ features:
https://github.com/AnthonyCalandra/modern-cpp-features#c17-language-features

Reviewed By: JoshuaGross

Differential Revision: D27431145

fbshipit-source-id: e8da6fe9d70e9b7343a8caec21cdbeb043478575
2021-04-01 04:50:59 -07:00
Luna Wei bac2c2c801 Update FlowFixMes to use error codes in react-native-github
Summary:
Changelog:
[Internal] - Add error codes to existing FlowFixMe's

Reviewed By: kacieb

Differential Revision: D27445689

fbshipit-source-id: 2b19692e1cb822ab6785efcc5f93ee33e7dce1e5
2021-03-31 18:21:47 -07:00
Ramanpreet Nara 74682c54f9 Add @DoNotStrip to every Pojo and every Pojo method
Summary:
This should ensure that nothing is stripped at compile-time.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26094738

fbshipit-source-id: 8dd62c289deafdcceb3de4b09c12132aaceafa94
2021-03-22 18:23:28 -07:00
Andrei Shikov ac704690dc Update Android.mk to ensure the rn-tester compiles in debug mode
Summary:
Changelog: [Internal]

Adds react_debug dependency in Android.mk where it was missing

Reviewed By: mdvacca

Differential Revision: D26617400

fbshipit-source-id: 5ac799269b106eadd881d30490ac34bd2134a9b7
2021-02-24 12:29:00 -08:00
Andrei Shikov dbbc1c1624 Add react build app plugin and extension
Summary:
Changelog:
[Android][Added] - Basic definition for react gradle plugin

Adds plugin and build configuration + copies config from react.gradle to extension.
Copies internals of react.gradle to the plugin. Will be refactored in the next commits.

Reviewed By: mdvacca

Differential Revision: D25693008

fbshipit-source-id: b0feaa02cee8a1ee94d032426d19c501ff3b2534
2021-02-22 08:16:51 -08:00
Igor Klemenski c37d49492b Work around max path length during source build of RN Android (#30776)
Summary:
Building ReactAndroid from source on Windows has recently hit the limitation of maximum path lengths.
At build time, during the `:ReactAndroid:buildReactNdkLib` task, the linker tries to access several of the intermediate binaries located deep in the tmp folder hierarchy, eg.
```
D:\r\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/react_render_components_progressbar/D_/r/ReactAndroid/__/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.o
```
**Suggested fix:** for modules such as `react_render_components_progressbar` and `react_render_components_picker`, rename them to `rrc_progressbar` etc.

**NOTE**: this assumes that the fix from https://github.com/facebook/react-native/issues/30535 is in place. This regression happened while https://github.com/facebook/react-native/issues/30535 has been pending checkin.

**Other mitigations I've tried:**
- setting [`LOCAL_SHORT_COMMANDS`](https://developer.android.com/ndk/guides/android_mk#local_short_commands) for the problematic modules or `APP_SHORT_COMMANDS` for the root project. Turns out those commands don't work on the NDK version RN requires, but even after manually applying a [patch ](https://android-review.googlesource.com/c/platform/ndk/+/1126440) to my local copy of the NDK, these flags had no effect.
- moving the repo directory higher in the file system tree, and using short directory names `D:\r\...` was not enough
- creating virtual drive letters for specific long paths with the [`sust`](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/subst#examples) command is not workable, since they depend on the source folder structure, and get partly generated by the build system, which I can't plug into
- just enabling long path support on Windows is not enough, since the compiler toolchain doesn't support them.
## 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
-->

[Android] [Fixed] - Fix source build on Windows machines vol. 2

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

Test Plan:
Run `.\gradlew installArchives`

Before:
![image](https://user-images.githubusercontent.com/12816515/105435667-a1e15d00-5c12-11eb-9fcd-d0c278aaf477.png)
Now:
![image](https://user-images.githubusercontent.com/12816515/105435741-c2a9b280-5c12-11eb-88d5-a69ae56bbf50.png)

Differential Revision: D26194286

Pulled By: mdvacca

fbshipit-source-id: 778b5a0515148e2ace19e7902f74301831ebed94
2021-02-11 12:32:33 -08:00