Skip to content

Commit

Permalink
Use the actual VM system packages for Launch-Validation
Browse files Browse the repository at this point in the history
The list of packages in the <ee>-systempackages.profile file in
o.e.pde.api.tools is not suitable.

Fixes eclipse-pde#194
  • Loading branch information
HannesWell committed Jul 18, 2022
1 parent 420acde commit efe2772
Showing 1 changed file with 2 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,14 @@ protected Dictionary<String, String>[] getPlatformProperties() throws CoreExcept
Properties profileProps = getJavaProfileProperties(env.getId());
if (profileProps == null) {
// Java10 onwards, we take profile via this method
@SuppressWarnings("restriction")
IExecutionEnvironment ev = org.eclipse.jdt.internal.launching.environments.EnvironmentsManager.getDefault().getEnvironment(env.getId());
profileProps = ev.getProfileProperties();
profileProps = env.getProfileProperties();
}
if (profileProps != null) {
Dictionary<String, String> props = TargetPlatformHelper.getTargetEnvironment();
String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
if (systemPackages == null) {
// java 10 and beyond
Properties javaProfilePropertiesForVMPackage = getJavaProfilePropertiesForVMPackage(env.getId());
if (javaProfilePropertiesForVMPackage != null) {
systemPackages = javaProfilePropertiesForVMPackage.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
}
systemPackages = TargetPlatformHelper.querySystemPackages(env);
}
if (systemPackages != null)
props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
Expand All @@ -94,35 +89,6 @@ protected Dictionary<String, String>[] getPlatformProperties() throws CoreExcept

}

private static Properties getJavaProfilePropertiesForVMPackage(String ee) {
Bundle apitoolsBundle = Platform.getBundle("org.eclipse.pde.api.tools"); //$NON-NLS-1$
if (apitoolsBundle == null) {
return null;
}
URL systemPackageProfile = apitoolsBundle.getEntry("system_packages" + '/' + ee.replace('/', '_') + "-systempackages.profile"); //$NON-NLS-1$ //$NON-NLS-2$
if (systemPackageProfile != null) {
return getPropertiesFromURL(systemPackageProfile);

}
return null;
}

private static Properties getPropertiesFromURL(URL profileURL) {
try {
profileURL = FileLocator.resolve(profileURL);
URLConnection openConnection = profileURL.openConnection();
openConnection.setUseCaches(false);
try (InputStream is = openConnection.getInputStream()) {
Properties profile = new Properties();
profile.load(is);
return profile;
}
} catch (IOException e) {
PDELaunchingPlugin.log(e);
}
return null;
}

protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
IVMInstall install = VMHelper.getVMInstall(fLaunchConfiguration);
if (install == null)
Expand Down

0 comments on commit efe2772

Please sign in to comment.