Skip to content

Commit

Permalink
Make sure *.ts files are considered for task avoidance in the Gradle …
Browse files Browse the repository at this point in the history
…Plugin (facebook#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: facebook#34296

Test Plan: Tests are attached.

Reviewed By: cipolleschi

Differential Revision: D38246125

Pulled By: cortinico

fbshipit-source-id: 80efcc9ef747c598ca040d65b25d270593c8aed2
  • Loading branch information
cortinico authored and roryabraham committed Aug 17, 2022
1 parent bd1ee72 commit 9c0ac8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract class GenerateCodegenSchemaTask : Exec() {
val jsInputFiles =
project.fileTree(jsRootDir) {
it.include("**/*.js")
it.include("**/*.ts")
it.exclude("**/generated/source/codegen/**/*")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c0ac8d

Please sign in to comment.