eclipse-platform / eclipse-platform/eclipse.platform
AntRunner does not use ProjectHelperRegistry / Blocks Polyglot Interpretation in Eclipse
- 主要言語
- Java
- スター
- 165
- フォーク
- 174
- 平均マージ
- 2日 8時間
- マージ済み PR(30日)
- 22
説明
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.

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.
コントリビューションガイド
調査の方向性
issue で参照されている project-helper の選択箇所の近くにある ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java から始めてください。その設定を、Ant の ProjectHelper.configureProject() と、そこでの ProjectHelperRepository の検索処理と比較します。提供された XML import によって、一致するカスタム ProjectHelper が custom.format を処理でき、常に classpath の最初の helper が使われる状態でなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- build-system, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100