From aca7799ad861359d280effaf45bf28787b420e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Fri, 13 Oct 2023 13:26:40 +0200 Subject: [PATCH] disable vm install job in jdt (cherry picked from commit 6cec40c4a25dd58b9ed0801f7730f7c0c5b0f1aa) --- tycho-apitools-plugin/pom.xml | 5 ++ .../eclipse/tycho/apitools/ApiAnalysis.java | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/tycho-apitools-plugin/pom.xml b/tycho-apitools-plugin/pom.xml index 6fdbcccbaf..29f036b0a6 100644 --- a/tycho-apitools-plugin/pom.xml +++ b/tycho-apitools-plugin/pom.xml @@ -69,6 +69,11 @@ org.eclipse.jdt.core 3.35.0 + + org.eclipse.jdt + org.eclipse.jdt.launching + 3.20.100 + org.ow2.asm diff --git a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnalysis.java b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnalysis.java index d0c0ca3117..114cce2acb 100644 --- a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnalysis.java +++ b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnalysis.java @@ -38,10 +38,16 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.internal.launching.LaunchingPlugin; import org.eclipse.osgi.service.resolver.ResolverError; import org.eclipse.pde.api.tools.internal.BundleListTargetLocation; import org.eclipse.pde.api.tools.internal.FilterStore; @@ -94,8 +100,42 @@ public ApiAnalysis(Collection baselineBundles, Collection dependency public ApiAnalysisResult call() throws Exception { ApiAnalysisResult result = new ApiAnalysisResult(); Platform.addLogListener((status, plugin) -> debug(status.toString())); + IJobManager jobManager = Job.getJobManager(); + jobManager.addJobChangeListener(new IJobChangeListener() { + + @Override + public void sleeping(IJobChangeEvent event) { + debug("Job " + event.getJob() + " sleeping..."); + } + + @Override + public void scheduled(IJobChangeEvent event) { + debug("Job " + event.getJob() + " scheduled..."); + } + + @Override + public void running(IJobChangeEvent event) { + debug("Job " + event.getJob() + " running..."); + } + + @Override + public void done(IJobChangeEvent event) { + debug("Job " + event.getJob() + " done..."); + } + + @Override + public void awake(IJobChangeEvent event) { + debug("Job " + event.getJob() + " awake..."); + } + + @Override + public void aboutToRun(IJobChangeEvent event) { + debug("Job " + event.getJob() + " aboutToRun..."); + } + }); printVersion(); disableAutoBuild(); + disableJVMDiscovery(); setTargetPlatform(); deleteAllProjects(); BundleComponent projectComponent = importProject(); @@ -125,6 +165,12 @@ public ApiAnalysisResult call() throws Exception { return result; } + private void disableJVMDiscovery() { + IEclipsePreferences instanceNode = InstanceScope.INSTANCE + .getNode(LaunchingPlugin.getDefault().getBundle().getSymbolicName()); + instanceNode.putBoolean(LaunchingPlugin.PREF_DETECT_VMS_AT_STARTUP, false); + } + private BundleComponent importProject() throws CoreException, IOException { IPath projectPath = IPath.fromOSString(projectDir); IPath projectDescriptionFile = projectPath.append(IProjectDescription.DESCRIPTION_FILE_NAME);