eclipse-xtext / eclipse-xtext/xtext
EclipseResourceFileSystemAccess2 file generation causes global rebuild of all build configs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
@cdietrich This is the issue you requested during consulting.
Issue
In a workspace we have a project with our Xtext nature, and an unrelated CDT project. On generating code from our Xtext project, the CDT project is rebuilt. There are no project references, generated files don't overlap with the CDT project, and there is no externally caused refresh of the workspace files (e.g. no modification of the workspace files via java.io.File API).
If we replace the IFileSystemAccess2 based file generation by plain IFile writing, then the unwanted build does not happen.
Root cause
Writing generated files viaEclipseResourceFileSystemAccess2 triggers the callback implementation in BuilderParticipant after files have been created, changed or deleted. Every such file change invokes BuildContext.needRebuild(). Via IncrementalProjectBuilder that finally sets the rebuildRequested flag of the global BuildManager. Unfortunately, if that flag is set, all build configs are rebuild, and not just the one that relates to the Xtext project.
We don't understand why the global rebuild needs to be triggered there. If we replace the IFileSystemAccess2 by plain IFile writing, then the generated files cause additional builds via resource delta notifications, which is sufficient (since it only affects the projects containing the generated files, but not other projects).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the callback in org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/BuilderParticipant.java, especially the BuildContext.needRebuild() call, and trace how it reaches IncrementalProjectBuilder and the global BuildManager rebuildRequested flag. Reproduce code generation in an Xtext project alongside an unrelated CDT project. Done means generated files still trigger the needed build without rebuilding unrelated build configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100