Bug 538144 - Support other target locations (Directory, Features, Installations)
Summary: Support other target locations (Directory, Features, Installations)
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: 550601
Blocks:
  Show dependency tree
 
Reported: 2018-08-22 03:32 EDT by Christoph Laeubrich CLA
Modified: 2021-04-28 16:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2018-08-22 03:32:38 EDT
Currently tycho only support P2-locations, but there are others as well (directory, Profile, feature).
A first step to support these is parsing of the location types so they can be used in the resolving process, currently the are all handled as "OtherLocation" types and can't be used for further processing.
Comment 1 Eclipse Genie CLA 2018-08-22 03:36:14 EDT
GitHub Pull Request 12 created by [laeubi]
https://github.com/eclipse/tycho/pull/12
Comment 2 Mickael Istria CLA 2018-08-22 09:27:57 EDT
thanks. Please contribute to Tycho using Gerrit as described in https://wiki.eclipse.org/Tycho/Contributor_Guide
Comment 3 Eclipse Genie CLA 2018-08-22 11:47:30 EDT
New Gerrit change created: https://git.eclipse.org/r/127871
Comment 4 Mickael Istria CLA 2018-08-22 11:51:01 EDT
Your proposal seems to be harmless and a good candidate for being merged but parsing it wouldn't make it used by Tycho dependnecy resolution. Can you please elaborate why you need it parsed? (just to evaluate whether there are some alternative to consider).
Comment 5 Christoph Laeubrich CLA 2018-08-22 11:57:18 EDT
I'd like to try to add support for these types in the target resolving, to keep things small I thought it was a good idea to first add support for parsing those.
Comment 6 Mickael Istria CLA 2018-08-22 11:57:47 EDT
Ok.
Comment 8 Mickael Istria CLA 2018-08-22 12:03:42 EDT
I merged your patch thanks.
I can suggest that you retitle this bug with the final goal and we keep it open to track the whole story. We can keep working on finer grained patches/reviews if you prefer.
Comment 9 Christoph Laeubrich CLA 2018-08-22 12:38:06 EDT
Ok, I'll take a look what might be a next step on the way :-) Thanks for reviewing/merging.
Comment 10 Christoph Laeubrich CLA 2018-08-29 14:30:07 EDT
I have investigated a little bit whats going on under the hood and think there are two ways to archive this:

1) I can emulate an IInstallableUnit (this seems the way how maven artifacts are provided when using considerPomDependecies), but this is already marked as "fix it sometimes later"

2) I think currently the target definition concept of Tycho is different from the one in eclipse, Tycho completely relies on P2 metadata, but in eclipse a target platform is more a set of bundles and features, where P2 is just one source of bundles and features (for example you can't resolve P2 dependencies against Directory or Feature Locations). That is also why tycho currently can't support the "selected bundles" feature of the target platform.
So I first need to introduce a concept of "TargetBundle/TargetFeature" that allows Tycho to resolve against instead of using P2 directly and push the P2 part away from the core resolving.

Any thoughts?
Comment 11 Mickael Istria CLA 2018-08-30 03:19:31 EDT
(In reply to Christoph Läubrich from comment #10)
> 1) I can emulate an IInstallableUnit (this seems the way how maven artifacts
> are provided when using considerPomDependecies), but this is already marked
> as "fix it sometimes later"

Sounds like a good thing to do, especially if this was marked as a todo. It means the change is welcome.

> 2) I think currently the target definition concept of Tycho is different
> from the one in eclipse, Tycho completely relies on P2 metadata, but in
> eclipse a target platform is more a set of bundles and features, where P2 is
> just one source of bundles and features (for example you can't resolve P2
> dependencies against Directory or Feature Locations).

Right.

> That is also why tycho
> currently can't support the "selected bundles" feature of the target
> platform.
> So I first need to introduce a concept of "TargetBundle/TargetFeature" that
> allows Tycho to resolve against instead of using P2 directly and push the P2
> part away from the core resolving.

This would be a difficult task.
Tycho entirely relies on p2 for dependency management. Adding support for directory and non-p2 installation types would require to hook additional dependency resolution mechanism in Tycho, or to generate dummy p2 metadata for those units, to include during dependency management.
As this is a big and difficult task in any case, I think it's better for you to first consider whether the ROI is there.

About the "Installation" type, it's possible to interpret it as a p2-friendly source. The installation contains p2 metadata of the installed bundles. While this is not how PDE uses it, it could be a good way to implement it in Tycho without too much difficulty.
If this is enough for your use-case, I'd suggest following this path which seems simpler to implement and powerful enough.
Comment 12 Eclipse Genie CLA 2020-06-18 07:14:43 EDT
New Gerrit change created: https://git.eclipse.org/r/165135
Comment 13 Roland Grunberg CLA 2020-06-22 12:54:09 EDT
Another consideration (In reply to Christoph Laeubrich from comment #10) 
> 1) I can emulate an IInstallableUnit (this seems the way how maven artifacts
> are provided when using considerPomDependecies), but this is already marked
> as "fix it sometimes later"

As a consideration, this is also what we did in Fedora (OS) so that Tycho could resolve local artifacts. The build system there didn't allow contacting remote location (eg. a remote p2 repo) and all bundles were installed locally on the system. We basically created a p2 repository implementation that understood local filesystem locations ( https://fedoraproject.org/wiki/Tycho#Local_OSGi_bundle_resolution ).

The work is at https://github.com/rgrunber/fedoraproject-p2 . It wasn't too difficult to get that working for directories. For additional locations you'd just need to implement IMetadataRepository, IArtifactRepository, and create your own subclasses of MetadataRepositoryFactory/ArtifactRepositoryFactory to have a way of recognizing when to act.
Comment 15 Mickael Istria CLA 2020-07-07 15:33:25 EDT
Thanks a lot for this major addition Christoph!
Can you please add a note about it to https://wiki.eclipse.org/Tycho/Release_Notes/2.0#New_and_Noteworthy ? Also, if you feel like you want to announce it on the tychp-user and/or tycho-dev mailing-list for feedback.
Comment 16 Christoph Laeubrich CLA 2020-07-08 01:35:22 EDT
Added a note to the release-notes. I think user-list is a good idea so people can test as soon as possible as I'm sure there might be some cases that are not currently covered :-)