Introduce Support for Gradle Isolated Projects#71
Open
findyourexit wants to merge 1 commit into
Open
Conversation
Previously the plugin read every sibling project's state at configuration time through `project.allprojects` and a querier that reached into other projects' configurations, dependencies and plugins, which is incompatible with Gradle's Isolated Projects. The graph is now assembled from per-project snapshots, each collected from within its own project, so no cross-project access happens at any point and the plugin is compatible with both the Configuration Cache and Isolated Projects. - Add `ProjectInfo`, a serializable per-project snapshot of a project's path, applied plugin ids, external dependency coordinates and declared project dependencies. - Add `ModuleGraphRegistry`, a build-scoped service that aggregates the snapshots, and `ModuleGraphContributeTask`, which registers a project's snapshot at execution time so it survives configuration-cache reuse. - Add the `dev.iurysouza.modulegraph.settings` settings plugin for one-line multi-project adoption: it applies the plugin to the root project and makes every other project contribute a snapshot that the root `createModuleGraph` task depends on. - Replace `GradleProjectQuerier` with `SnapshotProjectQuerier` and move graph parsing into the task action, so the model is built from the collected snapshot instead of live `Project` instances. - Collect each snapshot through a lazy provider instead of `afterEvaluate`, and resolve module types from the captured data via a pure `resolveModuleType`. - Bump the plugin build to Gradle 8.11.1 for the Isolated-Projects-safe `ProjectDependency.getPath()`. - Add a functional test that runs `createModuleGraph` with the configuration cache and Isolated Projects enabled across a multi-project build and asserts a correct, cache-reusable result. - Document the support in the README and dogfood the settings plugin in the sample build, configuring it from the root build and targeting the sample readmes.
findyourexit
force-pushed
the
findyourexit/support-isolated-projects
branch
from
June 30, 2026 07:18
2ecda14 to
baa44e1
Compare
Owner
|
Hi there! Thanks for submitting. I'll run some reviews on it and take a look before EOW. Cheers |
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.
🚀 Description
This PR contains the following changes:
project.allprojectsaccess that Isolated Projects disallows.dev.iurysouza.modulegraph.settingssettings plugin - the one-line way to wiremodule-graphinto a multi-project build under Isolated Projects.plugin-buildGradle version8.9->8.11.1for the Isolated-Projects-safeProjectDependency.getPath().README.mdand switched thesamplebuild over to the settings plugin.One behavioural note: applying the plugin to a single project still graphs that project and its dependencies, but aggregating a whole multi-project build now goes through the settings plugin, since the old
allprojectstraversal isn't possible under Isolated Projects. Existing multi-project setups would adopt the one-line settings plugin to keep getting the full graph (hence the breaking-change flag below).📄 Motivation and Context
This PR isn't targeting an open issue, but it's something I kept running into while adopting Gradle's Isolated Projects across a handful of my own multi-module projects: any build that turned it on and applied
module-graphwould fail outright, so I'd had to pull the plugin out to make progress.I'd much rather keep it around (the module graphs are genuinely useful day to day) so these changes teach
module-graphto play nicely with Isolated Projects (and the Configuration Cache).🧪 How Has This Been Tested?
I added a functional test that drives
createModuleGraphacross a multi-project build with--configuration-cacheand Isolated Projects enabled, asserting the graph comes out correct, that there are no configuration-cache problems, and that a second run reuses the cache.Beyond that, the existing suite still passes (along with
ktlintCheck,detektandvalidatePlugins), and I ran it against thesamplebuild locally - the Configuration Cache entry stores then reuses, and the graphs regenerate identically. All on a JDK8toolchain (Azul Zulu) with Gradle8.11.1.📦 Types of changes
✅ Checklist