eclipse-xtext / eclipse-xtext/xtext

xtext clean output - not removing all output folders, if previous does not exists

Open
#2,853 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

Hi,
I would like to report a possible bug. Please take a look at line 490 in org.eclipse.xtext.builder.BuilderParticipant -> cleanOutput(IBuildContext, OutputConfiguration, EclipseResourceFileSystemAccess2, IProgressMonitor)

https://github.com/eclipse/xtext/blob/cab7c302fcdc9b8975d58b12061da06c12ec369c/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/BuilderParticipant.java#L490

This method removes output folders based on configuration: the general logic is:
for (IContainer container : getOutputs(project, config)) {
delete the output
}

The problem is with the following lines:
for (IContainer container : getOutputs(project, config)) {
if (!container.exists()) {
return;
}

It stops deleting on the first non-existing resource to be deleted. So, if getOuputs returns two folders, and both exists - both will be deleted. If the first one does not exists, but the second does - it will not be deleted.

I propose to change "return" into "continue" - this should fix the issue.
Kind regards
Marcin

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at line 490 in org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/BuilderParticipant.java, within cleanOutput(IBuildContext, OutputConfiguration, EclipseResourceFileSystemAccess2, IProgressMonitor), and inspect how the getOutputs(project, config) loop handles missing containers. Done means cleanup continues past a missing first output and removes later existing output folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.