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

Provide a way to opt out of the behavior introduced by issue 898, i.e., don't include imports in the p2 repository #1281

Closed
merks opened this issue Aug 23, 2022 · 46 comments · Fixed by #1285
Assignees
Milestone

Comments

@merks
Copy link
Contributor

merks commented Aug 23, 2022

Please provide a configuration option to opt out of the new behavior that was introduced by this issue:

#898

The new behavior has already broken EPP's repository assembly build:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=580592#c3

Note the comment in that bug: I think I am going to stay on older Tycho for the foreseeable future.

I tested 2.7.4 with EMF's and here too the repository contains more than it has for the past 5 years of using Tycho. E.g., these plugins are now all present and I definitely don't want to duplicate such content in each EMF repository:

org.antlr.runtime_3.2.0.v20220404-1927.jar
org.apache.ant_1.10.12.v20211102-1452.jar
org.apache.commons.logging_1.2.0.v20180409-1502.jar
org.apache.commons.logging_1.2.0.v20180409-1502.jar.pack.gz
org.apache.log4j_1.2.19.v20220208-1728.jar
org.eclipse.ant.core_3.6.500.v20220718-1722.jar
org.eclipse.compare_3.8.500.v20220812-1406.jar
org.eclipse.core.resources_3.18.0.v20220817-1539.jar
org.eclipse.core.runtime_3.26.0.v20220813-0916.jar
org.eclipse.datatools.connectivity.oda.design.ui_3.4.101.201811012051.jar
org.eclipse.datatools.connectivity.oda_3.6.101.201811012051.jar
org.eclipse.debug.core_3.20.0.v20220811-0741.jar
org.eclipse.jdt.core_3.31.0.v20220822-0619.jar
org.eclipse.jdt.launching_3.19.700.v20220730-1850.jar
org.eclipse.jface.text_3.21.0.v20220817-1340.jar
org.eclipse.rap.ui.views_3.22.0.20220617-1351.jar
org.eclipse.rap.ui.workbench_3.22.0.20220617-1351.jar
org.eclipse.rap.ui_3.22.0.20220617-1351.jar
org.eclipse.text_3.12.200.v20220817-1340.jar
org.eclipse.ui.editors_3.14.400.v20220730-1844.jar
org.eclipse.ui.ide_3.19.100.v20220820-0412.jar
org.eclipse.ui.views_3.11.200.v20220817-1444.jar
org.eclipse.ui.workbench.texteditor_3.16.600.v20220809-1658.jar
org.eclipse.ui.workbench_3.126.0.v20220817-1444.jar
org.eclipse.ui_3.201.0.v20220124-1108.jar
org.eclipse.xtext.builder_2.28.0.v20220801-0623.jar
org.eclipse.xtext.common.types.ui_2.28.0.v20220801-0623.jar
org.eclipse.xtext.common.types_2.28.0.v20220801-0607.jar
org.eclipse.xtext.ui.shared_2.28.0.v20220801-0623.jar
org.eclipse.xtext.ui_2.28.0.v20220801-0623.jar
org.eclipse.xtext.util_2.28.0.v20220801-0559.jar
org.eclipse.xtext.xbase.lib_2.28.0.v20220801-0556.jar
org.eclipse.xtext.xbase.ui_2.28.0.v20220801-0623.jar
org.eclipse.xtext.xbase_2.28.0.v20220801-0607.jar
org.eclipse.xtext_2.28.0.v20220801-0559.jar

Only strictly included plugins (and features) ended up in the repo before but now all imported things end up in the repo as well. Worse still, I see no mechanism to fix this, other than to delete things from the feature.xml. But if I didn't need or want those imports in the feature.xml they wouldn't be there there in the first place. So I have lost significant control over what's in my repository and I need that back. Even this change of behavior as the default new behavior is rather questionable because none of us expect the repository to grow when switching to the latest and greatest Tycho version; many of us would easily fail to notice this change.

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

Note the comment in that bug: I think I am going to stay on older Tycho for the foreseeable future.

This is a valid choice and that's what release are for: for people who don't like to change.

Please provide a configuration option to opt out of the new behavior that was introduced by this issue:

You don't need a configuration option, simply remove requirements from your feature that you actually don't like to require. So you already ca configure this.

But if I didn't need or want those imports in the feature.xml they wouldn't be there there in the first place

I don't think this is a valid assumptions. People simply add things, press button as they think it might fix something. So as long as you can not came up with a case where it is "needed" beside "my feature require this" ...

Only strictly included plugins (and features) ended up in the repo before but now all imported things end up in the repo as well.

The previous behavior was wrong and this is no fixed. Requirements are "strictly required" so if you think they are not simply do not include them...

