From 2b7093054dbe6261432b04176c27531360834585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sun, 22 Dec 2024 07:08:33 +0100 Subject: [PATCH] Only apply a better profile if allowed Currently a configured profile is unconditionally replaced by a better one of the current JVM, but this is wrong if not explicitly allowed by the configuration. This is now changed, to be only used if ignoring the BREE is actually enabled. --- .../core/osgitools/OsgiBundleProject.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java index 25658ea171..3c92aa3caf 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java @@ -560,16 +560,20 @@ private void applyBestOfCurrentOrConfiguredProfile(String configuredProfileName, MavenSession mavenSession, ExecutionEnvironmentConfiguration sink) { StandardExecutionEnvironment configuredProfile = ExecutionEnvironmentUtils .getExecutionEnvironment(configuredProfileName, toolchainManager, mavenSession, logger); - if (configuredProfile != null) { - // non standard profile, stick to it - sink.setProfileConfiguration(configuredProfileName, reason); + if (configuredProfile == null) { + //should never be the case as Tycho delegates to other profiles, but if we need to stick to the defaults... + return; } - StandardExecutionEnvironment currentProfile = ExecutionEnvironmentUtils.getExecutionEnvironment( - "JavaSE-" + Runtime.version().feature(), toolchainManager, mavenSession, logger); - if (currentProfile.compareTo(configuredProfile) > 0) { - sink.setProfileConfiguration(currentProfile.getProfileName(), - "Currently running profile, newer than configured profile (" + configuredProfileName + ") from [" - + reason + "]"); + if (sink.isIgnoredByResolver()) { + StandardExecutionEnvironment currentProfile = ExecutionEnvironmentUtils.getExecutionEnvironment( + "JavaSE-" + Runtime.version().feature(), toolchainManager, mavenSession, logger); + if (currentProfile != null && currentProfile.compareTo(configuredProfile) > 0) { + sink.setProfileConfiguration(currentProfile.getProfileName(), + "Currently running profile, newer than configured profile (" + configuredProfileName + + ") from [" + reason + "]"); + } else { + sink.setProfileConfiguration(configuredProfileName, reason); + } } else { sink.setProfileConfiguration(configuredProfileName, reason); }