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

Only apply a better profile if allowed #4553

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public void setFullSpecificationForCustomProfile(List<SystemCapability> systemCa

public boolean isIgnoredByResolver();

default boolean isResolveWithEEConstraints() {
return !isIgnoredByResolver();
}

/**
* @return all known Execution Environments accessible for the same scope
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,22 @@ 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 + "]");
} else {
if (sink.isResolveWithEEConstraints()) {
sink.setProfileConfiguration(configuredProfileName, reason);
} else {
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);
}
}
}

Expand Down
Loading