many of us would easily fail to notice this change

That's why it is noticed in the release notes if you think it needs a more exhaustive description feel free to propose a change, its always better if users write it from their point of view than the developer.

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

Note the comment in that bug: I think I am going to stay on older Tycho for the foreseeable future.

This is a valid choice and that's what release are for: for people who don't like to change.

It's not a permanent solution though. Eventually I will be forced to use a newer version because of something the platform does or provides...

Please provide a configuration option to opt out of the new behavior that was introduced by this issue:

You don't need a configuration option, simply remove requirements from your feature that you actually don't like to require. So you already ca configure this.

As I mentioned they are there for a reason.

But if I didn't need or want those imports in the feature.xml they wouldn't be there there in the first place

I don't think this is a valid assumptions. People simply add things, press button as they think it might fix something. So as long as you can not came up with a case where it is "needed" beside "my feature require this" ...

I do not make assumptions about my own project's code. I'm stating a fact. Those things are intentionally there and are not the result of pushing a button. Same for EPP. It's intentional to specify the additional requirements so that they are present in the p2 metadata, but definitely not intended to copy the content into the repo.

Only strictly included plugins (and features) ended up in the repo before but now all imported things end up in the repo as well.

The previous behavior was wrong and this is no fixed. Requirements are "strictly required" so if you think they are not simply do not include them...

How can you say the old behavior was wrong? It's what I expect and how it's been for 1/2 a decade. The new behavior is not what I want. So right, wrong, or indifferent is not so much the issue but rather about letting me choose what I want versus taking that choice way. Instead you say I must have the new correct behavior, all else is wrong. So I must edit all my feature..xml to remove what I want to be there because you say it's no officially wrong to have it if I don't want my repo to duplicate the content of dependencies. That feels draconian and unhelpful to me...

many of us would easily fail to notice this change

That's why it is noticed in the release notes if you think it needs a more exhaustive description feel free to propose a change, its always better if users write it from their point of view than the developer.

You don't really expect that everyone paws through release note do you?

@mickaelistria
Copy link
Contributor

It's intentional to specify the additional requirements so that they are present in the p2 metadata,

Requirements are transtively resolved, so what do those extra requirements in feature add here? What is broken if those are removed?

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

Specifically for EPP, this p2 metadata needed to generate the product catalog because otherwise nothing in the metadata specifies the installMode="root" requirements of the product.

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

It's not a permanent solution though. Eventually I will be forced to use a newer version because of something the platform does or provides...

No one forces you to use new features, but actually that's the way with everything in your dependency chain, CI system, Java versions, dependencies, build tools, even operating systems or hardware!

At least Tycho can't afford the burden of keeping 100% backward compatibility by switches for every feature / fix


https://xkcd.com/1172/

Those things are intentionally there and are not the result of pushing a button. Same for EPP. It's intentional to specify the additional requirements so that they are present in the p2 metadata, but definitely not intended to copy the content into the repo.

And it is intentional that Tycho includes everything that is specified in the P2 metadata.

How can you say the old behavior was wrong?

Because the generated meta-data was incomplete. Now this is fixed and this leads to the correct behavior of including the declared requirements.

You don't really expect that everyone paws through release note do you?

What do you think they are for if not for people reading them before upgrading to a newer release?

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

No one forces you to use new features, but actually that's the way with everything in your dependency chain, CI system, Java versions, dependencies, build tools, even operating systems or hardware!

I didn't realize that. But it seems so obvious now.

At least Tycho can't afford the burden of keeping 100% backward compatibility by switches for every feature / fix

I have a hard time affording being downstream from everything gets broken.

And it is intentional that Tycho includes everything that is specified in the P2 metadata.

So it behaves as if includeAllRequirements is true even when that's false? If not, how is the behavior different from includeAllRequirements?

How can you say the old behavior was wrong?

Because the generated meta-data was incomplete. Now this is fixed and this leads to the correct behavior of including the declared requirements.

But I need that to be the case! Maybe you don't notice that problem when you are not now downstream from 5000 dependencies, but surely everyone does not want to include all their dependencies in the repositories.

You don't really expect that everyone paws through release note do you?

What do you think they are for if not for people reading them before upgrading to a newer release?

Answering a question with a question. It would never occur to me that there purpose of release nodes is to be read.

@mickaelistria
Copy link
Contributor

Specifically for EPP, this p2 metadata needed to generate the product catalog because otherwise nothing in the metadata specifies the installMode="root" requirements of the product

Sorry, I don't understand.
Can you please share references to the .product and feature.xml file and emphasize what particularly becomes incorrect in metadata if removing requirement in feature.xml?

