From 04c5719438b7dd6f25d990be2a95b61b12571acc 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. --- ...ExecutionEnvironmentConfigurationImpl.java | 2 +- .../core/osgitools/OsgiBundleProject.java | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java index 4610e10d11..22bb14193f 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java @@ -176,7 +176,7 @@ public Collection getAllKnownEEs() { @Override public boolean ignoreExecutionEnvironment() { - return NoExecutionEnvironment.NAME.equals(getProfileName()); + return NoExecutionEnvironment.NAME.equals(effectiveProfileName); } } 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..6a77fcd4a6 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.ignoreExecutionEnvironment()) { + 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); }