Skip to content

Commit

Permalink
Update dependencies and pom.xml to build against Eclipse 2022-12
Browse files Browse the repository at this point in the history
Notes:
- updgrade Tycho to 4.0.10
- remove exc environment header from management bundle (see readme)
- remove exc environment from newly created projects via wizard (same reason)
- copy HeaderMap from older version of PDE
- include in feature.xml zest bundles withe exact version
- update legacy bundle editor to reflect API changes in PDE
- update unit tests (resources and hamcrest dependency)

This time there is only a new target platform and no new launch configuration
as I built and tested via maven and finally made a test in
Eclipse for Web Developers using remote debug when needed
  • Loading branch information
giamma committed Dec 24, 2024
1 parent d3fd787 commit 9541969
Show file tree
Hide file tree
Showing 22 changed files with 1,183 additions and 162 deletions.
4 changes: 2 additions & 2 deletions .github/toolchains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<!-- <toolchain>
<toolchain>
<type>jdk</type>
<provides>
<id>JavaSE-21</id>
Expand All @@ -11,7 +11,7 @@
<configuration>
<jdkHome>${env.JAVA_HOME_21_X64}</jdkHome>
</configuration>
</toolchain> -->
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: |
8
11
17
21
distribution: 'temurin'
cache: 'maven'
# - name: Build with Maven
# run: xvfb-run mvn clean verify -Dtycho.localArtifacts=ignore
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9
- name: Build with Maven
env:
JAVA_HOME: ${{ env.JAVA_HOME_17_X64 }}
JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }}
run: |
cp .github/toolchains.xml ~/.m2/toolchains.xml
xvfb-run mvn clean verify
Expand All @@ -29,7 +34,7 @@ jobs:
# run: mvn -V -B verify
# - name: Run GUI Tests
# env:
# JAVA_HOME: ${{ env.JAVA_HOME_17_X64 }}
# JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }}
# uses: coactions/setup-xvfb@v1
# with:
# run: mvn --batch-mode verify
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.virgo.ide.bundlor.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.m2e.maven.runtime;bundle-version="1.0.0";resolution:=optional
Import-Package: org.apache.commons.lang;version="2.4.0",
org.apache.commons.logging
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.virgo.ide.bundlor.internal.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="target/classes" path="src1"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="com.springsource.server.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.springsource.bundlor
Bundle-Version: 1.0.0
Spring-Context: META-INF/spring/*.xml
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Template: org.springframework.*;version="[2.5.6.A,2.6.0)"
14 changes: 14 additions & 0 deletions org.eclipse.virgo.ide.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,18 @@
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.zest.core"
download-size="0"
install-size="0"
version="1.13.0.202409021815"
unpack="false"/>

<plugin
id="org.eclipse.zest.layouts"
download-size="0"
install-size="0"
version="1.6.0.202409021815"
unpack="false"/>

</feature>
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ Import-Package: org.eclipse.gemini.blueprint;resolution:=optional,
Require-Bundle: org.apache.felix.gogo.runtime;bundle-version="[0.10.0,1.0.0)";resolution:=optional
Bundle-Vendor: Eclipse.org - Virgo
Export-Package: org.eclipse.virgo.ide.management.remote
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
6 changes: 5 additions & 1 deletion org.eclipse.virgo.ide.management.remote/README.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ Important attention points:
in Virgo, not in Eclipse
- the execution environment of this bundle and the Java level
must remain the same as Virgo Server or lower, otherwise
the Jar won't be resolved in Virgo at runtime.
the Jar won't be resolved in Virgo at runtime. As of Eclipse 2024-12
JavaSE7 is no more supported for compiling. Virgo can run with Java8
but declares to support only JavaSE7, as such I am removing the
execution environment header from MANIFEST.MF to make this bundle
deployable and runnable in Virgo
- Virgo still ships with a very dated version of Felix Gogo Shell
and Eclipse 2022 and later includes a newer version of the same.
One of the methods that the JMX bridge uses to execute shell commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private static java.util.List<String> getEntries(IProject project) throws CoreEx
* @throws CoreException
*/
/* package */ static IPath getOutputLocation(IProject project) throws CoreException {
IJavaProject jp = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
IJavaProject jp = JavaCore.create(project);
IPath outputLocation = jp.getOutputLocation();

if (outputLocation == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ public void run(IProgressMonitor monitor) throws CoreException {
addNatures(project);
monitor.worked(1);

IBundleProjectDescription bundleDescription = service.getDescription(project);
// remove execution environment
bundleDescription.setExecutionEnvironments(new String[0]);

if (contextRoot != null && contextRoot.length() > 0) {
IPath webContentPath = configureWABClasspath(project);

Expand All @@ -129,18 +133,17 @@ public void run(IProgressMonitor monitor) throws CoreException {
createIndexHTML(contextRoot, webContentPath);
createBuildProperties();

IBundleProjectDescription bundleDescription = service.getDescription(project);

bundleDescription.setHeader(HEADER_WEB_CONTEXT_PATH, SLASH + contextRoot);
bundleDescription.setHeader(HEADER_BUNDLE_CLASS_PATH, CLASS_PATH_VALUE);
bundleDescription.apply(null);
}
bundleDescription.apply(null);
monitor.worked(1);

IFacetedProject fProject = ProjectFacetsManager.create(project.getProject(), true, null);
fProject.installProjectFacet(ProjectFacetsManager.getProjectFacet(FacetCorePlugin.BUNDLE_FACET_ID).getDefaultVersion(), null, null);
monitor.worked(1);
monitor.done();

}

private void createBuildProperties() throws CoreException {
Expand Down Expand Up @@ -195,7 +198,7 @@ private void createFileFromTemplate(String contextRoot, IPath webContentPath, St
}

private IPath configureWABClasspath(IProject project) throws CoreException, JavaModelException {
IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
IJavaProject javaProject = JavaCore.create(project);
javaProject.setOutputLocation(project.getFullPath().append(BIN), null);
IClasspathEntry[] entries = javaProject.getRawClasspath();
IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.virgo.ide.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.core.filesystem,
org.eclipse.swtbot.swt.finder,
org.eclipse.virgo.ide.tests.util,
org.eclipse.virgo.ide.runtime.core,
org.hamcrest.core;bundle-version="[1.3.0,2.0.0)",
org.hamcrest.core,
slf4j.api
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
import org.eclipse.swtbot.swt.finder.utils.TreePath;
import org.eclipse.ui.forms.widgets.Section;
import org.hamcrest.Description;
import org.hamcrest.Factory;
//import org.hamcrest.Factory;
import org.hamcrest.Matcher;

/**
* @author Leo Dos Santos
*/
public class InSection<T extends Widget> extends AbstractMatcher<T> {

@Factory
// @Factory
public static <T extends Widget> Matcher<T> inSection(Matcher<?> matcher) {
return new InSection<T>(matcher);
}

@Factory
// @Factory
public static <T extends Widget> Matcher<T> inSection(String labelText) {
return new InSection<T>(labelText);
}
Expand Down
3 changes: 2 additions & 1 deletion org.eclipse.virgo.ide.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ltk.core.refactoring,
org.eclipse.wst.sse.ui.infopop;bundle-version="1.0.300",
org.eclipse.virgo.ide.pde.core,
org.eclipse.wst.web
org.eclipse.wst.web,
org.eclipse.ui.genericeditor
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.virgo.ide.internal.ui,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.eclipse.jface.action.Separator;
import org.eclipse.pde.internal.ui.PDEUIMessages;
import org.eclipse.pde.internal.ui.editor.PDEFormEditorContributor;
import org.eclipse.pde.internal.ui.editor.PDEProjectionSourcePage;
import org.eclipse.pde.internal.ui.editor.PDESourcePage;
import org.eclipse.pde.internal.ui.editor.actions.HyperlinkAction;
import org.eclipse.pde.internal.ui.editor.actions.PDEActionConstants;
Expand Down Expand Up @@ -240,46 +239,47 @@ public void setActivePage(IEditorPart newEditor) {
*
*/
protected void updateQuickOutlineMenuEntry() {
// Get the main action bar
IActionBars actionBars = getActionBars();
IMenuManager menuManager = actionBars.getMenuManager();
// Get the navigate menu
IMenuManager navigateMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
// Ensure there is a navigate menu
if (navigateMenu == null) {
return;
}
// Remove the previous version of the quick outline menu entry - if
// one exists
// Prevent duplicate menu entries
// Prevent wrong quick outline menu from being brought up for the wrong
// page
navigateMenu.remove(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE);
// Ensure the active page is a source page
// Only add the quick outline menu to the source pages
if (this.fPage instanceof PDEProjectionSourcePage == false) {
return;
}
PDEProjectionSourcePage page = (PDEProjectionSourcePage) this.fPage;
// Only add the action if the source page supports it
if (page.isQuickOutlineEnabled() == false) {
return;
}
// Get the appropriate quick outline action associated with the active
// source page
IAction quickOutlineAction = page.getAction(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE);
// Ensure it is defined
if (quickOutlineAction == null) {
return;
}
// Add the quick outline action after the "Show In" menu contributed
// by JDT
// This could break if JDT changes the "Show In" menu ID
try {
navigateMenu.insertAfter("showIn", quickOutlineAction); //$NON-NLS-1$
} catch (IllegalArgumentException e) {
// Ignore
}
// Not possible starting from Eclipse 2024-12
// // Get the main action bar
// IActionBars actionBars = getActionBars();
// IMenuManager menuManager = actionBars.getMenuManager();
// // Get the navigate menu
// IMenuManager navigateMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
// // Ensure there is a navigate menu
// if (navigateMenu == null) {
// return;
// }
// // Remove the previous version of the quick outline menu entry - if
// // one exists
// // Prevent duplicate menu entries
// // Prevent wrong quick outline menu from being brought up for the wrong
// // page
// navigateMenu.remove(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE);
// // Ensure the active page is a source page
// // Only add the quick outline menu to the source pages
// if (this.fPage instanceof PDEProjectionSourcePage == false) {
// return;
// }
// PDEProjectionSourcePage page = (PDEProjectionSourcePage) this.fPage;
// // Only add the action if the source page supports it
// if (page.isQuickOutlineEnabled() == false) {
// return;
// }
// // Get the appropriate quick outline action associated with the active
// // source page
// IAction quickOutlineAction = page.getAction(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE);
// // Ensure it is defined
// if (quickOutlineAction == null) {
// return;
// }
// // Add the quick outline action after the "Show In" menu contributed
// // by JDT
// // This could break if JDT changes the "Show In" menu ID
// try {
// navigateMenu.insertAfter("showIn", quickOutlineAction); //$NON-NLS-1$
// } catch (IllegalArgumentException e) {
// // Ignore
// }
}

protected TextEditorActionContributor createSourceContributor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
Expand Down Expand Up @@ -119,7 +120,8 @@ public Object[] getElements(Object inputElement) {
IBundle bundle = model.getBundle();
IManifestHeader header = bundle.getManifestHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
if (header instanceof RequiredExecutionEnvironmentHeader) {
return ((RequiredExecutionEnvironmentHeader) header).getEnvironments();
RequiredExecutionEnvironmentHeader header2 = (RequiredExecutionEnvironmentHeader) header;
return header2.getEnvironments().toArray(new Object[0]);
}
}
return new Object[0];
Expand All @@ -129,7 +131,7 @@ public Object[] getElements(Object inputElement) {
public BundleExecutionEnvironmentSection(PDEFormPage page, Composite parent) {
super(page, parent, Section.DESCRIPTION,
new String[] { PDEUIMessages.RequiredExecutionEnvironmentSection_add, PDEUIMessages.RequiredExecutionEnvironmentSection_remove,
PDEUIMessages.RequiredExecutionEnvironmentSection_up, PDEUIMessages.RequiredExecutionEnvironmentSection_down });
PDEUIMessages.ManifestEditor_LibrarySection_up, PDEUIMessages.ManifestEditor_LibrarySection_down });
createClient(getSection(), page.getEditor().getToolkit());
}

Expand Down Expand Up @@ -287,8 +289,11 @@ private void handleRemove() {
Iterator iter = ssel.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof ExecutionEnvironment) {
getHeader().removeExecutionEnvironment((ExecutionEnvironment) object);
// if (object instanceof ExecutionEnvironment) {
// getHeader().removeExecutionEnvironment((ExecutionEnvironment) object);
// }
if (object instanceof String) {
getHeader().removeExecutionEnvironment(object.toString());
}
}
}
Expand Down Expand Up @@ -329,7 +334,11 @@ private void addExecutionEnvironments(Object[] result) {
getBundle().setHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, buffer.toString());
} else {
RequiredExecutionEnvironmentHeader ee = (RequiredExecutionEnvironmentHeader) header;
ee.addExecutionEnvironments(result);
List<String> ees = new ArrayList<String>();
for (Object object : result) {
ees.add(object.toString());
}
ee.addExecutionEnvironments(ees);
}
}

Expand All @@ -349,9 +358,9 @@ private Object[] getEnvironments() {
return envs;
}
ArrayList list = new ArrayList();
for (int i = 0; i < envs.length; i++) {
if (!header.hasExecutionEnvironment(envs[i])) {
list.add(envs[i]);
for (IExecutionEnvironment env : envs) {
if (!header.getEnvironments().contains(env)) {
list.add(env);
}
}
return list.toArray();
Expand Down
Loading

0 comments on commit 9541969

Please sign in to comment.