mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make sure *.ts files are considered for task avoidance in the Gradle Plugin (#34296)
Summary: I've realized that the gradle plugin is currently looking at `.js` files for task re-execution. This means that, while the *.ts would still be considered when the codegen is invoked, an edit on one of those file, won't retrigger the codegen on Android. This change fixes it so that we consider both `*.ts` and `*.js` files. ## Changelog [Android] [Fixed] - Make sure *.ts files are considered for task avoidance in the Gradle Plugin Pull Request resolved: https://github.com/facebook/react-native/pull/34296 Test Plan: Tests are attached. Reviewed By: cipolleschi Differential Revision: D38246125 Pulled By: cortinico fbshipit-source-id: 80efcc9ef747c598ca040d65b25d270593c8aed2
This commit is contained in:
committed by
Lorenzo Sciandra
parent
1c146bd420
commit
0fd776d889
+1
@@ -33,6 +33,7 @@ abstract class GenerateCodegenSchemaTask : Exec() {
|
||||
val jsInputFiles =
|
||||
project.fileTree(jsRootDir) {
|
||||
it.include("**/*.js")
|
||||
it.include("**/*.ts")
|
||||
it.exclude("**/generated/source/codegen/**/*")
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -29,15 +29,17 @@ class GenerateCodegenSchemaTaskTest {
|
||||
val jsRootDir =
|
||||
tempFolder.newFolder("js").apply {
|
||||
File(this, "file.js").createNewFile()
|
||||
File(this, "file.ts").createNewFile()
|
||||
File(this, "ignore.txt").createNewFile()
|
||||
}
|
||||
|
||||
val task = createTestTask<GenerateCodegenSchemaTask> { it.jsRootDir.set(jsRootDir) }
|
||||
|
||||
assertEquals(jsRootDir, task.jsInputFiles.dir)
|
||||
assertEquals(setOf("**/*.js"), task.jsInputFiles.includes)
|
||||
assertEquals(1, task.jsInputFiles.files.size)
|
||||
assertEquals(setOf(File(jsRootDir, "file.js")), task.jsInputFiles.files)
|
||||
assertEquals(setOf("**/*.js", "**/*.ts"), task.jsInputFiles.includes)
|
||||
assertEquals(2, task.jsInputFiles.files.size)
|
||||
assertEquals(
|
||||
setOf(File(jsRootDir, "file.js"), File(jsRootDir, "file.ts")), task.jsInputFiles.files)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user