@cdietrich
Copy link
Contributor

cdietrich commented Aug 23, 2022

in the past we deliberate moved stuff from include to import to avoid packaging it to our repository.

@LorenzoBettini
Copy link
Contributor

As I said here #898 (comment)

Maybe I'm missing something or forgot something, but from what I remember, such requirements in features are meant for things that are needed at runtime (while, of course, transitive dependencies for compile are usually taken care of automatically since they are required somewhere in MANIFEST). So this might look like a breaking change.

For example, I deploy a feature that is meant to be used with JDT UI, but I never use JDT in my code: I specify JDT feature as a requirement in my feature (not as included). Then, I'll also add a repository reference in my category to make things easier for the consumers of my update site.

I still haven't tested this feature (Is it in Tycho 2.7.4?)

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

@mickaelistri

Here's such a product with such installMode="root" requirements:

https://git.eclipse.org/c/epp/org.eclipse.epp.packages.git/tree/packages/org.eclipse.epp.package.committers.product/epp.product#n209

Those requirements don't end up in the p2 metadata so a p2.inf is generated to express those, i.e., the ones with filter (org.eclipse.epp.install.roots=true) here:

<unit id='epp.package.committers' version='4.25.0.20220804-1200'>
  <update id='epp.package.committers' range='[4.6.0.20160301-1200,4.25.0.20220804-1200)' severity='0' description='Eclipse package upgrade from versions before Eclipse Neon (4.6) is not possible. See bug 332989.'/>
  <properties size='5'>
    <property name='org.eclipse.equinox.p2.name' value='Eclipse IDE for Eclipse Committers'/>
    <property name='org.eclipse.equinox.p2.type.product' value='true'/>
    <property name='org.eclipse.equinox.p2.type.group' value='true'/>
    <property name='org.eclipse.equinox.p2.description' value='2022-03 Release of the Eclipse Committers package.'/>
    <property name='org.eclipse.equinox.p2.provider' value='Eclipse Packaging Project'/>
  </properties>
  <provides size='1'>
    <provided namespace='org.eclipse.equinox.p2.iu' name='epp.package.committers' version='4.25.0.20220804-1200'/>
  </provides>
  <requires size='37'>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.epp.package.common.feature.feature.group' range='[4.25.0.20220804-1200,4.25.0.20220804-1200]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.jdt.source.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.mylyn.wikitext_feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.wildwebdeveloper.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.jgit.http.apache.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='toolingepp.package.committers.application' range='[4.25.0.20220804-1200,4.25.0.20220804-1200]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='tooling.osgi.bundle.default' range='[1.0.0,1.0.0]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.egit.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.pde.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.epp.mpc.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.p2.user.ui.feature.group' range='[2.4.1700.v20220728-1420,2.4.1700.v20220728-1420]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.wildwebdeveloper.embedder.node.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.pde.source.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.jdt.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.help.feature.group' range='[2.3.1100.v20220728-1800,2.3.1100.v20220728-1800]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='toolingepp.package.committers.configuration' range='[4.25.0.20220804-1200,4.25.0.20220804-1200]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.platform.feature.group' range='[4.25.0.v20220728-1800,4.25.0.v20220728-1800]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.jgit.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.egit.gitflow.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='osgi.ee' name='JavaSE' range='[11.0.0,11.0.0]'>
      <filter>
        (osgi.os=linux)
      </filter>
    </required>
    <required namespace='osgi.ee' name='JavaSE' range='[11.0.0,11.0.0]'>
      <filter>
        (osgi.os=win32)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='tooling.source.default' range='[1.0.0,1.0.0]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.eclemma.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.m2e.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='osgi.ee' name='JavaSE' range='[11.0.0,11.0.0]'>
      <filter>
        (osgi.os=macosx)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.buildship.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.platform.source.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.justj.openjdk.hotspot.jre.full.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.m2e.pde.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.swt.tools.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='tooling.org.eclipse.update.feature.default' range='[1.0.0,1.0.0]'>
      <filter>
        (org.eclipse.update.install.features=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.m2e.lemminx.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.epp.package.committers.feature.feature.group' range='[4.25.0.20220804-1200,4.25.0.20220804-1200]'/>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.oomph.setup.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.rcp.source.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.e4.core.tools.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.tm.terminal.feature.feature.group' range='0.0.0'>
      <filter>
        (org.eclipse.epp.install.roots=true)
      </filter>
    </required>
  </requires>
  <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
</unit>

@estepper
Copy link

The old behavior was not a bug but just correct and in line with common expectation! The format and the semantics of feature.xml were not invented by Tycho. I can't understand why some Tycho people decide to re-interpret these established semantics and break all their consumers.

In feature.xml we can use two different elements, and , where the former installs an IU while the latter is more like a "require" without any permanent effect beyond the resolution operation. In p2 that would be greedy vs. non-greedy. Would anyone claim that there's no value in this difference?! So why are you making them behave the same?

Eclipse runtime respects these semantics in an installation and PDE does so in a target platform. We can expect that our favorite build tool continues to do so, as well.

If there are reasons for different behavior in special, possibly personal situations then please offer an option to opt-in to this new behavior. It's so easy to be not-disruptive to your established user base...

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

So it behaves as if includeAllRequirements is true even when that's false? If not, how is the behavior different from includeAllRequirements?

No. includeAllRequirements behaves as described. it includes requirements of requirements and then the requirement of those and so on...

but surely everyone does not want to include all their dependencies in the repositories.

As explained, not all requirements are included, only those of the features you declare to be included into your update-site. If you include in your updatesites features that require "everything" then of course this "everything" is included.

in the past we deliberate moved stuff from include to import to avoid packaging it to our repository.

If you don't want stuff to be included, simply don't include it in your feature. There is no such thing as "requirement to be packed" versus "requirement not to be packed"... there is only "requirements of this feature you included" and for that there is no difference in the P2 meta-data

<requires>
      <import plugin="bcpkix"/>
</requires>

is simply the install-time equivalent to

<plugin id="bcpkix">...</plugin>

what is resolved at build time.

@cdietrich
Copy link
Contributor

cdietrich commented Aug 23, 2022

If you don't want stuff to be included, simply don't include it in your feature. There is no such thing as "requirement to be packed" versus "requirement not to be packed"... there is only "requirements of this feature you included" and for that there is no difference in the P2 meta-data

how can i say: if you install this feature please also install this other feature without adding a dependency to all contents of that other feature and without including it on our update site then.

any why is there a

<!-- this is another feature -->
   <includes
         id="org.eclipse.xtext.runtime"
         version="0.0.0"/>

and a

<!-- this is another feature -->
   <requires>
      <import feature="org.eclipse.emf.mwe2.language.sdk" version="2.13.0" match="greaterOrEqual"/>
   </requires>

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

The old behavior was not a bug but just correct and in line with common expectation!

Can you give any normative reference here please? I mean beside "we did it always like this" ....

In feature.xml we can use two different elements, and , where the former installs an IU while the latter is more like a "require" without any permanent effect beyond the resolution operation. In p2 that would be greedy vs. non-greedy. Would anyone claim that there's no value in this difference?! So why are you making them behave the same?

Please take a look at the resulting P2 metadata, they are the same there is nothing like "more like" or "greedy", they are both represented exactly the same!

The only difference is, that if you give a "not a version" aka "0.0.0" the version for the first is resolved at build time, while the later is resolved at install time.

where the former installs an IU while the latter is more like a "require" without any permanent effect beyond the resolution operation

Please take a look at the help page (emphasis by me):

The Dependencies page lists all Required Features and Plug-ins that must be present in the product before the feature can be installed. If any of these pre-requisites are missing, the feature will not be installed.

So obviously this is not "without any permanent effect" it is a strict requirement and thus Tycho includes it when calculating strict requirements.

@LorenzoBettini
Copy link
Contributor

@laeubi Here's a simple example

  • mybundle
  • myfeature

where myfeature looks like this

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="myfeature"
      label="Myfeature"
      version="1.0.0.qualifier">

   <includes
         id="org.eclipse.help"
         version="0.0.0"/>

   <requires>
      <import plugin="com.google.inject"/>
      <import feature="org.eclipse.jdt" version="3.18.1200.v20220607-0700"/>
   </requires>

   <plugin
         id="mybundle"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="com.google.guava"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>

So, it INCLUDES the bundle "guava" and the feature "eclipse help", while it REQUIRES the bundle "google inject (guice)" and feature "JDT".

Now, from Eclipse, run "Export deployable feature to create the corresponding P2 site" and that's the layout

site2
├── artifacts.jar
├── content.jar
├── features
│   ├── myfeature_1.0.0.202208231136.jar
│   └── org.eclipse.help_2.3.1000.v20220607-0700.jar
├── logs.zip
└── plugins
    ├── com.google.guava_30.1.0.v20210127-2300.jar
    ├── com.sun.el_2.2.0.v201303151357.jar
    ├── jakarta.servlet-api_4.0.0.jar
    ├── javax.el_2.2.0.v201303151357.jar
    ├── javax.servlet.jsp_2.2.0.v201112011158.jar
    ├── mybundle_1.0.0.202208231136.jar
    ├── org.apache.commons.logging_1.2.0.v20180409-1502.jar
    ├── org.apache.jasper.glassfish_2.2.2.v201501141630.jar
    ├── org.apache.lucene.analyzers-common_8.4.1.v20200122-1459.jar
    ├── org.apache.lucene.analyzers-smartcn_8.4.1.v20200122-1459.jar
    ├── org.apache.lucene.core_8.4.1.v20200122-1459.jar
    ├── org.eclipse.core.net_1.3.1200.v20220312-1450.jar
    ├── org.eclipse.equinox.http.jetty_3.8.100.v20211021-1418.jar
    ├── org.eclipse.equinox.http.registry_1.3.100.v20211021-1418.jar
    ├── org.eclipse.equinox.http.servlet_1.7.200.v20211021-1418.jar
    ├── org.eclipse.equinox.jsp.jasper_1.1.600.v20211021-1418.jar
    ├── org.eclipse.equinox.jsp.jasper.registry_1.2.100.v20211021-1418.jar
    ├── org.eclipse.equinox.security_1.3.900.v20220108-1321.jar
    ├── org.eclipse.help.base_4.3.700.v20220607-0700.jar
    ├── org.eclipse.help.ui_4.4.0.v20220411-0938.jar
    ├── org.eclipse.help.webapp_3.10.700.v20220510-1941.jar
    ├── org.eclipse.jetty.http_10.0.9.jar
    ├── org.eclipse.jetty.io_10.0.9.jar
    ├── org.eclipse.jetty.security_10.0.9.jar
    ├── org.eclipse.jetty.server_10.0.9.jar
    ├── org.eclipse.jetty.servlet_10.0.9.jar
    ├── org.eclipse.jetty.util_10.0.9.jar
    ├── org.eclipse.jetty.util.ajax_10.0.9.jar
    └── org.slf4j.api_1.7.30.v20200204-2150.jar

So you see that INCLUDED stuff is part of the P2 site (transitively), while REQUIRED stuff is not.
I seem to understand that the behavior we're criticizing here is the creation of the P2 site, which, as you see, is different from what PDE does (at the moment, I haven't searched for the documentation, but I'm sure that's how it always said to be the semantics of the p2 site creation).

