eclipse-platform / eclipse-platform/eclipse.platform

AntRunner does not use ProjectHelperRegistry / Blocks Polyglot Interpretation in Eclipse

Abierto
#205 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
165
Forks
174
Merge medio
2 d 8 h
PR fusionados (30 d)
22

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java, cerca de la selección de project-helper mencionada en el issue. Compara esa configuración con ProjectHelper.configureProject() de Ant y su búsqueda en ProjectHelperRepository. Se considera completado cuando el import XML proporcionado permite que un ProjectHelper personalizado coincidente gestione custom.format en lugar de usar siempre el primer helper del classpath.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
build-system, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.