Skip to content

Commit

Permalink
[Releng] Support Java 16 with its changes to the --illegal-access
Browse files Browse the repository at this point in the history
Use Java 16.0.1 for the installer itself.

Support better merging of p2 tasks in the case that the p2 task is
restricted to bootstrap only.
  • Loading branch information
merks committed Jun 1, 2021
1 parent f331965 commit 1f290be
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 35 deletions.
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.tests-feature/feature.xml
Expand Up @@ -12,7 +12,7 @@
<feature
id="org.eclipse.oomph.tests"
label="%featureName"
version="1.16.0.qualifier"
version="1.17.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.oomph.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.tests-feature/pom.xml
Expand Up @@ -22,7 +22,7 @@ Eike Stepper - initial API and implementation

<groupId>org.eclipse.oomph.features</groupId>
<artifactId>org.eclipse.oomph.tests</artifactId>
<version>1.16.0-SNAPSHOT</version>
<version>1.17.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

</project>
4 changes: 2 additions & 2 deletions plugins/org.eclipse.oomph.setup.core/META-INF/MANIFEST.MF
Expand Up @@ -33,8 +33,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)",
org.eclipse.oomph.base.edit;bundle-version="[1.13.0,2.0.0)",
org.eclipse.oomph.p2.core;bundle-version="[1.18.0,2.0.0)",
org.eclipse.oomph.setup;bundle-version="[1.19.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup.p2;bundle-version="[1.16.0,2.0.0)",
org.eclipse.oomph.setup;bundle-version="[1.20.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup.p2;bundle-version="[1.17.0,2.0.0)",
org.eclipse.oomph.preferences;bundle-version="[1.12.0,2.0.0)",
org.eclipse.core.net;bundle-version="[1.2.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Expand Down
Expand Up @@ -4035,6 +4035,24 @@ private Map<SetupTask, SetupTask> getSubstitutions(EList<SetupTask> setupTasks)
for (SetupTask setupTask : setupTasks)
{
Object overrideToken = setupTask.getOverrideToken();
Trigger trigger = getTrigger();
if (trigger != null && overrideToken instanceof ArrayList<?>)
{
// This is primarily for p2 tasks where excluded triggers result in poor merging behavior.
// E.g., the p2 task for installing a JRE is set to trigger only for bootstrap.
// But this merges with the product's p2 task such that the merged result is only triggered for bootstrap.
// The following filtering based on the non-null trigger ensures the p2 tasks merge in the final performer creation, but not before.
ArrayList<?> list = (ArrayList<?>)overrideToken;
for (Iterator<?> it = list.iterator(); it.hasNext();)
{
Object item = it.next();
if (item instanceof Trigger && item != trigger)
{
it.remove();
}
}
}

SetupTask overriddenTask = overrides.put(overrideToken, setupTask);
if (overriddenTask != null)
{
Expand Down
12 changes: 6 additions & 6 deletions plugins/org.eclipse.oomph.setup.installer/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.setup.installer;singleton:=true
Bundle-Version: 1.20.0.qualifier
Bundle-Version: 1.21.0.qualifier
Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Expand All @@ -10,7 +10,7 @@ Bundle-Activator: org.eclipse.oomph.setup.internal.installer.SetupInstallerPlugi
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.10.0,3.0.0)",
org.eclipse.emf.edit.ui;bundle-version="[2.10.0,3.0.0)",
org.eclipse.oomph.setup;bundle-version="[1.19.0,2.0.0)",
org.eclipse.oomph.setup;bundle-version="[1.20.0,2.0.0)",
org.eclipse.oomph.setup.edit;bundle-version="[1.15.0,2.0.0)",
org.eclipse.oomph.setup.ui;bundle-version="[1.20.0,2.0.0)",
org.eclipse.equinox.p2.operations;bundle-version="[2.0.0,3.0.0)",
Expand All @@ -24,9 +24,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.p2.engine;bundle-version="[2.2.0,3.0.0)",
org.eclipse.urischeme;bundle-version="[1.0.0,2.0.0)",
org.eclipse.oomph.ui;bundle-version="[1.15.0,2.0.0)",
org.eclipse.oomph.p2.ui;bundle-version="[1.15.0,2.0.0)",
org.eclipse.oomph.setup.p2;bundle-version="[1.16.0,2.0.0)",
org.eclipse.oomph.setup.core;bundle-version="[1.19.0,2.0.0)",
org.eclipse.oomph.p2.ui;bundle-version="[1.16.0,2.0.0)",
org.eclipse.oomph.setup.p2;bundle-version="[1.17.0,2.0.0)",
org.eclipse.oomph.setup.core;bundle-version="[1.20.0,2.0.0)",
org.eclipse.oomph.jreinfo.ui;bundle-version="[1.12.0,2.0.0)",
org.eclipse.help;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.net;bundle-version="[1.0.0,2.0.0)",
Expand All @@ -35,5 +35,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.security.ui;bundle-version="[1.1.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.oomph.setup.internal.installer;version="1.20.0";x-internal:=true
Export-Package: org.eclipse.oomph.setup.internal.installer;version="1.21.0";x-internal:=true
Automatic-Module-Name: org.eclipse.oomph.setup.installer
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.setup.installer/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.setup.installer</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -16,20 +16,25 @@
import org.eclipse.oomph.jreinfo.JREFilter;
import org.eclipse.oomph.jreinfo.ui.JREController;
import org.eclipse.oomph.setup.AnnotationConstants;
import org.eclipse.oomph.setup.CompoundTask;
import org.eclipse.oomph.setup.Installation;
import org.eclipse.oomph.setup.SetupFactory;
import org.eclipse.oomph.setup.SetupTask;
import org.eclipse.oomph.setup.Trigger;
import org.eclipse.oomph.setup.internal.core.SetupContext;
import org.eclipse.oomph.util.Request.Handler;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;

import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Label;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;

/**
* This augments the JRE controller to provide choices of JREs installed from a p2 update site.
Expand All @@ -38,6 +43,8 @@
*/
public class AugmentedJREController extends JREController
{
private static Set<Trigger> BOOSTRAP_ONLY_TRIGGER = new LinkedHashSet<Trigger>(Arrays.asList(new Trigger[] { Trigger.STARTUP, Trigger.MANUAL }));

public AugmentedJREController(Label label, StructuredViewer viewer, Handler downloadHandler)
{
super(label, viewer, downloadHandler);
Expand All @@ -56,6 +63,8 @@ protected JREFilter createJREFilter()
protected void updateSetupContext(SetupContext setupContext, JRE jre)
{
Installation installation = setupContext.getInstallation();

// Remove any JRE-related task that may have been added earlier perhaps for a different JRE.
EList<SetupTask> setupTasks = installation.getSetupTasks();
for (SetupTask setupTask : setupTasks)
{
Expand All @@ -71,12 +80,34 @@ protected void updateSetupContext(SetupContext setupContext, JRE jre)
JRE.Descriptor jreDescriptor = jre.getDescriptor();
if (jreDescriptor != null)
{
CompoundTask compoundTask = SetupFactory.eINSTANCE.createCompoundTask();
compoundTask.setName(jreDescriptor.getLabel());
EList<SetupTask> additionalSetupTasks = compoundTask.getSetupTasks();

// Mark it so it can be removed above.
Annotation annotation = BaseFactory.eINSTANCE.createAnnotation(AnnotationConstants.ANNOTATION_JRE);
compoundTask.getAnnotations().add(annotation);

SetupTask setupTask = (SetupTask)jreDescriptor.getData();
SetupTask setupTaskCopy = EcoreUtil.copy(setupTask);
Annotation annotation = BaseFactory.eINSTANCE.createAnnotation(AnnotationConstants.ANNOTATION_JRE);
setupTaskCopy.getAnnotations().add(annotation);
setupTaskCopy.setExcludedTriggers(new LinkedHashSet<Trigger>(Arrays.asList(new Trigger[] { Trigger.STARTUP, Trigger.MANUAL })));
setupTasks.add(0, setupTaskCopy);
setupTaskCopy.setExcludedTriggers(BOOSTRAP_ONLY_TRIGGER);
Annotation jreSpecificTasks = setupTaskCopy.getAnnotation(AnnotationConstants.ANNOTATION_JRE_SPECIFIC_TASKS);
if (jreSpecificTasks != null)
{
setupTaskCopy.getAnnotations().remove(jreSpecificTasks);
for (EObject eObject : new ArrayList<EObject>(jreSpecificTasks.getContents()))
{
if (eObject instanceof SetupTask)
{
SetupTask additionalTask = (SetupTask)eObject;
additionalTask.setExcludedTriggers(BOOSTRAP_ONLY_TRIGGER);
additionalSetupTasks.add(additionalTask);
}
}
}

additionalSetupTasks.add(0, setupTaskCopy);
setupTasks.add(0, compoundTask);
}
}
}
Expand Down
Expand Up @@ -2166,6 +2166,18 @@ private Macro getJREs() throws ProvisionException, URISyntaxException
p2Task.setLabel("JRE " + jreVersion);
String description = iu.getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
p2Task.setDescription(description);

if (osgiVersion.getMajor() >= 16)
{
Annotation jreSpecifTasks = BaseFactory.eINSTANCE.createAnnotation(AnnotationConstants.ANNOTATION_JRE_SPECIFIC_TASKS);
EclipseIniTask illegalAccessTask = SetupFactory.eINSTANCE.createEclipseIniTask();
illegalAccessTask.setOption("--illegal-access");
illegalAccessTask.setValue("=permit");
illegalAccessTask.setVm(true);
jreSpecifTasks.getContents().add(illegalAccessTask);
p2Task.getAnnotations().add(jreSpecifTasks);
}

jreMacro.getSetupTasks().add(p2Task);
}

Expand Down
14 changes: 7 additions & 7 deletions plugins/org.eclipse.oomph.setup.p2/META-INF/MANIFEST.MF
Expand Up @@ -2,20 +2,20 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.oomph.setup.p2;singleton:=true
Bundle-Version: 1.16.0.qualifier
Bundle-Version: 1.17.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.oomph.setup.internal.p2.SetupP2Plugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.oomph.setup.internal.p2;version="1.16.0";x-internal:=true,
org.eclipse.oomph.setup.p2;version="1.16.0";x-internal:=true,
org.eclipse.oomph.setup.p2.impl;version="1.16.0";x-internal:=true,
org.eclipse.oomph.setup.p2.util;version="1.16.0";x-internal:=true
Export-Package: org.eclipse.oomph.setup.internal.p2;version="1.17.0";x-internal:=true,
org.eclipse.oomph.setup.p2;version="1.17.0";x-internal:=true,
org.eclipse.oomph.setup.p2.impl;version="1.17.0";x-internal:=true,
org.eclipse.oomph.setup.p2.util;version="1.17.0";x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.oomph.p2.core;bundle-version="[1.17.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup;bundle-version="[1.18.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.p2.core;bundle-version="[1.18.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup;bundle-version="[1.20.0,2.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.artifact.repository;bundle-version="[1.0.0,2.0.0)",
org.eclipse.equinox.p2.console;bundle-version="[1.0.0,2.0.0)",
org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)",
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.setup.p2/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.setup.p2</artifactId>
<version>1.16.0-SNAPSHOT</version>
<version>1.17.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -551,7 +551,12 @@ public Object getOverrideToken()
return super.getOverrideToken();
}

return getClass();
// This ensures that he p2 tasks with different excluded triggers don't merge early.
// In SetupTaskPerformer.getSubstitutions(EList<SetupTask>), this list is modified to ensure that merging happens later.
List<Object> token = new ArrayList<Object>();
token.add(getClass());
token.addAll(getTriggers());
return token;
}

@Override
Expand Down
12 changes: 6 additions & 6 deletions plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.setup;singleton:=true
Bundle-Version: 1.19.0.qualifier
Bundle-Version: 1.20.0.qualifier
Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Expand All @@ -16,10 +16,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.10.0,3.0.0)";visibility:=reexport
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.oomph.internal.setup;version="1.19.0";x-internal:=true,
org.eclipse.oomph.setup;version="1.19.0";x-internal:=true,
org.eclipse.oomph.setup.impl;version="1.19.0";x-internal:=true,
org.eclipse.oomph.setup.log;version="1.19.0";x-internal:=true,
org.eclipse.oomph.setup.util;version="1.19.0";x-internal:=true
Export-Package: org.eclipse.oomph.internal.setup;version="1.20.0";x-internal:=true,
org.eclipse.oomph.setup;version="1.20.0";x-internal:=true,
org.eclipse.oomph.setup.impl;version="1.20.0";x-internal:=true,
org.eclipse.oomph.setup.log;version="1.20.0";x-internal:=true,
org.eclipse.oomph.setup.util;version="1.20.0";x-internal:=true
Bundle-Activator: org.eclipse.oomph.internal.setup.SetupPlugin$Implementation
Automatic-Module-Name: org.eclipse.oomph.setup
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.setup/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.setup</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -85,6 +85,8 @@ public final class AnnotationConstants

