Skip to content

Make Featured plugin Project-Isolation-safe; remove scanAllLocalFlags root task#286

Merged
kirich1409 merged 3 commits into
developfrom
feature/186-project-isolation-safe
Jun 13, 2026
Merged

Make Featured plugin Project-Isolation-safe; remove scanAllLocalFlags root task#286
kirich1409 merged 3 commits into
developfrom
feature/186-project-isolation-safe

Conversation

@kirich1409

@kirich1409 kirich1409 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Closes #186.

What changed

Removes the only rootProject access in the Featured Gradle plugin, making it compatible with Gradle Project Isolation.

  • Deleted wireToRootAggregator(...) from FeaturedPlugin (a project-scoped Plugin<Project> applied to every feature module) — it reached into target.rootProject to register/mutate a convenience task scanAllLocalFlags on the root project at configuration time, the canonical Project Isolation violation.
  • Deleted the scanAllLocalFlags root task and the SCAN_ALL_TASK_NAME constant.
  • featured-gradle-plugin/src/main now contains zero rootProject access.

The real cross-module registry aggregation (generateFeaturedRegistryGeneratedFeaturedRegistry.all) was already PI-safe via the declarative featuredAggregation configuration + variant resolution — untouched.

Why

scanAllLocalFlags was a convenience task that duplicated built-in Gradle behavior: ./gradlew resolveFeatureFlags (name-matched task invocation, no project path) already runs the per-module resolveFeatureFlags task across every module that applies the plugin. Under Project Isolation a project-scoped plugin fundamentally cannot auto-register a task on root — so the task is removed rather than reworked, eliminating the violation with no new API surface.

How to test

  • ./gradlew :featured-gradle-plugin:test — 317 tests incl. the new ProjectIsolationIntegrationTest.
  • ./gradlew resolveFeatureFlags — resolves flags across all feature modules (the replacement for scanAllLocalFlags).

New ProjectIsolationIntegrationTest (TestKit) builds a multi-module fixture with org.gradle.unsafe.isolated-projects=true and asserts the configuration phase succeeds — empirical proof the plugin is PI-safe. It guards against a vacuous pass by asserting isolated-projects actually engaged (Configuration cache entry stored) and no cross-project violation (cannot access project).

Verification

  • 317/317 plugin tests pass; spotlessCheck green.
  • ProjectIsolationIntegrationTest PASS — isolated-projects engaged, resolveFeatureFlags TaskOutcome.SUCCESS, no PI violation.
  • ./gradlew resolveFeatureFlags resolves flags across all 3 sample feature modules (feature-ui 2, feature-promotions 1, feature-checkout 2).
  • /finalize PASS (1 round), /acceptance VERIFIED (all 5 ACs).

Release Notes

CHANGELOG.md (Removed):

  • Breaking: removed the scanAllLocalFlags root aggregation task. The plugin no longer accesses rootProject and is now compatible with Gradle Project Isolation. Use ./gradlew resolveFeatureFlags to resolve flags across all modules.

🤖 Generated with Claude Code

Review in cubic

… root task

Remove wireToRootAggregator and the scanAllLocalFlags root convenience
task from FeaturedPlugin: the only rootProject access in the plugin and
a Project Isolation violation. Cross-module flag resolution is covered by
the built-in name-matched ./gradlew resolveFeatureFlags invocation.

Add ProjectIsolationIntegrationTest asserting the configuration phase
succeeds with org.gradle.unsafe.isolated-projects enabled.

Closes #186

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kirich1409 kirich1409 added the gradle-plugin featured-gradle-plugin work label Jun 13, 2026
@kirich1409 kirich1409 marked this pull request as ready for review June 13, 2026 05:58
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@kirich1409 kirich1409 merged commit db9aac8 into develop Jun 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gradle-plugin featured-gradle-plugin work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant