Skip to content

Commit 3c034cd

Browse files
cortinicofacebook-github-bot
authored andcommitted
RNGP - GenerateCodegenSchemaTask should exclude all of **/build/[generated|intermediate]**
Summary: I'm widening the exclude for GenerateCodegenSchemaTask input files. This is needed before we can migrate to Gradle 8.x as one of the build warning we have is now converted to a build failure. The reason why this is needed is because GenerateCodegenSchemaTask ends up picking up a file that gets generated by `react-native bundle`. While the file is ignored by the Codegen, Gradle detects a clash between the two tasks. This solves the issue completely. Changelog: [Internal] [Changed] - RNGP - GenerateCodegenSchemaTask should exclude all of `**/build/[generated|intermediate]**` Differential Revision: D43501129 fbshipit-source-id: 84b267428b342002b678f0c485cb8f2925f85950
1 parent 62faa79 commit 3c034cd

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ abstract class GenerateCodegenSchemaTask : Exec() {
3838
// Those are known build paths where the source map or other
3939
// .js files could be stored/generated. We want to make sure we don't pick them up
4040
// for execution avoidance.
41-
it.exclude("**/generated/source/codegen/**/*")
4241
it.exclude("**/build/ASSETS/**/*")
4342
it.exclude("**/build/RES/**/*")
44-
it.exclude("**/build/generated/assets/react/**/*")
45-
it.exclude("**/build/generated/res/react/**/*")
46-
it.exclude("**/build/generated/sourcemaps/react/**/*")
47-
it.exclude("**/build/intermediates/sourcemaps/react/**/*")
43+
it.exclude("**/build/generated/**/*")
44+
it.exclude("**/build/intermediates/**/*")
4845
}
4946

5047
@get:OutputFile

packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class GenerateCodegenSchemaTaskTest {
5151
tempFolder.newFolder("js").apply {
5252
File(this, "afolder/includedfile.js").createFileAndPath()
5353
// Those files should be excluded due to their filepath
54-
File(this, "afolder/generated/source/codegen/anotherfolder/excludedfile.js")
54+
File(this, "afolder/build/generated/source/codegen/anotherfolder/excludedfile.js")
5555
.createFileAndPath()
5656
File(this, "afolder/build/generated/assets/react/anotherfolder/excludedfile.js")
5757
.createFileAndPath()
@@ -68,13 +68,10 @@ class GenerateCodegenSchemaTaskTest {
6868
assertEquals(jsRootDir, task.jsInputFiles.dir)
6969
assertEquals(
7070
setOf(
71-
"**/generated/source/codegen/**/*",
7271
"**/build/ASSETS/**/*",
7372
"**/build/RES/**/*",
74-
"**/build/generated/assets/react/**/*",
75-
"**/build/generated/res/react/**/*",
76-
"**/build/generated/sourcemaps/react/**/*",
77-
"**/build/intermediates/sourcemaps/react/**/*",
73+
"**/build/generated/**/*",
74+
"**/build/intermediates/**/*",
7875
),
7976
task.jsInputFiles.excludes)
8077
assertEquals(1, task.jsInputFiles.files.size)

0 commit comments

Comments
 (0)