public static final String ANNOTATION_JRE = "http://www.eclipse.org/oomph/setup/JRE"; //$NON-NLS-1$

public static final String ANNOTATION_JRE_SPECIFIC_TASKS = "http://www.eclipse.org/oomph/setup/JRESpecificTasks"; //$NON-NLS-1$

private AnnotationConstants()
{
}
Expand Down
2 changes: 1 addition & 1 deletion releng/org.eclipse.oomph.parent/pom.xml
Expand Up @@ -147,7 +147,7 @@ Eike Stepper - initial API and implementation
<!-- This is needed for Tycho 2.0.0, but breaks 1.7.0 because the compiler source/target levels are not set properly.
<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.minimal-15</executionEnvironment>
-->
<executionEnvironmentDefault>org.eclipse.justj.openjdk.hotspot.jre.minimal-15</executionEnvironmentDefault>
<executionEnvironmentDefault>org.eclipse.justj.openjdk.hotspot.jre.minimal-16</executionEnvironmentDefault>
<includePackedArtifacts>true</includePackedArtifacts>
<environments>
<environment>
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="Generated from Oomph" sequenceNumber="72">
<target name="Generated from Oomph" sequenceNumber="73">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="javaewah" version="0.0.0"/>
Expand Down Expand Up @@ -32,7 +32,7 @@
<repository location="http://download.eclipse.org/nebula/snapshot"/>
<repository location="http://download.eclipse.org/technology/swtbot/snapshots"/>
<repository location="http://download.eclipse.org/webtools/repository/latest"/>
<repository location="http://download.eclipse.org/justj/jres/15/updates/release/15.0.2"/>
<repository location="http://download.eclipse.org/justj/jres/16/updates/release/16.0.1"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.20-I-builds"/>
</location>
</locations>
Expand Down
2 changes: 1 addition & 1 deletion setups/Oomph.setup
Expand Up @@ -518,7 +518,7 @@
<repository
url="http://download.eclipse.org/webtools/repository/latest"/>
<repository
url="http://download.eclipse.org/justj/jres/15/updates/release/15.0.2"/>
url="http://download.eclipse.org/justj/jres/16/updates/release/16.0.1"/>
</repositoryList>
<repositoryList
name="2021-03">
Expand Down

0 comments on commit 1f290be

Please sign in to comment.