Flatten the `react-native-codegen` included build. (#32007)

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

This Diff simplifies the codegen Gradle build.
Previously the build used to have a 2-level nesting of included build.

Turns out that the `react-native-codegen/android/build.gradle` build
is just providing a task and including an inner build that contains the codegen
Gradle plugin. I've moved such plugin to the outer build.

This will also make sure that the Gradle plugin files are properly index by the
IDE when opening the build (as nested included build are not yet supported).

Changelog:
Internal - Flatten the `react-native-codegen` Gradle included build

Reviewed By: fkgozali, ShikaSD

Differential Revision: D30227784

fbshipit-source-id: af304afeeba1926f8b7b5b47cf69889d3f808f5f
This commit is contained in:
Nicola Corti 2021-08-12 05:13:27 -07:00 коммит произвёл Facebook GitHub Bot
Родитель ae494e7ce1
Коммит 1f8c5607b2
52 изменённых файлов: 24 добавлений и 73 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -24,7 +24,6 @@ project.xcworkspace
# Gradle
/build/
/packages/react-native-codegen/android/build/
/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/build
/packages/react-native-gradle-plugin/build/
/packages/rn-tester/android/app/.cxx/
/packages/rn-tester/android/app/build/

Просмотреть файл

@ -36,8 +36,7 @@ rn_codegen_modules(
rn_android_library(
name = "rn_codegen_library_java",
srcs = glob(
["**/*.java"],
exclude = ["android/gradlePlugin-build/**/*"],
["buck_tests/*.java"],
),
autoglob = False,
visibility = [

Просмотреть файл

@ -7,22 +7,30 @@
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
mavenLocal()
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
}
plugins {
id 'java-gradle-plugin'
}
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
repositories {
mavenLocal()
google()
mavenCentral()
}
dependencies {
implementation 'com.android.tools.build:gradle:4.2.2'
// Use the same Gson version that `com.android.tools.build:gradle` depends on.
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.squareup:javapoet:1.13.0'
}
gradlePlugin {
plugins {
codegen {
id = 'com.facebook.react.codegen'
implementationClass = 'com.facebook.react.codegen.plugin.CodegenPlugin'
}
}
}

Просмотреть файл

@ -1,14 +0,0 @@
/*
* 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.
*/
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
}
}

Просмотреть файл

@ -1,27 +0,0 @@
/*
* 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.
*/
plugins {
id 'java-gradle-plugin'
}
gradlePlugin {
plugins {
codegen {
id = 'com.facebook.react.codegen'
implementationClass = 'com.facebook.react.codegen.plugin.CodegenPlugin'
}
}
}
dependencies {
implementation 'com.android.tools.build:gradle:4.2.2'
// Use the same Gson version that `com.android.tools.build:gradle` depends on.
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.squareup:javapoet:1.13.0'
}

Просмотреть файл

@ -1,10 +0,0 @@
/*
* 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.
*/
rootProject.name = 'react-native-codegen-gradlePlugin-build'
include(":gradlePlugin")

Просмотреть файл

@ -13,8 +13,4 @@ pluginManagement {
}
}
rootProject.name = 'react-native-codegen'
include(":generator")
includeBuild("gradlePlugin-build")
rootProject.name = 'react-native-codegen-android'