Bug 487341 - multi-environment build fails using platform filters
Summary: multi-environment build fails using platform filters
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
: 546846 551705 (view as bug list)
Depends on: 551739
Blocks:
  Show dependency tree
 
Reported: 2016-02-05 08:13 EST by Dirk Fauth CLA
Modified: 2021-04-28 16:53 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Fauth CLA 2016-02-05 08:13:07 EST
I'm trying to setup a multi-environment build with pom-less Tycho.

I have a host plugin and two simple platform specific fragments. One for 

Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))

and one for

Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))

I configured the target-platform-configuration plugin for multi-environment build this way:

<environments>
  <environment>
    <os>win32</os>
    <ws>win32</ws>
    <arch>x86</arch>
  </environment>
  <environment>
    <os>win32</os>
    <ws>win32</ws>
    <arch>x86_64</arch>
  </environment>
</environments>

The host and the fragments are listed in the modules section.

Running the build I get errors like:

[INFO] Computing target platform for MavenProject: my.example:my.fragment.win32.win32.x86:1.0.0-SNAPSHOT @ D:\build\bundles\my.fragment.win32.win32.x86\.polyglot.build.properties
[INFO] Resolving dependencies of MavenProject: my.example:my.fragment.win32.win32.x86:1.0.0-SNAPSHOT @ D:\build\bundles\my.fragment.win32.win32.x86\.polyglot.build.properties
[INFO] Resolving class path of MavenProject: my.example:my.fragment.win32.win32.x86:1.0.0-SNAPSHOT @ D:\build\bundles\my.fragment.win32.win32.x86\.polyglot.build.properties
[INFO] Computing target platform for MavenProject: my.example:my.fragment.win32.win32.x86_64:1.0.0-SNAPSHOT @ D:\build\bundles\my.fragment.win32.win32.x86_64\.polyglot.build.properties
[INFO] Resolving dependencies of MavenProject: my.example:my.fragment.win32.win32.x86_64:1.0.0-SNAPSHOT @ D:\build\bundles\my.fragment.win32.win32.x86_64\.polyglot.build.properties
[INFO] {osgi.os=win32, org.eclipse.update.install.features=true, osgi.arch=x86, osgi.ws=win32}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Problems resolving provisioning plan.:
[ERROR]      my.fragment.win32.win32.x86_64 1.0.0.qualifier cannot be installed in this environment because its filter is not applicable.

As I can see .polyglot.build.properties I assume it is related to pom-less Tycho.

It seems to inspect every module for matches and fails if the platform filter doesn't match the current build environment. I would have expected that bundles that doesn't match are simply skipped so the build doesn't fail.
Comment 2 Dirk Fauth CLA 2016-02-09 04:26:12 EST
I can confirm that creating pom.xml files for the platform dependent fragments/plugins with the environment configuration added as showed in the linked stackoverflow question is working. Thanks for the hint.

But regarding pom-less Tycho I still think that this is a bug, or at least a missing feature. :)

The platform information is contained in the manifest via Eclipse-PlatformFilter manifest header. It is of course an Eclipse only manifest header, but shouldn't it be possible to evaluate the filter for automated environment resolution?

As it is a LDAP filter string, I assume it is not a trivial task to solve.
Comment 3 Jan Sievers CLA 2016-02-09 07:38:56 EST
(In reply to Dirk Fauth from comment #2)
> I can confirm that creating pom.xml files for the platform dependent
> fragments/plugins with the environment configuration added as showed in the
> linked stackoverflow question is working. Thanks for the hint.
> 
> But regarding pom-less Tycho I still think that this is a bug, or at least a
> missing feature. :)
> 
> The platform information is contained in the manifest via
> Eclipse-PlatformFilter manifest header. It is of course an Eclipse only
> manifest header, but shouldn't it be possible to evaluate the filter for
> automated environment resolution?
> 
> As it is a LDAP filter string, I assume it is not a trivial task to solve.

