Skip to content

Commit

Permalink
RNGP - Correctly Support Gradle Configuration Cache (#35455)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #35455

This little change allows to support Gradle Configuration cache in user projects:
https://docs.gradle.org/current/userguide/configuration_cache.html

It allows to save several seconds on the build time.
We'll keep it disabled for now, but Gradle plans to enable it by default for everyone
in the future, so this changes makes us ready for it.

Changelog:
[Internal] [Changed] - RNGP - Correctly Support Gradle Configuration Cache

Reviewed By: cipolleschi

Differential Revision: D41519506

fbshipit-source-id: 6252546e811deb0777c0aab5332291368be7fa8f
  • Loading branch information
cortinico authored and facebook-github-bot committed Nov 24, 2022
1 parent 9517320 commit 25c97bb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class ReactPlugin : Plugin<Project> {
// Please note that appNeedsCodegen is triggering a read of the package.json at
// configuration time as we need to feed the onlyIf condition of this task.
// Therefore, the appNeedsCodegen needs to be invoked inside this lambda.
it.onlyIf { isLibrary || project.needsCodegenFromPackageJson(extension) }
val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(extension)
it.onlyIf { isLibrary || needsCodegenFromPackageJson }
}

// We create the task to produce schema from JS files.
Expand All @@ -120,7 +121,8 @@ class ReactPlugin : Plugin<Project> {
} else {
it.jsRootDir.set(extension.jsRootDir)
}
it.onlyIf { isLibrary || project.needsCodegenFromPackageJson(parsedPackageJson) }
val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(extension)
it.onlyIf { isLibrary || needsCodegenFromPackageJson }
}

// We create the task to generate Java code from schema.
Expand All @@ -139,7 +141,8 @@ class ReactPlugin : Plugin<Project> {
// Please note that appNeedsCodegen is triggering a read of the package.json at
// configuration time as we need to feed the onlyIf condition of this task.
// Therefore, the appNeedsCodegen needs to be invoked inside this lambda.
it.onlyIf { isLibrary || project.needsCodegenFromPackageJson(extension) }
val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(extension)
it.onlyIf { isLibrary || needsCodegenFromPackageJson }
}

// We update the android configuration to include the generated sources.
Expand Down

0 comments on commit 25c97bb

Please sign in to comment.