settings.gradle.kts: add support for subprojects.local.cfg#8074
settings.gradle.kts: add support for subprojects.local.cfg#8074
subprojects.local.cfg#8074Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new utility functions in settings.gradle.kts to manage subprojects, allowing for local overrides via subprojects.local.cfg. The .gitignore file is updated to include /subprojects.local.cfg. The review suggests refactoring the exception handling in readSubprojectsFile to use the standard error() function and simplifying the parsing logic in discoverSubprojects using more idiomatic Kotlin constructs like substringBefore and takeIf.
…error() instead [no ci]
…c string filtering
Changed
```
return subprojectsFileContents
.lines()
.mapNotNull { it.split("#").firstOrNull()?.trim() }
.filter { it.isNotEmpty() }
```
to
```
return subprojectsFileContents.lines().mapNotNull { line ->
line.substringBefore('#').trim().takeIf { it.isNotEmpty() }
}
```
Adds support for a
subprojects.local.cfgfile in the top-level directory that, if it exists, overridessubprojects.cfg, allowing local reduction in then number of gradle submodules in the project. This leads to noticeable improvements in devx due to faster local builds, snappier Android Studio performance, and less "noise" in Android Studio from unrelated code (e.g. in search results).For example, in my local development of the dataconnect SDK I created
subprojects.local.cfgwith these lines:This reduced the number of Gradle submodules in my
./gradlewbuilds and in Android Studio by 93% (72 projects down to 5 projects). Anecdotally, this made builds faster and Android Studio wayyyyyy snappier, with fewer hangs (GC hangs?) and less visual clutter from code and modules that are not relevant to my daily work.Highlights
subprojects.local.cfgas an optional local override forsubprojects.cfg, enabling developers to load a subset of submodules for faster builds and improved IDE performance.settings.gradle.ktsto use a robust file-reading mechanism that prioritizes local configuration and provides helpful logging..gitignoreto ensure thatsubprojects.local.cfgremains a local-only configuration and is not committed to the repository.Changelog
2 files affected
subprojects.local.cfgto the ignored files.subprojects.local.cfgoversubprojects.cfgand refactored subproject discovery to handle string-based file contents.