yes it would be nice to automatically set the target environment(s) to be the same as matched by Eclipse-PlatformFilter in MANIFEST.MF as this information is right now basically duplicated in pom.xml. Not sure how straightforward this would be though.
Comment 4 Christoph Laeubrich CLA 2019-10-02 11:42:18 EDT
*** Bug 551705 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Laeubrich CLA 2019-10-02 11:43:19 EDT
*** Bug 546846 has been marked as a duplicate of this bug. ***
Comment 6 Christoph Laeubrich CLA 2019-10-02 11:47:14 EDT
I think this is a tycho-core issue not a pomless issue since tycho-pomless does not knows anything about the target (and literally can't without massive configuration overhead).

Can someone share a small project that shows the issue?
Comment 7 Christoph Laeubrich CLA 2019-10-03 07:24:47 EDT
Stacktrace produced
org.apache.maven.MavenExecutionException: Cannot resolve dependencies of MavenProject: com.vogella.tycho:com.vogella.tycho.plugin2:1.0.0-SNAPSHOT @ /home/lablicate/git/vogella-tycho-example/bundles/com.vogella.tycho.plugin2/.polyglot..META-INF_MANIFEST.MF
	at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:100)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:266)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.tycho.artifacts.DependencyResolutionException: Cannot resolve dependencies of MavenProject: com.vogella.tycho:com.vogella.tycho.plugin2:1.0.0-SNAPSHOT @ /home/lablicate/git/vogella-tycho-example/bundles/com.vogella.tycho.plugin2/.polyglot..META-INF_MANIFEST.MF
	at org.eclipse.tycho.p2.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:201)
	at org.eclipse.tycho.p2.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:115)
	at org.eclipse.tycho.p2.resolver.P2DependencyResolver.doResolveDependencies(P2DependencyResolver.java:366)
	at org.eclipse.tycho.p2.resolver.P2DependencyResolver.resolveDependencies(P2DependencyResolver.java:334)
	at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject(DefaultTychoResolver.java:126)
	at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:95)
	... 14 more
Caused by: org.eclipse.tycho.p2.util.resolution.ResolverException: See log for details
	at org.eclipse.tycho.p2.util.resolution.AbstractSlicerResolutionStrategy.slice(AbstractSlicerResolutionStrategy.java:79)
	at org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:66)
	at org.eclipse.tycho.p2.util.resolution.AbstractResolutionStrategy.resolve(AbstractResolutionStrategy.java:42)
	at org.eclipse.tycho.p2.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:194)
	... 19 more
Caused by: java.lang.IllegalStateException: com.vogella.tycho.plugin2 1.0.0.qualifier cannot be installed in this environment because its filter is not applicable.
	at org.eclipse.equinox.internal.p2.director.Slicer.validateInput(Slicer.java:109)
	at org.eclipse.equinox.internal.p2.director.Slicer.slice(Slicer.java:60)
	at org.eclipse.tycho.p2.util.resolution.AbstractSlicerResolutionStrategy.slice(AbstractSlicerResolutionStrategy.java:76)
	... 22 more
Comment 8 Christoph Laeubrich CLA 2019-10-03 07:33:01 EDT
org.eclipse.tycho.p2.resolver.P2ResolverImpl.resolveDependencies(TargetPlatform, ReactorProject) iterates about all TargetEnvironments and tries to resolve them. This seems the right place to investigate for the Eclipse-PlatformFilter
Comment 9 Christoph Laeubrich CLA 2019-10-03 08:55:58 EDT
I have a possible fix for that but that is currently blocked by 551739
Comment 10 Eclipse Genie CLA 2019-10-03 09:25:00 EDT
New Gerrit change created: https://git.eclipse.org/r/150544
Comment 11 Christoph Laeubrich CLA 2019-10-03 09:26:33 EDT
With this change, a previously failing pomless build (even though you would have the same error without pomless) suceeds without a problem.
Comment 13 Mickael Istria CLA 2019-10-07 06:10:55 EDT
Thanks a lot Christoph.
Can you please add a note about it into https://wiki.eclipse.org/Tycho/Release_Notes/1.5#New_and_Noteworthy ?
Comment 14 Christoph Laeubrich CLA 2019-10-07 06:23:15 EDT
Done