Summary:
This Diff sets up a small Gradle build inside `ReactAndroid/hermes-engine`
The idea is to kickoff a small project where we can download Hermes sources and start a compilation of
the Hermes sources from there.
Specifically the used paths are:
- `/sdk/hermes` for the unzipping
- `/sdk/download/hermes.tar.gz` for the tarball location
- `/sdk/hermes/.hermesversion` for the hermes version.
allow-large-files
Changelog:
[Internal] [Changed] - Setup a Gradle build inside `hermes-engine` to download Hermes sources
Reviewed By: hramos
Differential Revision: D34210236
fbshipit-source-id: 97034f5608dfb3fcd1d74e9851944f7a60e52ea1
Summary:
This diff allows to setup a Gradle Enterprise instance
either locally or on CI via an external Gradle script.
I've create a `.sample` script that users can copy to
start setting up their GE instance, should they have one.
Moreover, it applies the `com.gradle.enterprise` Gradle
plugin by default. This has the positive side effect of
not invalidating build cache for the included build if
you happen to pass the `--scan` flag in OSS (as the
classpath isn't changed).
Changelog:
[Android] [Added] - Allow to setup a Gradle Enterprise instance via an external script
Reviewed By: mdvacca
Differential Revision: D33582388
fbshipit-source-id: 0c2f073cf7a8e39963b0adfc3b339b14c1e7759b
Summary:
Gradle Plugin Portal proxies jcenter which is quite unstable these days. This change updates plugin repositories to look into maven central and google first and use gradle plugin repo only as a fallback.
Changelog: [Internal] - Prioritize maven central for Gradle plugins
Reviewed By: cortinico
Differential Revision: D33550827
fbshipit-source-id: b436b05b0fd07865b56dd3e442d8399678dfff85
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32790
As the name says, I've added a `newArchEnabled` property that can be used to toggle the
New Architecture in the new app template. Users can use this to try the New Architecture in their
project by either:
* Set `newArchEnabled` to true inside the `gradle.properties` file
* Invoke gradle with `-PnewArchEnabled=true`
* Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
The Project property will also control if:
* ReactNative dependency should be built from source or not.
* The NDK should be enabled or not.
Please note that this requires RN 0.68.x to run properly (it won't work with 0.67 RCs) or a Nightly version of React Native.
Changelog:
[Android] [Added] - Setup a `newArchEnabled` property to Opt-in the New Architecture in the template
Reviewed By: ShikaSD
Differential Revision: D33065373
fbshipit-source-id: 32085f5b071d6243936bafd91425b5b43e5b5101
Summary:
Having mavenLocal specified as part of the build is creating confusion as stale artifacts could be used inside the build.
This Diff is attempting to remove. Developers that need it for local development can still re-add it.
Changelog:
[Internal] [Changed] - Remove mavenLocal()
Reviewed By: ShikaSD
Differential Revision: D31057038
fbshipit-source-id: 90335047a0ba5a537ce347e4c1592bfe756d4135
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:
Pull Request resolved: https://github.com/facebook/react-native/pull/32124
This Diff adds `template/android/` as part of the top level build as an included
build. This means that the Android template will be loaded inside Android studio and it
will be easier to invoke tasks directly there.
I'm also bumping Gradle to 7.0.2 for the template.
Please note that the template relies on the `template/node_modules` folder to
work correctly, as the Gradle build is loading a file from there.
Therefore I've added a check to verify that we import the build only if `node_modules`
is available.
Changelog:
[Internal] [Changed] - Load template/android/ inside the build.
Reviewed By: ShikaSD
Differential Revision: D30672845
fbshipit-source-id: 7253296b54e1fde7448e0e170d59b244ed9ec8fb
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
Summary:
The Gradle codegen integration requires the JS CLI to be first built via `yarn run build`. This commit puts that logic in a `build.sh` script, then defines a Gradle task to build it.
Changelog: [Internal]
Reviewed By: hramos
Differential Revision: D24556992
fbshipit-source-id: 7092de7c1126edc157b122f4b2243e55f7188846
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
Summary:
Instead of applying configs from gradle scripts, this introduces a proper Gradle plugin to enable Codegen in an application or library project. In the build.gradle, one enables it by:
```
plugins {
id("com.android.application")
id("com.facebook.react.codegen") // <---
}
// ...
react { // <--- the new plugin extension
enableCodegen = System.getenv("USE_CODEGEN")
jsRootDir = file("$rootDir/RNTester")
reactNativeRootDir = file("$rootDir")
}
```
The plugin supports `react` plugin extension as demonstrated above. Adding this:
* automatically generates all TurboModule Java files via react-native-codegen **before the `preBuild` Gradle task**
* automatically adds the files to the `android {}` project configuration
* is done per project (build.gradle)
This will be the foundation for future React Native gradle plugin beyond just for react-native-codegen.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D23065685
fbshipit-source-id: 4ea67e48fab33b238c0973463cdb00de8cdadfcc
Summary:
Instead of sourcing-in a .gradle file to setup codegen tasks in Gradle, let's define a proper `com.facebook.react.codegen` Gradle plugin, so that any Gradle project (lib/app) can include it via:
```
plugins {
id 'com.facebook.react.codegen'
}
```
The idea (not yet implemented in this commit) is to then allow those projects to add this section in the projects:
```
codegen {
enableCodegen = ...
jsRootDir = ...
}
```
This is more scalable and less hacky.
Important notes:
* The Gradle plugin should be prepared during the build, we're not going to publish it to Maven or other repo at this point.
* This setup is inspired by composite build setup explained here: https://ncorti.com/blog/gradle-plugins-and-composite-builds
* All android specific setup is added under `packages/react-native-codegen/android/` dir, but long term, we may want to move it up to `packages/react-native-codegen/` along side setup for other platforms.
* As part of this setup, the plugin will have an option (to be validated) to produce Java specs using https://github.com/square/javapoet
* This is the same library already used for React Native Android annotation processors
* This generator will not deal with parsing Flow types into schema, it will just takes in the schema and produce Java code
* We're evaluating whether JavaPoet is a better choice for Java code generation long term, vs building it in JS via string concatenation: https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js
* This commit produces a sample Java code, not the actual codegen output
Changelog: [Internal]
To try this out, run this Gradle task:
```
USE_CODEGEN=1 ./gradlew :ReactAndroid:generateJava
```
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D22917315
fbshipit-source-id: 0b79dba939b73ff1305b4b4fd86ab897c7a48d53
Summary:
Convert root Gradle script to Kotlin DSL, and cleanup. Currently, there is not much benefit or advantage over Groovy scripts, except IDE support and it'll cache compiled KTS scripts on first run.
[Android] [Changed] - Convert root Gradle script to Kotlin DSL, and cleanup.
Pull Request resolved: https://github.com/facebook/react-native/pull/24631
Differential Revision: D15120190
Pulled By: cpojer
fbshipit-source-id: 86691db5c7746e71bb243ebc263c1a3075ee9a9e