tycho
tycho copied to clipboard
Filter target-environments not matching Eclipse-PlatformFilter
In a build with multi-environment target-platform-configuration Plug-ins that specify a Eclipse-PlatformFilter, which does not match all specified environments, fail to resolve their dependencies by default and therefore use a project-specific configuration that only lists the matching target environment.
One example is the org.eclipse.e4.ui.swt.win32 fragment, that has Eclipse-PlatformFilter: (osgi.ws=win32) header and has a own pom.xml that contains:
<build>
<plugins>
<!-- tycho is not able to automatically determine os/ws/arch of this bundle -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
https://github.com/eclipse-platform/eclipse.platform.ui/blob/e8af3fef3cb9a80cfe2cb9ebbd07ad417915faba/bundles/org.eclipse.e4.ui.swt.win32/pom.xml#L41
In the parent hierarchy there is the 'main' target-platform-configuration that specifies multiple other environments that not match the filter: https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/5a4fa712ba3ad67125130c8b91cb21447cae113d/eclipse-platform-parent/pom.xml#L242
Without the pom.xml displayed above the target-resolution is skipped for that plug-in:
[INFO] Resolving dependencies of MavenProject: eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT @ C:\dev\git\eclipse.platform.ui\bundles\org.eclipse.e4.ui.swt.win32\.polyglot.META-INF
[INFO] Project eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT does not match environment (& (osgi.os=linux) (osgi.ws=gtk) (osgi.arch=x86_64) ) skip dependency resolution
[INFO] Project eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT does not match environment (& (osgi.os=linux) (osgi.ws=gtk) (osgi.arch=ppc64le) ) skip dependency resolution
[INFO] Project eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT does not match environment (& (osgi.os=linux) (osgi.ws=gtk) (osgi.arch=aarch64) ) skip dependency resolution
[INFO] Project eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT does not match environment (& (osgi.os=macosx) (osgi.ws=cocoa) (osgi.arch=x86_64) ) skip dependency resolution
[INFO] Project eclipse.platform.ui:org.eclipse.e4.ui.swt.win32:1.1.0-SNAPSHOT does not match environment (& (osgi.os=macosx) (osgi.ws=cocoa) (osgi.arch=aarch64) ) skip dependency resolution
... and subsequently the compilation of the project's code fails.
I wonder if we could filter out or ignore not matching target-environments automatically so that one does not have to do that manually in a pom.xml? This would allow to remove some more pom files.
I wonder if we could filter out or ignore not matching target-environments automatically so that one does not have to do that manually in a pom.xml?
Well that's exactly what happening here... so I don't really understand what the issue is?
Without the pom.xml displayed above the target-resolution is skipped for that plug-in:
It is only skipped for no matching environments.
I wonder if we could filter out or ignore not matching target-environments automatically so that one does not have to do that manually in a pom.xml?
Well that's exactly what happening here... so I don't really understand what the issue is?
It is that one has to specify only matching environments in a project-specific pom.xml, for example like it is done in org.eclipse.e4.ui.swt.win32/pom.xml
Otherwise there are compilation failures. But I have not yet investigated why exactly. And therefore that pom file cannot be removed.
It is that one has to specify only matching environments in a project-specific pom.xml, for example like it is done in
This is not true in general as your log output shows, Tycho simply skip non matching environments if a Platform-Filter is given.
Otherwise there are compilation failures.
It might be that the plugin requires something special, I can see it enables this:
https://github.com/eclipse-platform/eclipse.platform.ui/blob/e8af3fef3cb9a80cfe2cb9ebbd07ad417915faba/bundles/org.eclipse.e4.ui.swt.win32/pom.xml#L38
but no idea if it makes a difference, at laest when it passes to compilation phase the resolving of the target has already passed and the log output shows that only gtk and cocoa are skipped. Neverless I have not checked if there is any integration test in Tycho covering this case in details.
Created https://github.com/eclipse-platform/eclipse.platform.ui/pull/499 that demonstrates the failure.
As mentioned here: https://github.com/eclipse-platform/eclipse.platform.ui/pull/499#issuecomment-1363663124 this is not due to the handling of platform specific items, if you only remove the <environments> section it should still compile!
As mentioned here: eclipse-platform/eclipse.platform.ui#499 (comment) this is not due to the handling of platform specific items, if you only remove the
<environments>section it should still compile!
That was it. So I think that can be closed. Thanks for your remarks.