Skip to content

Commit

Permalink
[bp] Only apply a better profile if allowed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
laeubi committed Dec 29, 2024
1 parent c0cc921 commit adc055e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
37 changes: 37 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@
This page describes the noteworthy improvements provided by each release of Eclipse Tycho.

## 4.0.11

**Important Notice:** There was a bug in previous versions of Tycho that has lead to the situation that projects are resolved
with a higher bundle required java version even though this was not explicitly allowed. This could also lead to the case that even though
tests should run with a lower java version as the build, actually the build jvm defined the minimum runtime.

This is now fixed, but might result in build previously working now fail due to the constraints not properly checked before, to fix those builds you have the following opportunities:

1. Update the required execution environment (BREE) of your bundle to those of the dependencies (**recommended**)
2. If you still want to target older BREE for example because you support older versions of the dependencies, you can set the BREE in your target configuration or target platform file to express the *latest runtime requirements* you are targeting.

```
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<executionEnvironment>JavaSE-17</executionEnvironment>
</configuration>
</plugin>
```

3. As an alternative you can disable execution environment checks all together (**not recommended**)

```
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolveWithExecutionEnvironmentConstraints>false</resolveWithExecutionEnvironmentConstraints>
</configuration>
</plugin>
```

**Please note:** This all does not influence the compile-target, that is always derived from the BREE regardless of resolution if not otherwise configured.


backports:
- Support for implicit dependencies in target definitions

Expand Down
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 @@ -599,18 +599,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

0 comments on commit adc055e

Please sign in to comment.