mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
e8c1eeeb06
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
23 lines
467 B
Plaintext
23 lines
467 B
Plaintext
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
pluginManagement {
|
|
repositories {
|
|
gradlePluginPortal()
|
|
mavenLocal()
|
|
google()
|
|
}
|
|
}
|
|
|
|
include(
|
|
":ReactAndroid",
|
|
":RNTester:android:app"
|
|
)
|
|
|
|
// Include this to enable codegen Gradle plugin.
|
|
includeBuild("packages/react-native-codegen/android")
|