Skip to content

Commit

Permalink
Consider Require-Capability when validating BREE
Browse files Browse the repository at this point in the history
Presence of osgi.ee capability ‘Require-Capability’ should mitigate
absence of BREE headers in the manifest. The current parser has no
awareness of Require-Capability header. In future the parser should
consider this header too while evaluating BREE header.
Fixes: eclipse-pde#140
  • Loading branch information
alshamams authored and laeubi committed Jan 27, 2024
1 parent b078db2 commit a5734c6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ private void validateRequiredExecutionEnvironment() {
IPath currentPath = entry.getPath();
if (JavaRuntime.newDefaultJREContainerPath().matchingFirstSegments(currentPath) > 0) {
String eeId = JavaRuntime.getExecutionEnvironmentId(currentPath);
if (eeId != null) {
IHeader header = getHeader(Constants.REQUIRE_CAPABILITY);
if (eeId != null && header == null) {
VirtualMarker marker = report(PDECoreMessages.BundleErrorReporter_noExecutionEnvironmentSet, 1, sev, PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET, PDEMarkerFactory.CAT_EE);
addMarkerAttribute(marker, "ee_id", eeId); //$NON-NLS-1$
addMarkerAttribute(marker,PDEMarkerFactory.compilerKey, CompilerFlags.P_INCOMPATIBLE_ENV);
Expand Down Expand Up @@ -615,7 +616,8 @@ private void validateRequiredExecutionEnvironment() {
if (vm != null) {
for (IExecutionEnvironment systemEnv : systemEnvs) {
// Get strictly compatible EE for the default VM
if (systemEnv.isStrictlyCompatible(vm)) {
IHeader header = getHeader(Constants.REQUIRE_CAPABILITY);
if (systemEnv.isStrictlyCompatible(vm) && header == null) {
VirtualMarker marker = report(PDECoreMessages.BundleErrorReporter_noExecutionEnvironmentSet, 1, sev, PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET, PDEMarkerFactory.CAT_EE);
addMarkerAttribute(marker, "ee_id", systemEnv.getId()); //$NON-NLS-1$
addMarkerAttribute(marker,PDEMarkerFactory.compilerKey, CompilerFlags.P_INCOMPATIBLE_ENV);
Expand Down

0 comments on commit a5734c6

Please sign in to comment.