-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: support Gradle configuration cache #2201
Merged
thymikee
merged 3 commits into
react-native-community:main
from
ahruss:ahruss-cli-platform-android-config-cache
Jan 15, 2024
Merged
build: support Gradle configuration cache #2201
thymikee
merged 3 commits into
react-native-community:main
from
ahruss:ahruss-cli-platform-android-config-cache
Jan 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Directly using Runtime.exec breaks Gradle configuration caching. This change is to use `providers.exec` which supports configuration caching. This is a minimal fix; it's likely possible that more invasive changes could be useful to avoid having to exec these processes at all until their values are needed, but I have not looked into larger structural changes.
cortinico
approved these changes
Dec 12, 2023
Co-authored-by: Nicola Corti <[email protected]>
Hey @ahruss, mind looking why e2e tests are failing? |
thymikee
reviewed
Dec 12, 2023
def readBuffer = new StringBuffer() | ||
while ((buff = bufferedReader.readLine()) != null) { | ||
readBuffer.append(buff) | ||
def execOutput = providers.exec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah - created the PR from the wrong branch, should be fixed with 33fa4a1
lukmccall
added a commit
to expo/expo
that referenced
this pull request
Feb 8, 2024
# Why Uses a cache-friendly method of executing external processes. The Gradle now has a new cache configuration setting which allows skipping the configuration step. However, the old `exec` API doesn't support running during the cacheable configuration phase. To fix this, new functions can be used. You can find more information on this topic here: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:external_processes Just to let you know, this pull request is quite similar to the one that was submitted by the community CLI. You can find the link for it here: react-native-community/cli#2201 PR only affects `bare-expo` projects; I didn't modify our template or Expo Go since I'm still testing different approaches. >⚠️ At the moment, this PR doesn't support enabling the cache configuration. We still have a lot of work to do before we can achieve that goal. However, I was able to turn on the configuration cache by making a few changes and using some hacks. This resulted in a significant improvement in build time, reducing it by around 40%. # How Used new cache-friendly API to run external processes. # Test Plan - bare-expo ✅
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Directly calling Runtime.exec breaks Gradle configuration caching. An easy workaround is to use
providers.exec
instead, which supports configuration caching.Test Plan:
This change should be functionally equivalent to existing behavior. I've tested locally that my project's gradle build still works with this change, both with and without the --configuration-cache argument
Checklist