Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing custom variables in linked project resources #3820

Open
HeikoKlare opened this issue May 5, 2024 · 2 comments
Open

Parsing custom variables in linked project resources #3820

HeikoKlare opened this issue May 5, 2024 · 2 comments

Comments

@HeikoKlare
Copy link
Contributor

Current Behavior

The ProjectParser is able to resolve linked resources and also supports some pre-defined variable names supported by the Eclipse platform (such as PROJECT_LOC and PARENT-X-PROJECT_LOC). It does, however, not yet support custom variables that can be defined in the variablesList of a project description file to share paths between multiple linked resources. When using custom variables in the location URIs of linked resources, they are considered as ordinary path segments.

Example

The binary fragments in SWT define a variable for the path to the host project:

<variableList>
	<variable>
		<name>SWT_HOST_PLUGIN</name>
		<value>$%7BPARENT-2-PROJECT_LOC%7D/bundles/org.eclipse.swt</value>
	</variable>
</variableList>

This is then used in locationURIs for linked resources, such as:

<link>
	<name>Eclipse SWT WebKit</name>
	<type>2</type>
	<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20WebKit</locationURI>
</link>

In this case, Tycho considers SWT_HOST_PLUGIN as an ordinary path segment as it is not aware of custom variables.

Expected Behavior

Tycho should resolve custom variables just like the project description resolver of the Eclipse platform does.

I do not consider this an urgent topic, as those variables are only a means to avoid repetitions. Still it would by nice to have in order to be consistent with the capabilities of project description files in the Eclipse platform.

@laeubi
Copy link
Member

laeubi commented May 5, 2024

Actually there is already org.eclipse.tycho.model.project.EclipseProject.getVariables() but it seems unused at the moment.

@HeikoKlare
Copy link
Contributor Author

Actually there is already org.eclipse.tycho.model.project.EclipseProject.getVariables() but it seems unused at the moment.

Indeed, and ProjectParser.parse() already fills EclipseProject with the defined variables, so the variables and their values can already be retrieved. ProjectParser.resolvePath() will require some additional logic to resolve them (probably analogous to org.eclipse.core.internal.resources.ProjectPathVariableManager.resolveVariable()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants