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

Add option to automatically add references to repositories that provide dependencies #695

Closed
HannesWell opened this issue Feb 26, 2022 · 2 comments
Labels
future ideas Probabbly become relevant for Tycho in the future.

Comments

@HannesWell
Copy link
Member

The tycho-p2-repository:assemble-repository goal has the property includeAllDependencies to control if "all transitive dependencies" of included artifacts are added to a p2-repositories assembled for a category.xml file or an Eclipse product and thus controls if that repo will be self-contained.

I propose to introduce the possibility to automatically add references pointing to the repositories that provide the dependencies of the included artifacts to the assembled repository. This also makes the repository effectively self-contained but instead of embedding dependencies only the providing repositories are referenced so that P2 can fetch those dependencies from the original repo during installation. Given that the providing repo does not change it should lead to the same result but the assembled repository would be smaller.

Naively spoken what has to be done is:

  1. to each dependency resolved from the TP (or Maven) attach the providing repository
  • It should be the real/final repo in case of a p2-composite repository
  1. Compute the dependency closure (just like when includeAllDependencies is set to true) and add the Set of providing repos as reference to the assembled repo instead of adding the dependencies themself.

I have not yet looked into the the details, but potential difficulties could be:

  • Does P2 expose the exact repo a dependency is coming from?
  • References for Maven dependencies;
    • IIRC support was added for links to Maven-artifacts using their coordinates? Does P2 understand them too, or only Tycho and M2E?
    • Can the BND-instructions be embedded into that link too? BND-instructions could for example change the Bundle-Symbolic name.
    • Can an alternative Maven repository be specified if a Maven artifact is not obtained from Maven-Central?

Unless somebody else wants to work on this, I can offer to take care of this proposal in the mid-term future.
@läubi Is this what you have propose in eclipse-m2e/m2e-core#554 (comment)?

@laeubi laeubi added the future ideas Probabbly become relevant for Tycho in the future. label Feb 27, 2022
@laeubi
Copy link
Member

laeubi commented Feb 27, 2022

I think "self-contained" more reefers to that I could zip the whole site and everything is included but beside the naming it is not that trivial as it may sound in the first place, just from the "traditional" locations:

  1. Tycho do not know what is the origin of an artifact
  2. An artifact can effectively come from multiple sites (mirrors, composites, someone republishing the artifact)
  3. Artifacts can even come from location that do not have an URL
  4. Artifacts can even come from URLs that are not public accessible (file-url, configured mirrors, ...)
  5. Embedding other Update-site URLs is prone to break your Update-site if the other site changes the URL or remove it completely

Because of this I think having something automatic would add a lot of complexity and it might be more profitable to manage it manually.

What is would be rather simple (and what I have suggested in eclipse-m2e/m2e-core#554 (comment) ) is to fetch the target (if any) iterate it and simply add all URLs of type P2 location as "also look there", and given the concept of a target it makes most sense if one really likes to have such a feature.

About the maven-item part:

  1. Everything that is a valid maven coordinate could be expressed as a maven URL but you would require consumers to either use tycho or m2e, that might or might not be a restriction
  2. as an alternative you could add the actual http url, but this will bind to one specific place (so no mirrors, no caching in the local repository)
  3. You can't use that for anything that is BND wrapped (or at least not without adding special support for this in P2 even though this is something I have had in mind already also for source items)

@HannesWell
Copy link
Member Author

With the new addIUTargetRepositoryReferences and filterProvided as well as the repositoryReferenceFilter for the tycho-p2-repository-plugin I think we can consider this resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future ideas Probabbly become relevant for Tycho in the future.
Projects
None yet
Development

No branches or pull requests

2 participants