@Kummallinen
Copy link
Contributor

Kummallinen commented Aug 23, 2022

So obviously this is not "without any permanent effect" it is a strict requirement and thus Tycho includes it when calculating strict requirements.

By that argument shouldn't Tycho always be including all non-optional plug-in & package dependencies? Which it actually only does if "includeAllRequirments" is set to true

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

By that argument shouldn't Tycho always be including all non-optional plug-in & package dependencies? Which it actually only does if "includeAllRequirments" is set to true

Please see explanation above. includeAllRequirments transitivly includes requirements even if they are not mentioned in the feature!

I seem to understand that the behavior we're criticizing here is the creation of the P2 site, which, as you see, is different from what PDE does

There are many thing Tycho do differently than PDE. And as you can see PDE includes much more than declared in the feature.xml here (what Tycho won't do). So this is something one could hardly compare. Also you are not building an update-site (category.xml) what PDE at the moment is not capable to export at all! So I think we can all be happy that Tycho is not doing 1:1 what PDE does ;-)

If you think your example is useful for Tycho as well provide an integration-test to demonstrate the use-case and we can see whats the outcome here.

@LorenzoBettini
Copy link
Contributor

The old behavior was not a bug but just correct and in line with common expectation!

Can you give any normative reference here please? I mean beside "we did it always like this" ....

@laeubi here's from the "Plug-in Development Environment Guide":

Update Site
...
When the site is built, the included features (along with all plug-ins part of those features) will be exported into an installable form. The exported plug-ins and features will be put into two folders "plug-ins" and "features". Two other files, "content.xml" and "artifacts.xml" will also be generated and contain metadata for the exported files that make installing easier. These files, along with "site.xml", collectively form an Eclipse update site. To make the update site available to others you must make all these files available in a shared directory or web site.

And that's consistent with the behavior I described above (and also implemented by Tycho before this change): only included stuff is part of the p2 site

@Kummallinen
Copy link
Contributor

Kummallinen commented Aug 23, 2022

By that argument shouldn't Tycho always be including all non-optional plug-in & package dependencies? Which it actually only does if "includeAllRequirments" is set to true

Please see explanation above. includeAllRequirments transitivly includes requirements even if they are not mentioned in the feature!

So feature requirements should be treated differently to plugin requirements? As if I add a plugin directly to a p2 repo, without using a feature, Tycho does not include all of its requiremments, unless includeAllRequirments is true.

I'm trying to understand the logic behind this change, as on the surface it appears inconsistent.

@estepper
Copy link

The old behavior was not a bug but just correct and in line with common expectation!

Can you give any normative reference here please? I mean beside "we did it always like this" ....

In feature.xml we can use two different elements, and , where the former installs an IU while the latter is more like a "require" without any permanent effect beyond the resolution operation. In p2 that would be greedy vs. non-greedy. Would anyone claim that there's no value in this difference?! So why are you making them behave the same?

Please take a look at the resulting P2 metadata, they are the same there is nothing like "more like" or "greedy", they are both represented exactly the same!

The only difference is, that if you give a "not a version" aka "0.0.0" the version for the first is resolved at build time, while the later is resolved at install time.

where the former installs an IU while the latter is more like a "require" without any permanent effect beyond the resolution operation

Please take a look at the help page (emphasis by me):

The Dependencies page lists all Required Features and Plug-ins that must be present in the product before the feature can be installed. If any of these pre-requisites are missing, the feature will not be installed.

So obviously this is not "without any permanent effect" it is a strict requirement and thus Tycho includes it when calculating strict requirements.

I'm not going to let you waste my time. Everything has been said, by others and myself. You keep arguing and arguing for something that nobody wants...

@sratz
Copy link
Contributor

sratz commented Aug 23, 2022

This change came as a huge surprise to us as well.

We meticulously take care of what features/plugins to <include> and what features to <require>, in order to control which parts we actually ship and which parts we expect to be already there during install time (or to be fetched from other update sites)!

Due to this change, this suddenly changes what we are shipping.

So this is a highly incompatible change for a bugfix release / micro increment of Tycho 2.7.x.

As others have explained, the differentiation between include and require is significant.

To summarize:

  • This is a functional change, not a bugfix
  • This is an incompatible change for a micro increment in a stable release version of Tycho 2.7.x. So it should be reverted for 2.7.x
  • I'm fine with this kind of breaking change in 3.x if there is a way to get the old behavior back via a setting.

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

These files, along with "site.xml", collectively form an Eclipse update site

site.xml is not supported for a long time by Tycho anymore and removed from Tycho 3.x onwards.

So feature requirements should be treated differently to plugin requirements? As if I add a plugin directly to a p2 repo, without using a feature, Tycho does not include all of its requiremments, unless includeAllRequirments is true.

All requirements will be added if you choose includeAllRequirments Tycho do not really "knows" about bundles / features here and thus delegates to P2 to do the actual stuff.

I'm not going to let you waste my time. Everything has been said, by others and myself. You keep arguing and arguing for something that nobody wants...

Me neither, feel free to use another tool that better suits what "everybody" wants, maybe PDE build?

Fact is:

  1. There is not a single integration test out of more than 200 that covers this "what everybody wants"
  2. It is more than four month since this is life at the snapshots and no one has noticed that
  3. It is nowhere claimed, nor documented that there is a distinction between "requirements" and actually Tycho has behaved inconsistent before because it actually will include content in the "other requirements" if you use a fixed version but not if you use an Any Version or a Version Range
  4. P2, that is used under the hood in Tycho, can't distinguish this and "the other" requirements.

So instead of complaining, if someone thinks there is a problem provide an integration-test to demonstrate the issue and then we can decide of a solution.

@sratz
Copy link
Contributor

sratz commented Aug 23, 2022

2. It is more than four month since this is life at the snapshots and no one has noticed that

We've only just upgrade from 2.7.3 to 2.7.4, because there were no issues that affected us in 2.7.3. We do not use 3.0.0 yet, because we cannot use SNAPSHOT builds in our corporate release build environment.

  • It is nowhere claimed, nor documented that there is a distinction between "requirements" and actually Tycho has behaved inconsistent before because it actually will include content in the "other requirements" if you use a fixed version but not if you use an Any Version or a Version Range
  • P2, that is used under the hood in Tycho, can't distinguish this and "the other" requirements.

Yes, in the end during installation it all boils down to P2 doing its thing.
However, Tycho is the means to produce a shipment artifact -- typically an update site. Therefore, it's absolutely necessary to be able to control what ends up in that artifact and what does not. And while P2 does not care whether a dependency originated from an <include> or a <requires>, this certainly makes a difference for those producing update sites.

So instead of complaining, if someone thinks there is a problem provide an integration-test to demonstrate the issue and then we can decide of a solution.

I can try to provide an example of a common scenario that depicts our shipments model.

@LorenzoBettini
Copy link
Contributor

@laeubi (disclaimer: it's not my intention to be offensive and direct in this comment; if I sound so, it's only due to the fact I'm not a native speaker)

Fact is:

  1. There is not a single integration test out of more than 200 that covers this "what everybody wants"

I think the integration test you wrote for fixing #898 should be enough to verify this: the com.google.guava should NOT end up in the generated p2 site.

  1. It is more than four month since this is life at the snapshots and no one has noticed that

What I verify in my build is that the generated p2 site can be successfully used to install my features, by relying on repository reference. I don't check that the requirements are not going to end in the p2 repository because I'm relying on the correct behavior that had been implemented up to now

  1. It is nowhere claimed, nor documented that there is a distinction between "requirements" and actually Tycho has behaved inconsistent before because it actually will include content in the "other requirements" if you use a fixed version but not if you use an Any Version or a Version Range

Yes, there is: you asked for documentation and I quoted the documentation in comment #1281 (comment)

If Tycho does more than PDE (e.g., category) we're all happy and thankful, but in this case, Tycho is doing something completely different than the documented behavior; and you see how many situations have been broken...

  1. P2, that is used under the hood in Tycho, can't distinguish this and "the other" requirements.

I think here you're talking about metadata? But for the p2 site things are different.

So instead of complaining, if someone thinks there is a problem provide an integration-test to demonstrate the issue and then we can decide of a solution.

As I said above, I guess the integration test project is already in place. It should be enough to verify that imported bundles (well, yes, also features, but I guess verifying that for bundles should be enough) are not going into the p2 site. It's true that I could write the Java code for this verification, but it would take me a lot of time to set up the environment (I contributed to Tycho in the past, but I don't have the workspace in my compute anymore) and try to understand the API for performing such a verification. Doing that for a committer should take a few minutes since I guess you already know where to put your hands on.

@jonahgraham
Copy link
Contributor

It should be enough to verify that imported bundles

I am unsure that is enough - Using 2.7.4 for EPP pulls in seemingly every feature (187 of them, should be 12) but only a handful of extra bundles (seemingly the only extras are the platform dependent fragments?)

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

I think the integration test you wrote for fixing #898 should be enough to verify this: the com.google.guava should NOT end up in the generated p2 site.

Actually it should be included as per bug description, as explained above, whether or not it was included depend on the version attribute what is not what is desired that it only works "sometimes".

What I verify in my build is that the generated p2 site can be successfully used to install my features, by relying on repository reference.

So I assume this still works as expected.

I think here you're talking about metadata? But for the p2 site things are different.

No that is the misunderstanding here, Tycho is not build some "Update Site", as Update Site is some old way how it was packed.
Tycho assembles a Repository (!) and this is completely driven by P2.

So what is changed now is that Tycho generates correct P2 metadata and P2 assembles a more correct update-site ...

So if one want to exclude certain content for whatever reason (e.g. all content already contained in another update-site) then this should be supported a the Assemble mojo and not at the P2-Meta data generation.

For example as described by @LorenzoBettini if I don't want dependent features but only those listed in the site then one might have such an option there. But I don't see to have an useInconsistentP2Metadata option ...

@cdietrich
Copy link
Contributor

i still have no clue how to do with the new way: when i want feature a to be installed i also want to have feature b installed. i dont want to repackage b cause it is a separate eclipse project.

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

i still have no clue how to do with the new way: when i want feature a to be installed i also want to have feature b installed. i dont want to repackage b cause it is a separate eclipse project.

That's why I said we should add an integration test for that use case, because at the moment there is only an integration test that uses a bundle requirement but we (sadly) have none that has a feature requirement. So maybe a feature requirement leads to (undesired) effect that the feature is included and then the requirements of the feature that requires other feature and so on ... but that's hard to tell without having an example for exactly this.

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

I think it's questionable to talk about 'right' versus 'wrong', and 'consistent' versus 'inconsistent' while at the same time arguing that there is no normative definition of the behavior. There is no right or wrong without a definition, there are just opinions about to the long-standing behavior of the last 5 years versus the new behavior you introduced (and I'm not sure anyone actually wants). I wonder, for example, if that new behavior is driven by a concrete use case. E.g., I wonder if there was some update site with specific content you could not achieve without this new behavior; I'm doubtful. It's certainly the case now that some of us can no longer produce the update site with restricted content that we want, with the specific metadata we want, with the new behavior where required implies inclusion in the site. Note too that having you call the update site with the exact content we want and the exact metadata we want, and always got before now, 'inconsistent' because it's not p2-complete is kind of misguided at best if not downright insulting at worst.

