Add module detector settings plugin - #339
Merged
Merged
Conversation
Move the inline ModuleDetector out of settings.gradle.kts into the moop.module.detector precompiled settings plugin in build-logic. It skips hidden and build directories, so the configuration cache is no longer invalidated by .gradle/ changing on every build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ
Replace the precompiled settings script with ModuleDetectorPlugin,
registered in gradlePlugin {} like the convention plugins, and cover
findModules with JUnit 4 unit tests using the existing test-junit entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ
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.
Port of fornewid/baseline-sample#3, trimmed to what Moop uses.
settings.gradle.ktsappliesmoop.module.detectorinstead of the inlineModuleDetectorobject.build-logic/module-detectorholdsModuleDetectorPlugin, registered ingradlePlugin {}like the convention plugins. Every directory with abuild.gradle(.kts)file is included as a module. Hidden directories,builddirectories and nested builds (with their own settings file) are skipped.findModulesis covered by JUnit 4 unit tests that reuse the existingtest-junitcatalog entry.Left out compared to baseline-sample#3: the
moduleDetector { exclude(...) }extension, the default exclude list, the TestKit test, the JUnit 5/Truth catalog entries, and the directory scan inbuild-logic/settings.gradle.kts(plainincludelines are enough here).Side effect: the configuration cache is now reused locally. The inline detector also walked
.gradle/, whose contents change on every build, so the cache was invalidated on every run (directory '.gradle/configuration-cache/β¦' has changed).Verification
./gradlew -p build-logic :module-detector:test: 3 tests pass (CI doesn't run build-logic tests). Removing thebuilddirectory skip makes one of them fail../gradlew -q projectslists the same 51 projects (36 modules) asdevelop../gradlew helpreuses the configuration cache on the second run, also after a new directory appears underapp/build. Ondevelop, every run recalculated it../gradlew dependencyGuardpasses.π€ Generated with Claude Code
https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