feat(build): Add support for remote Gradle build cache#4357
Merged
Conversation
This commit introduces support for a remote Gradle build cache to accelerate build times. A new helper function, `getMeshProperty`, has been added to `settings.gradle.kts` to read configuration values from environment variables, `local.properties`, or a new `config.properties` file, in that order of precedence. The remote cache is configured using the following properties: - `GRADLE_CACHE_URL` - `GRADLE_CACHE_USERNAME` - `GRADLE_CACHE_PASSWORD` If `GRADLE_CACHE_URL` is not set, the remote cache will be disabled. Builds will be pushed to the cache if it is enabled. The `config.properties` file has been updated with placeholders for these new settings. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4357 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 3 3
Lines 28 28
Branches 8 8
=====================================
Misses 28 28 ☔ View full report in Codecov by Sentry. |
# Conflicts: # settings.gradle.kts
This commit introduces support for a remote Gradle build cache across all relevant GitHub Actions workflows to speed up build and test times. ### Key Changes: - **Workflow Inputs:** Added optional `GRADLE_CACHE_URL`, `GRADLE_CACHE_USERNAME`, and `GRADLE_CACHE_PASSWORD` inputs to `release.yml`, `reusable-android-build.yml`, and `reusable-android-test.yml` to configure the remote cache. - **Environment Variables:** These inputs are passed as environment variables to the build and test jobs, allowing Gradle to connect to the remote cache. - **Secret Inheritance:** The `pull-request.yml` workflow was simplified by using `secrets: inherit` to pass necessary secrets to the reusable test workflow, improving maintainability. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit updates the remote build cache configuration in `settings.gradle.kts`. If a remote cache URL is provided but credentials (username and password) are missing, the remote cache will now be explicitly disabled. This prevents the build from failing with 403 (Forbidden) errors when attempting to access the cache without proper authentication. A message is now printed to the console to inform the user about the missing credentials and the resulting deactivation of the remote cache. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit improves the remote build cache configuration in `settings.gradle.kts`. The `GRADLE_CACHE_URL`, `GRADLE_CACHE_USERNAME`, and `GRADLE_CACHE_PASSWORD` properties are now trimmed of leading/trailing whitespace to prevent connection issues. Additionally, the logging for the cache status has been refined to be more explicit about whether remote cache writing is enabled or disabled based on the presence of the URL and credentials. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This file contains hidden or 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
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.
This commit introduces support for a remote Gradle build cache to accelerate build times.
A new helper function,
getMeshProperty, has been added tosettings.gradle.ktsto read configuration values from environment variables,local.properties, or a newconfig.propertiesfile, in that order of precedence.The remote cache is configured using the following properties:
GRADLE_CACHE_URLGRADLE_CACHE_USERNAMEGRADLE_CACHE_PASSWORDIf
GRADLE_CACHE_URLis not set, the remote cache will be disabled. Builds will be pushed to the cache if it is enabled. Theconfig.propertiesfile has been updated with placeholders for these new settings.