Bug 461284 - Improve discovery and attach of .target files in eclipse-target-definition
Summary: Improve discovery and attach of .target files in eclipse-target-definition
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2015-03-03 04:31 EST by Christian Pontesegger CLA
Modified: 2021-04-28 16:52 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Pontesegger CLA 2015-03-03 04:31:39 EST
Currently we may only host one target file within an eclipse-target-definition project named <artifact>.target

If we need multiple targets for builds, we need to create a new project per target platform.

I would opt to add a <file> parameter to the target-platform-configuration to allow for multiple target files hosted in the same project:

<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
	<target>
	<artifact>
		<groupId>...</groupId>
		<artifactId>org.eclipse.project.target</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<file>alternate.target</file>
	</artifact>
	</target>
</configuration>

Without parameter we could default to <artifact>.target. But now we could use maven profiles to easily switch to another target platform without creating numerous projects.
Comment 1 Jan Sievers CLA 2015-03-03 05:08:25 EST
maven artifacts are referenced as groupId, artifactId, version coordinates; there is no "file" coordinate. The filename is derived from the coordinates.

However there is an optional fourth "classifier" coordinate (the main artifact has no classifier). 

Generally the idea with maven is that one GAV creates one (main) artifact.

We could think about allowing additional targets with classifiers for the same GAV but there should always be one main target artifact (without classifier).
Comment 2 Christian Pontesegger CLA 2015-03-03 12:05:25 EST
(In reply to Jan Sievers from comment #1)

> We could think about allowing additional targets with classifiers for the
> same GAV but there should always be one main target artifact (without
> classifier).

It is a convenience topic only. I see projects building against different targets like luna, mars, indigo. A nightly build might want to refer to other nightly update sites.

I see projects creating their target definitions on the fly on hudson, or copy around files to get the filname right for tycho to pick it up.

So if a classifier could help to make this work I would be more than happy. I also remember that prior to tycho 0.15(?) there were classifiers involved, right?
Comment 3 Jan Sievers CLA 2015-03-04 02:32:09 EST
> So if a classifier could help to make this work I would be more than happy.
> I also remember that prior to tycho 0.15(?) there were classifiers involved,
> right?

yes there was no explicit packaging type and people used to attach target artifacts using build-helper-maven-plugin using classifiers
Comment 4 Christoph Laeubrich CLA 2020-07-07 13:50:52 EDT
I'll investigate this
Comment 5 Mickael Istria CLA 2020-07-07 15:11:52 EDT
I imagine using build-helper-maven-plugin to attach some extra .target file artifacts to a given GAV is still working. In such case, I don't think we should add extra complexity in Tycho for something that has a relatively standard solution in plain Maven.
Comment 6 Christoph Laeubrich CLA 2020-07-09 02:42:56 EDT
I think attach another target as classifier is just the half way (it is marked in code as only backward-compat any ways) and would require to modify the pom each time a new target is present, also with pomless-build it can't be really used.

Currently there is also a limitation that the target file must be named like the artifact-id that requires people to rename the file even if there is no doubt because there is only one target present.

Because of this I have adjusted the bug-title a little bit and will provide a solution that has the following properties:
- the target-packaging install all targets found in the root with the "primary artifact" as the artifact and all other files as additional artifacts with classifier
- if multiple targets are there to install, there must be one target named like the artifactId that is choosen as the "primary artifact"
- if only one target is present, it will be picked up as "primary artifact" regardless of the name of the target file
- using classifiers will become first-class supported (backward notice removed)
Comment 7 Mickael Istria CLA 2020-07-09 04:26:22 EDT
> - the target-packaging install all targets found in the root with the
> "primary artifact" as the artifact and all other files as additional
> artifacts with classifier
> - if multiple targets are there to install, there must be one target named
> like the artifactId that is choosen as the "primary artifact"
> - if only one target is present, it will be picked up as "primary artifact"
> regardless of the name of the target file
> - using classifiers will become first-class supported (backward notice
> removed)

All that sound very safe and useful; I tink this would be a good addition.
Comment 8 Eclipse Genie CLA 2020-07-09 05:20:43 EDT
New Gerrit change created: https://git.eclipse.org/r/c/tycho/org.eclipse.tycho/+/166029
Comment 11 Eclipse Genie CLA 2020-07-10 08:38:12 EDT
New Gerrit change created: https://git.eclipse.org/r/c/tycho/org.eclipse.tycho/+/166149