mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-21 22:43:58 +08:00
Adding JUnit to projects created by GhidraDev.
This commit is contained in:
@@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.ant.core;bundle-version="3.5.200",
|
||||
org.eclipse.jdt.core;bundle-version="3.16.0",
|
||||
org.eclipse.jdt.core.manipulation;bundle-version="1.11.0",
|
||||
org.eclipse.jdt.debug.ui;bundle-version="3.10.100",
|
||||
org.eclipse.jdt.junit.core;bundle-version="3.10.200",
|
||||
org.eclipse.jdt.launching;bundle-version="3.12.0",
|
||||
org.eclipse.jdt.ui;bundle-version="3.16.0",
|
||||
org.eclipse.ltk.core.refactoring;bundle-version="3.9.200",
|
||||
|
||||
+10
@@ -26,6 +26,7 @@ import org.eclipse.core.runtime.*;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.jdt.core.*;
|
||||
import org.eclipse.jdt.internal.launching.StandardVMType;
|
||||
import org.eclipse.jdt.junit.JUnitCore;
|
||||
import org.eclipse.jdt.launching.*;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
@@ -298,6 +299,10 @@ public class GhidraProjectUtils {
|
||||
IFolder binFolder = project.getFolder("bin");
|
||||
javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
|
||||
|
||||
// Add Eclipse's built-in JUnit to classpath
|
||||
addToClasspath(javaProject, JavaCore.newContainerEntry(JUnitCore.JUNIT4_CONTAINER_PATH),
|
||||
monitor);
|
||||
|
||||
// Link in Ghidra to the project
|
||||
linkGhidraToProject(javaProject, ghidraLayout, javaConfig, jythonInterpreterName, monitor);
|
||||
|
||||
@@ -370,6 +375,11 @@ public class GhidraProjectUtils {
|
||||
vmEntryCandidate = entry;
|
||||
}
|
||||
}
|
||||
else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
|
||||
entry.getPath().toString().startsWith(JUnitCore.JUNIT_CONTAINER_ID)) {
|
||||
// Keep existing JUnit
|
||||
classpathEntriesToKeep.add(entry);
|
||||
}
|
||||
else if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
|
||||
// Keep all project dependencies
|
||||
classpathEntriesToKeep.add(entry);
|
||||
|
||||
Reference in New Issue
Block a user