Skip to content

Commit

Permalink
UpdateSitePublisher -addJREIU argument doesn't add current JVM
Browse files Browse the repository at this point in the history
Don't hard code "default" JRE version if we "guess one" and create some
profile based on current JRE packages. Just read & use the version from
the running JRE.

Fixes #461
  • Loading branch information
iloveeclipse committed Feb 12, 2024
1 parent 4327aa9 commit ba4bbf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
import org.osgi.framework.*;

public class JREAction extends AbstractPublisherAction {

private static final int RUNTIME_VERSION = Runtime.version().feature();

private static final String DEFAULT_JRE_NAME = "a.jre"; //$NON-NLS-1$
private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("17.0"); //$NON-NLS-1$
private static final String DEFAULT_PROFILE = "JavaSE-17"; //$NON-NLS-1$
private static final Version DEFAULT_JRE_VERSION = Version.parseVersion(RUNTIME_VERSION + ".0"); //$NON-NLS-1$
private static final String DEFAULT_PROFILE = "JavaSE-" + RUNTIME_VERSION; //$NON-NLS-1$
private static final String PROFILE_LOCATION = "jre.action.profile.location"; //$NON-NLS-1$
private static final String PROFILE_NAME = "osgi.java.profile.name"; //$NON-NLS-1$
private static final String PROFILE_TARGET_VERSION = "org.eclipse.jdt.core.compiler.codegen.targetPlatform"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipInputStream;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
Expand Down Expand Up @@ -146,9 +145,9 @@ public void testPackageVersionsFromJavaProfile() throws Exception {
@Test
public void testDefaultJavaProfile() throws Exception {
performAction(new JREAction((String) null));

int runtimeVersion = Runtime.version().feature();
// these assertions need to be changed each time the default java profile, hardcoded in o.e.e.p2.publisher.actions.JREAction, is changed;
verifyMetadataIU("a.jre.javase", 226, 23, Version.parseVersion("17.0.0"));
verifyMetadataIU("a.jre.javase", 226, 23, Version.parseVersion(runtimeVersion + ".0.0"));
// verifyConfigIU(DEFAULT_JRE_NAME, DEFAULT_JRE_VERSION); // TODO config IU is not needed!?
}

Expand Down

0 comments on commit ba4bbf3

Please sign in to comment.