Summary:
This diff adds a `package.json` inside `react-native-gradle-plugin`
so it can be distributed and used inside the `template/` project
similarly to what we do with the `react-native-codegen` package.
Changelog:
[Internal] [Added] - Setup a package inside `react-native-gradle-plugin`
Reviewed By: fkgozali
Differential Revision: D31081980
fbshipit-source-id: 9a9ad696ee6db01666bae75255616fd20aadd243
Summary:
This diff fixes a bug with `GenerateCodegenArtifactsTask` that was causing
two generators to be called one after the other (first the JS and then the Java one).
Now they're mutually exclusive.
Changelog:
[Internal] [Changed] - Fix GenerateCodegenArtifactsTask calling two generators with Java enabled
Reviewed By: ShikaSD
Differential Revision: D31169379
fbshipit-source-id: 668d8e440ad6b3f06654f29c5cbc344ef82c4b9c
Summary:
This file was placed in the wrong package. I'm moving it.
Changelog:
[Internal] [Changed] - Move `PathUtilsTest.kt` to the correct package
Reviewed By: motiz88
Differential Revision: D31168890
fbshipit-source-id: 59d09b5fd329b776bd2800921889281a116c26ee
Summary:
Adding tests for the `GenerateCodegenSchemaTask`.
Plus fixing a bug where `delete()` was used instead of `deleteRecursively` causing
the files inside the output folder to don't be properly cleaned up.
Changelog:
[Internal] [Changed] - Add unit tests for GenerateCodegenSchemaTask
Reviewed By: ShikaSD
Differential Revision: D31142346
fbshipit-source-id: 69bb026fa2c64d91193a153fdc99c9b5d0a9e1ff
Summary:
This Diff is adding some tests for BuildCodegenCLITask.
Plus I found a bug in how we pass the input/output relative to `codegenDir`
so I'm fixing the properties to use `by lazy{}`.
Moreover the `output` was not correctly annotated with `OutputDirectories`,
fixing it here.
Changelog:
[Internal] [Changed] - Add unit tests for BuildCodegenCLITask
Reviewed By: ShikaSD
Differential Revision: D31109599
fbshipit-source-id: bec75b216e8cef18072179c89c3223ee2bad74e3
Summary:
Since we moved several classes from the older Java plugin to standalone files,
we can now remove the old `CodegenPlugin.java` class and have a single plugin class.
Changelog:
[Internal] [Changed] - Merge `CodegenPlugin` with `ReactAppPlugin`
Reviewed By: ShikaSD
Differential Revision: D31080558
fbshipit-source-id: c4b005f8648ab62a71cb5bee22c06ae5272ecc44
Summary:
This is the last task from the Codegen Plugin that is exported to
its own Task file and converted to Kotlin.
Changelog:
[Internal] [Changed] - Export `GenerateCodegenArtifactTask` to its own task.
Reviewed By: ShikaSD
Differential Revision: D31054781
fbshipit-source-id: 6787065b497570fb312310e3d9f4120f0629f374
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
Summary:
Similarly to the previous diff, this is moving another small part of the codegen
to its own Kotlin separate task. I've used the Gradle idiomatic APIs and added a couple of tests.
Changelog:
[Internal] [Changed] - Export `GenerateCodegenSchemaTask` to its own task.
Reviewed By: ShikaSD
Differential Revision: D31017274
fbshipit-source-id: f0d288a63883e92a9d725eb3bf695a3aa77f9030
Summary:
This diff moves `BuildCodegenCLITask` from being inlined to have its own task definition
I've also cleaned up the task body and refactored a bit how we do the CLI invocation.
Changelog:
[Internal] [Changed] - Export `BuildCodegenCLITask` to its own task class
Reviewed By: ShikaSD
Differential Revision: D31016610
fbshipit-source-id: 8407fc2a62ea473daa775196925c1b9b6f4f2f4b
Summary:
Folly now depends on libc++abi. This solves linker error for RCT-Folly.podspec like this:
```
Undefined symbols for architecture arm64:
"___cxa_increment_exception_refcount", referenced from:
folly::exception_ptr_get_type(std::exception_ptr const&) in libRCT-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
See https://github.com/react-native-community/releases/issues/251
Note: RNTester was not affected by this bug for some reason, so the only way to verify is via the new app generated via `npx react-native init`.
Changelog: [Fixed][iOS] Unbreak Folly linker error
Reviewed By: lunaleaps
Differential Revision: D30950944
fbshipit-source-id: 3eb146e23faa308a02363761d08849d6801e21ca
Summary:
Use `js_glob()` to guarantee that we're only processing JS related files, not iOS/Android files.
Changelog: [Internal]
Reviewed By: sota000
Differential Revision: D30982575
fbshipit-source-id: 9a5466fd16f41558f2bfb294aaed2a551ec4334b
Summary:
I'm cleaning up the extension to be just ReactExtension and not ReactAppExtension.
Similarly the name of the extension will be just `react` and not `reactApp`.
Changelog:
[Internal] [Changed] - Rename extension to just ReactExtension
Reviewed By: ShikaSD
Differential Revision: D30964793
fbshipit-source-id: 8a4207825d424e133e51495c34c21284c50363ae
Summary:
It is no longer necessary to specify USE_FABRIC=1 when running `pod install` in order to enable Fabric in RNTester.
Changelog: [INTERNAL]
Reviewed By: fkgozali
Differential Revision: D30977549
fbshipit-source-id: fccc3e433041a710b02ddc516cdff07ce7af2409
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
Summary:
The IDE is complainign as we're using capitalization functions that
are not locale-independent. I'm changing this to use `Locale.ROOT`.
Once we move to Kotlin 1.5 we're going to replace those functions with newer ones.
Changelog:
[Internal] [Changed] - Use Locale.ROOT for capitalization of variant names
Reviewed By: ShikaSD
Differential Revision: D30958992
fbshipit-source-id: 225af4e7e323f143ab75bad106f3bca3db510b22
Summary:
This Diff is merging over all the properties from `CodegenPluginExtension` to
`ReactAppExtension`. Some of the properties were duplicate and generally having two
extensions is creating a lot of confusion for the users (e.g. don't know where to place a
specific property).
Therefore I'm merging the two to have only one. I've also updated the property to use the
Gradle Lazy Configuration API.
Changelog:
[Android] [Changed] - Gradle: Merge CodegenPluginExtension inside ReactAppExtension
Reviewed By: ShikaSD
Differential Revision: D30961343
fbshipit-source-id: 66be3157efef356392c0701aaef2283d058d3161
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32214
This Diff updates part of the Gradle plugin to use the Gradle Lazy Api (mostly `Property` classes).
This will defer the time when those value are accessed from configuration to execution phase.
So far I've converted the `Extension` class that should be our primary entry point to the public API.
I haven't converted the tasks as well, therefore we have several `.get()` calls around now.
I'll take care of them once I go over the Tasks file as well.
Moreover, I added some documentation to the Extention properties, as those will show up in the `build.gradle`
autocompletion for our users.
On the API point of view, this is going to be a breaking change for users that are testing the Gradle plugin AND
are on Gradle Kotlin DSL (which I believe are really limited so I don't think is a problem at the moment). Users
relying on `react.gradle` are unaffected.
Changelog:
[Internal] [Changed] - Use Gradle Lazy API
Reviewed By: ShikaSD
Differential Revision: D30902517
fbshipit-source-id: 5af4625e901b82f4b1c65bd631aa4bb9b505b2d0
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
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
Summary:
Seems like we discard the `extraArgs` for `BundleJsAndAssetsTask` and it doesn't look right.
I'm fixing it here.
Changelog:
[Internal] [Changed] - Do not wipe extraArgs for `BundleJsAndAssetsTask`
Reviewed By: ShikaSD
Differential Revision: D30902743
fbshipit-source-id: 787a7fafab1d3f62d9fdc84d4f55a0cc381bcef8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32193
This Diff is backporting the change in https://github.com/facebook/react-native/pull/31839/
applied to `react.gradle` also to the React Gradle Plugin. Ideally we would like to two
logic to be in sync as much as possible.
Changelog:
[Internal] [Changed] - Backport the cliPath fix to the Gradle Plugin
Reviewed By: ShikaSD
Differential Revision: D30899057
fbshipit-source-id: a28628b36b3dfe565dbdc8d6416c5d25ddf1fe03
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32194
This Diff fixes the `test_android` CircleCI that is currently broken due to a faulty `BundleJsAndAssetsTask`
(that's my fault sorry for this).
The CI is failing with a `execCommand == null!` error message. The message is happening as the aformentioned
task is not correctly overriding `exec()` but just declaring a `TaskAction`. I'm fixing it.
Changelog:
[Internal] [Changed] - Fix broken Android CI due to broken `BundleJsAndAssetsTask` override
Reviewed By: GijsWeterings
Differential Revision: D30899742
fbshipit-source-id: a39b01b7d429bd7e87411282e1c22a7606ea22e0
Summary:
Another diff to remove code from `ReactAppExtension` to a Util file and test it.
Changelog:
[Internal] [Changed] - Export and test `detectedHermesCommand` function from `ReactAppExtension`
Reviewed By: feedthejim
Differential Revision: D30866510
fbshipit-source-id: 0023a063793d669ee4b2190679ca7fbd01e9a3fc
Summary:
First part of the codegen script cleanup effort. Everything that was done in generate-specs.sh is now part of the CocoaPods recipe (e.g. codegen method in `react_native_pods.rb`).
Now that `generate-specs.sh` has been removed, the codegen may still be invoked manually for test purposes like so:
```
cd react-native
# Generate Schema - do this whenever your JS specs change
node packages/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js <output_file_schema_json> <javascript_sources_dir>
# Generate native interfaces for iOS (use schema.json generated by previous step)
node scripts/generate-specs-cli.js ios <output_file_schema_json> <output_dir> <library_name>
```
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D30648067
fbshipit-source-id: 29688e0aac5496886657db82becb05bc8da076c9
Summary: Changelog: [Internal] Create FlatList example index for 3 levels of navigation
Reviewed By: charlesbdudley
Differential Revision: D30816721
fbshipit-source-id: a3bdae7f385bab3695a9c2dc6fe3148ebdbd12b4
Summary:
This Diff is adapting the `BundleJsAndAssetsTask` to be a bit more idiomatic. Here the summary of changes.
- Make the task `abstract` to let Gradle properly implement it.
- Make all the annotated filed `public` instead of `internal` as they will be easier to access for Gradle + will show up
correctly in logs/scans
- Update the Task to subclass a `Exec` that is a specificed Task
- Do not reference `project.` inside the Task body as that is breaking the Configuration Caching of Gradle
Changelog:
[Internal] [Changed] - Make the `BundleJsAndAssetsTask` Task more Gradle friendly
Reviewed By: mdvacca
Differential Revision: D30865159
fbshipit-source-id: 74d4c77f6a2b3fac944e7e0b123726e6a423ba1d
Summary:
Ideally a Gradle `Extension` should contain only properties as it's the public facing API of our
Gradle surface. Here I'm movign a couple of functions away from it. Now they're located inside their
own Util file. Moreover I've added tests and documentation to those.
Changelog:
[Internal] [Changed] - Export `detected*` functions fron `ReactAppExtension` to its own file
Reviewed By: mdvacca
Differential Revision: D30865494
fbshipit-source-id: 59925414c0eb427161691950f5b9b6495121da00
Summary:
Another small diff to setup some testing for our Gradle Plugin.
Here I exported a couple of extension functions on `File` to a separate
Utils file + I've added some tests for them.
Changelog:
[Internal] [Added] - Add tests for AndroidConfiguration
Reviewed By: mdvacca
Differential Revision: D30841339
fbshipit-source-id: fcb00d7397d1f3e2b4500e9920508c71f20c76f3
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
Summary:
Another small diff to setup some testing for our Gradle Plugin.
Specifically this one is also setting up a test environment where we would be able to exercies
AGP usages on top of `ProjectBuilder`. This will allow us to verify that an Android project
is configured correctly for a React Native build.
Changelog:
[Internal] [Added] - Add tests for AndroidConfiguration
Reviewed By: GijsWeterings
Differential Revision: D30839600
fbshipit-source-id: 10e3b3c0fcf5979c2a0eaf64320f87ae58093fbd
Summary:
Fix broken link
## 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
-->
[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/32169
Reviewed By: yungsters
Differential Revision: D30809096
Pulled By: GijsWeterings
fbshipit-source-id: b600e411c7292ba840e076d68f66cb3043887335
Summary:
This Diff is adding some really simple tests for TaskUtils.
It also adds a couple of utilities to run some sample tests (e.g. mocking the OS version)
that would come handy the more we keep on writing tests and adding functionalities to the Gradle plugin.
Changelog:
[Internal] [Changed] - Added tests for TaskUtils
Reviewed By: mdvacca
Differential Revision: D30809779
fbshipit-source-id: c401cb78e386964e429c6f459c699e6f18f54f11
Summary:
RCTRootView exposes the RCTEventDispatcher directly via the .eventDispatcher property. So, there's no need to access the bridge to access the eventDispatcher.
Created from CodeHub with https://fburl.com/edit-in-codehub
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D30753792
fbshipit-source-id: 5820d65c061e9b88382692dfc2791ed4a4841c0f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32139
Currently RN Gradle Plugin is using `kotlin-dsl` that comes will all sorts of side effects on Gradle plugins projects.
Specifically we can't specify the Kotlin version, plus it makes harder to include Java source code in a single
project.
I'm removing it in favor of Kotlin-JVM plugin. I've adapted the code to use the correct APIs.
Specifically most of the lambdas are changing the scope of the parameter (from `this` to `it`) so I had to adapt
those as well.
Changelog:
[Internal] [Changed] - Do not use `kotlin-dsl` for `react-native-gradle-plugin`
Reviewed By: yungsters
Differential Revision: D30726977
fbshipit-source-id: b10635eefdbbb496c4adddd418db6b0ab613ab59