2019-10-22 14:43:51 +00:00
|
|
|
/*
|
2021-12-30 23:08:43 +00:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2019-10-22 14:43:51 +00:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
2015-09-14 14:35:58 +00:00
|
|
|
|
2020-08-12 18:10:33 +00:00
|
|
|
pluginManagement {
|
2022-06-09 09:50:45 +00:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
google()
|
|
|
|
gradlePluginPortal()
|
|
|
|
}
|
2020-08-12 18:10:33 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 12:03:25 +00:00
|
|
|
include(
|
|
|
|
":packages:react-native:ReactAndroid",
|
|
|
|
":packages:react-native:ReactAndroid:hermes-engine",
|
|
|
|
":packages:react-native:ReactAndroid:external-artifacts")
|
codegen: set up Gradle plugin for more maintable codegen build steps
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
2020-08-04 07:53:16 +00:00
|
|
|
|
2023-02-15 14:05:56 +00:00
|
|
|
// If the ./packages folder exists, then we're inside the React Native repository.
|
|
|
|
// If not, a users is consuming this project for a build from source.
|
2023-02-21 09:35:46 +00:00
|
|
|
if (File("${rootDir}/packages").exists()) {
|
2023-02-15 14:05:56 +00:00
|
|
|
include(":packages:rn-tester:android:app")
|
|
|
|
// Include this to enable codegen Gradle plugin.
|
|
|
|
includeBuild("packages/react-native-gradle-plugin/")
|
|
|
|
}
|
2021-08-31 19:48:55 +00:00
|
|
|
|
2022-02-16 14:36:09 +00:00
|
|
|
rootProject.name = "react-native-github"
|
|
|
|
|
2022-06-09 09:50:45 +00:00
|
|
|
plugins { id("com.gradle.enterprise").version("3.7.1") }
|
2022-02-16 14:36:09 +00:00
|
|
|
|
|
|
|
// If you specify a file inside gradle/gradle-enterprise.gradle.kts
|
|
|
|
// you can configure your custom Gradle Enterprise instance
|
|
|
|
if (File("./gradle/gradle-enterprise.gradle.kts").exists()) {
|
2022-06-09 09:50:45 +00:00
|
|
|
apply(from = "./gradle/gradle-enterprise.gradle.kts")
|
2022-03-04 15:27:13 +00:00
|
|
|
}
|