Arguably to include all requirements of all features mentioned in the category.xml but not doing so for all bundles mentioned in the category.xml is also inconsistent behavior, but in the end 'consistency' of a site is just not a meaningful concept. Complete versus incomplete is simply not the same as consistent versus inconsistent. Hopefully people don't have to explain that repeatedly; it has been explained several times now.

Stop and think for a just moment the real semantic/behavior difference between an include versus an import. An include specifies a specific exact version, not a range, and the resulting p2 requirement can only be satisfied by one specific artifact version, often one being built in the current build. If that version of that artifact is not in the assembled into p2 update site, some other very specific update site with exactly that version will need to be composed, available, or referenced when p2 installs from the site. But that's not true when a version range is specified. In that case there are an unbounded number of different artifacts that will produce a consistent installation.

When I build an update site for EMF's generator, which produces Java files, it doesn't make much sense to install that feature if JDT's feature is not also installed. But that doesn't mean I want one specific version of JDT in my update site when all versions Helios through today will work nicely. I simply don't want any version of JDT in my update site. I just want JDT installed when the generator is installed, hence the requirement. But it's no longer possible to specify this range-based requirement without forcing a specific version to be composed into my update site.

Note that this the third repetition of this explanation. It's also fully fleshed out here with a feature.xml:

#1281 (comment)

