Skip to content

Add module detector settings plugin - #339

Merged
fornewid merged 2 commits into
developfrom
module-detector
Sep 28, 2026
Merged

fornewid merged 2 commits into
developfrom
module-detector

Conversation

@fornewid

@fornewid fornewid commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Port of fornewid/baseline-sample#3, trimmed to what Moop uses.

  • settings.gradle.kts applies moop.module.detector instead of the inline ModuleDetector object.
  • build-logic/module-detector holds ModuleDetectorPlugin, registered in gradlePlugin {} like the convention plugins. Every directory with a build.gradle(.kts) file is included as a module. Hidden directories, build directories and nested builds (with their own settings file) are skipped.
  • findModules is covered by JUnit 4 unit tests that reuse the existing test-junit catalog 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 in build-logic/settings.gradle.kts (plain include lines 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 the build directory skip makes one of them fail.
  • ./gradlew -q projects lists the same 51 projects (36 modules) as develop.
  • ./gradlew help reuses the configuration cache on the second run, also after a new directory appears under app/build. On develop, every run recalculated it.
  • ./gradlew dependencyGuard passes.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ

fornewid and others added 2 commits September 28, 2026 21:00
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
@fornewid
fornewid merged commit 5eb091f into develop Sep 28, 2026
1 check passed
@fornewid
fornewid deleted the module-detector branch September 28, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant