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

6 Коммитов

Автор SHA1 Сообщение Дата
Nicola Corti e89bd4a375 Reduce the amount of C++ code in user space for RN-Tester
Summary:
This diff reduces the amount of C++ code in user space by:
- Moving all the C++ implementation of the .defaults package inside a `react_newarchdefaults` shared library
- Exposing only the entrypoint logic inside the RN-Tester's `OnLoad.cpp` file.

Changelog:
[Android] [Changed] - Reduce the amount of C++ code in user space for New Architecture

Reviewed By: cipolleschi

Differential Revision: D39381820

fbshipit-source-id: 9c4b5596b67b5a7ee58824319c80e325348ed06c
2022-09-12 12:48:43 -07:00
Nicola Corti ba2dae3318 Do not store .cpp/.h files inside src/main/java - turbomodule - take 2
Summary:
Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for turbomodule

I've also updated all the internal usages and references to the new path.

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - turbomodule

Reviewed By: cipolleschi

Differential Revision: D38820638

fbshipit-source-id: febb3f8cef18b30e82c3a4776baa85d0c0d19e4b
2022-08-18 05:53:29 -07:00
Nicola Corti 4706d13ec8 Do not store .cpp/.h files inside src/main/java - fabricjni (#34435)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34435

Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for fabricjni

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - fabricjni

Reviewed By: cipolleschi

Differential Revision: D38741130

fbshipit-source-id: f9e3e4514d3ae0ddeac65256928d71d5134d08f8
2022-08-17 04:58:24 -07:00
Nicola Corti ef0392b7d7 Extend the RN Application.cmake file to support Android autolinking (#34082)
Summary:
This is the companion PR of https://github.com/react-native-community/cli/pull/1630
It extends the `ReactNative-application.cmake` file with instructions to pickup the autolinked libraries.

## Changelog

[Internal] [Changed] - Extend the RN Application.cmake file to support Android autolinking

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

Test Plan: Tested locally as we don't have a way to test autolinking on CI.

Reviewed By: cipolleschi

Differential Revision: D37463203

Pulled By: cortinico

fbshipit-source-id: 0b28e7f214c265ebfec4ccc59ae321f682299cf8
2022-06-28 03:53:19 -07:00
Nicola Corti 6d2872d5a3 Encapsulate all the CMake build logic inside a `ReactNative-application.cmake` file for RN Tester (#33985)
Summary:
The idea behind this is to encapsulate as much build logic as possible inside a `.cmake` file which is contained inside React Native.

This reduces the API surface for the users, once we apply this change to the `template` project, and makes easier for us to evolve native library dependencies on Android, without having to worry about asking users to replicate those changes.

Currently the change is only on RN Tester, will replicate to the template afterwards

## Changelog

[Internal] [Changed] - Encapsulate all the CMake build logic inside a `ReactNative-application.cmake` file for RN Tester

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

Test Plan: Circle CI

Reviewed By: cipolleschi

Differential Revision: D37039658

Pulled By: cortinico

fbshipit-source-id: 536593e3b7227158acba3f0fb6561efaaa9720a5
2022-06-10 02:13:20 -07:00
Nicola Corti f1c614bd0e Build RN Tester with CMake (#33937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33937

This moves the build of RNTester from Unix Make to CMake
This will serve as a blueprint for users that are looking into using CMake end-to-end in their buildls.

In order to make this possible I had to:
* Add an `Android-prebuilt.cmake` file that works similar to the `Android-prebuilt.mk` for feeding prebuilt .so files to the consumer build.
* Update the codegen to use `JSI_EXPORT` on several objects/classes as CMake has stricter visibility rules than Make
* Update the sample native module in `nativemodule/samples/platform/android/` to use CMake instead of Make

Changelog:
[Internal] [Changed] - Build RN Tester with CMake

Reviewed By: cipolleschi

Differential Revision: D36760309

fbshipit-source-id: b99449a4b824b6c0064e833d4bcd5969b141df70
2022-06-06 08:07:14 -07:00