cdietrich added a commit to cdietrich/tycho that referenced this issue Aug 23, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
cdietrich added a commit to cdietrich/tycho that referenced this issue Aug 23, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
@cdietrich
Copy link
Contributor

ok i guess the reproducer is showing the problem now

@LorenzoBettini
Copy link
Contributor

@cdietrich But the imported (requirement) bundle should not be there either, while in your test you make sure it's there... see the layout produced by Eclipse (which is also what Tycho used to generate) in #1281 (comment)

@merks
Copy link
Contributor Author

merks commented Aug 23, 2022

what do you mean by the way? From Eclipse I can generate a p2 repository with a category.xml

I can't find the thread, but a while back in PDE it was discussed to remove the site.xml (and the corresponding wizard) because it was deprecated a long time (mostly because it requires more traffic as far as I remember) and category.xml seems a replacement (and Tycho from 3.x on will only support category.xml) but ti was argued that one can't easily export category.xml as a site but site.xml has ...

I recall that thread too! I think this is the one:

eclipse-pde/eclipse.pde#113 (comment)

@cdietrich
Copy link
Contributor

Yes I just looked at the featurerequirement
In the old tycho versions guava would also be an assert false

@laeubi
Copy link
Member

laeubi commented Aug 23, 2022

@cdietrich thanks a lot for providing the test-case, as mentioned in the PR we should slightly adjust it to cover the different cases but beside that I think its fine!

