From 44ad9d631681680af4a4612ae6db0b734e8ef1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Thu, 2 Apr 2026 18:43:38 +0200 Subject: [PATCH] fix: replace global needRebuild() with project-scoped rebuild APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/xtext-eclipse#1820) Co-Authored-By: Claude Opus 4.6 (1M context) --- .../avaloq/tools/ddk/xtext/builder/BuildContext.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/BuildContext.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/BuildContext.java index 5dc840baf7..f39bd0bb50 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/BuildContext.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/BuildContext.java @@ -117,8 +117,17 @@ public ResourceSet getResourceSet() { @Override public void needRebuild() { rebuildRequired = true; + } + + @Override + public void needRebuild(final IProject project) { + rebuildRequired = true; if (builder != null) { - builder.needRebuild(); + if (getBuiltProject().equals(project)) { + builder.triggerRequestProjectRebuild(); + } else { + builder.triggerRequestProjectsRebuild(project); + } } }