eclipse-platform / eclipse-platform/eclipse.platform

AntRunner does not use ProjectHelperRegistry / Blocks Polyglot Interpretation in Eclipse

Offen
#205 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
165
Forks
174
Ø Merge
2 T. 8 Std.
Gemergte PRs (30 T.)
22

Beschreibung

Ant is meant to allow polyglot interpretation using [custom Project Helpers](https://ant.apache.org/manual/projecthelper.html).

The build file below should prompt ant to consult the [`ProjectHelperRepository`](https://ant.apache.org/manual/api/org/apache/tools/ant/ProjectHelperRepository.html) to see if any [`ProjectHelper`](https://ant.apache.org/manual/api/org/apache/tools/ant/ProjectHelper.html) is able to handle the `custom.format`.
```xml

```

Eclipse's `InternalAntRunner` does not do that. Instead it selects the [current project helper](https://github.com/eclipse-platform/eclipse.platform/blob/master/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java#L390), which is [the first project helper found in the classpath](https://ant.apache.org/manual/api/org/apache/tools/ant/ProjectHelper.html#getProjectHelper()).

This behaviour is incorrect. Instead, it should call [`ProjectHelper.configureProject()`](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelper.java#L100) first. This correct behaviour is implemented by all `ant` invocations in the ant distribution, as visible from the call graph below.

![image](https://user-images.githubusercontent.com/782737/194190448-f3a98a74-19a7-413d-9b1d-0e4f8191a023.png)

This a snippet of the implementation of the function.

```java
/**
* Configures the project with the contents of the specified build file.
*
* @param project The project to configure. Must not be null.
* @param buildFile A build file giving the project's configuration.
* Must not be null.
*
* @exception BuildException if the configuration is invalid or cannot be read
*/
public static void configureProject(Project project, File buildFile) throws BuildException {
FileResource resource = new FileResource(buildFile);
ProjectHelper helper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(resource);
project.addReference(PROJECTHELPER_REFERENCE, helper);
helper.parse(project, buildFile);
}
```

Could you please add this, as it blocks polyglot use of ant.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne in ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java in der Nähe der im Issue referenzierten Auswahl des project-helper. Vergleiche diese Einrichtung mit Ants ProjectHelper.configureProject() und dessen ProjectHelperRepository-Suche. Als erledigt gilt die Änderung, wenn der bereitgestellte XML-Import einem passenden benutzerdefinierten ProjectHelper erlaubt, custom.format zu verarbeiten, anstatt immer den ersten Classpath-Helper zu verwenden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
build-system, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.