@Kummallinen
Copy link
Contributor

I've tested our cases and confirmed the repo content with the latest 3.0.0 snapshot is the same as with Tycho 2.7.1.

Thanks for the fix

@cdietrich
Copy link
Contributor

can confirm the Xtext build behaves as expected again too. thx for fixing @laeubi

cdietrich added a commit to cdietrich/tycho that referenced this issue Aug 25, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
cdietrich added a commit to cdietrich/tycho that referenced this issue Aug 25, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
@LorenzoBettini
Copy link
Contributor

Thanks @laeubi ! Will it be ported to 2.7.5?

@laeubi
Copy link
Member

laeubi commented Aug 25, 2022

Thanks @laeubi ! Will it be ported to 2.7.5?

It was reverted for 2.7.5-SNAPSHOT, build is running here: https://ci.eclipse.org/tycho/job/tycho-github/job/tycho-2.7.x/56/

cdietrich added a commit to cdietrich/tycho that referenced this issue Aug 25, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
laeubi pushed a commit that referenced this issue Aug 26, 2022
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
@sratz
Copy link
Contributor

sratz commented Aug 29, 2022

Thanks for the revert for Tycho 2.7.x code line!

I have tried to summarize the whole problem in eclipse-equinox/p2#138 (comment)

@LorenzoBettini
Copy link
Contributor

It was reverted for 2.7.5-SNAPSHOT, build is running here: https://ci.eclipse.org/tycho/job/tycho-github/job/tycho-2.7.x/56/

@laeubi do you plan to release 2.7.5?
thanks in advance

@laeubi
Copy link
Member

laeubi commented Sep 1, 2022

There is no real "plan", so if some people test the snapshot and there is no more things to fix/back port we can start the process any time.

@LorenzoBettini
Copy link
Contributor

@laeubi I tested the 2.7.5-SNAPSHOT and for it me it works fine

pcdavid added a commit to pcdavid/org.eclipse.sirius that referenced this issue Sep 3, 2022
See eclipse-tycho/tycho#1281

Change-Id: I5d63a10cdcf757970332041582973c2ddc29ad28
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
@laeubi laeubi added this to the 3.0 milestone Sep 21, 2022
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

Successfully merging a pull request may close this issue.

9 participants