Skip to content

fix: replace global needRebuild() with project-scoped rebuild APIs#1300

Merged
joaodinissf merged 1 commit intodsldevkit:masterfrom
joaodinissf:fix/remove-redundant-builder-needRebuild
Apr 6, 2026
Merged

fix: replace global needRebuild() with project-scoped rebuild APIs#1300
joaodinissf merged 1 commit intodsldevkit:masterfrom
joaodinissf:fix/remove-redundant-builder-needRebuild

Conversation

@joaodinissf
Copy link
Copy Markdown
Collaborator

@joaodinissf joaodinissf commented Apr 2, 2026

Summary

  • Remove the vestigial IncrementalProjectBuilder.needRebuild() call that triggered global workspace rebuilds every time a builder participant generated a file
  • Override needRebuild(IProject) using Eclipse 3.17+ project-scoped APIs, matching the upstream Xtext 2.27+ pattern

What Changes

No-arg needRebuild(): Remove builder.needRebuild(), keeping only the internal rebuildRequired flag.

New needRebuild(IProject) override: Uses project-scoped Eclipse APIs:

  • Same project: builder.triggerRequestProjectRebuild() — rebuilds only this project
  • Different project: builder.triggerRequestProjectsRebuild(project) — rebuilds only that project

References

Test plan

  • Open workspace with multiple DSL projects
  • Edit a file in one project that triggers code generation
  • Verify only the affected project rebuilds (not the entire workspace)
  • Verify generated sources are still correctly reprocessed (internal loop still works)

🤖 Generated with Claude Code

@joaodinissf joaodinissf force-pushed the fix/remove-redundant-builder-needRebuild branch from cd9b3aa to dd4b31f Compare April 2, 2026 16:29
@joaodinissf joaodinissf changed the title fix: remove redundant IncrementalProjectBuilder.needRebuild() from Bu… fix: remove global needRebuild() cascade, implement project-scoped rebuild Apr 2, 2026
@joaodinissf joaodinissf force-pushed the fix/remove-redundant-builder-needRebuild branch 2 times, most recently from ba39b55 to 068faeb Compare April 2, 2026 16:43
@joaodinissf joaodinissf changed the title fix: remove global needRebuild() cascade, implement project-scoped rebuild fix: replace global needRebuild() with project-scoped rebuild APIs Apr 2, 2026
@joaodinissf joaodinissf force-pushed the fix/remove-redundant-builder-needRebuild branch from 068faeb to 4fb930a Compare April 6, 2026 19:54
@joaodinissf joaodinissf marked this pull request as ready for review April 6, 2026 19:54
BuildContext.needRebuild() called IncrementalProjectBuilder.needRebuild(),
which sets a global rebuildRequested flag on Eclipse's BuildManager,
causing ALL projects in the build cycle to be rebuilt — not just the
current project. This was redundant because RebuildingXtextBuilder
already handles generated-source reprocessing via an internal rebuild
loop (up to 2 extra iterations in doBuild()).

The global call was a leftover from a 2014 workaround (Eclipse Bug
#452399) that was never removed. Additionally, BuildContext did not
override needRebuild(IProject) (added in Xtext 2.27), so callers using
the modern API fell through to the deprecated global version.

Changes:
- Remove builder.needRebuild() from the no-arg needRebuild(), keeping
  only the internal rebuildRequired flag
- Override needRebuild(IProject) using Eclipse 3.17+ project-scoped
  APIs (triggerRequestProjectRebuild / triggerRequestProjectsRebuild),
  matching the upstream Xtext pattern (eclipse-archived/xtext-eclipse#1820)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joaodinissf joaodinissf force-pushed the fix/remove-redundant-builder-needRebuild branch from 4fb930a to 44ad9d6 Compare April 6, 2026 19:59
@joaodinissf joaodinissf enabled auto-merge (rebase) April 6, 2026 19:59
@joaodinissf joaodinissf merged commit a06d963 into dsldevkit:master Apr 6, 2026
3 checks passed
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.

2 participants