Merge remote-tracking branch 'origin/GP-186_dragonmacher_PR-1922_ryanmkurtz_GhidraDev'

This commit is contained in:
ghidravore
2020-09-22 18:07:35 -04:00
6 changed files with 44 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/ghidra.ghidradev_2.1.0.qualifier.jar" id="ghidra.ghidradev" version="2.1.0.qualifier">
<feature url="features/ghidra.ghidradev_2.1.1.qualifier.jar" id="ghidra.ghidradev" version="2.1.1.qualifier">
<category name="ghidra.ghidradev"/>
</feature>
<category-def name="ghidra.ghidradev" label="Ghidra"/>

View File

@@ -2,7 +2,7 @@
<feature
id="ghidra.ghidradev"
label="GhidraDev"
version="2.1.0.qualifier"
version="2.1.1.qualifier"
provider-name="Ghidra">
<description>

View File

@@ -19,7 +19,7 @@
<h1>GhidraDev README</h1>
<p>GhidraDev provides support for developing and debugging Ghidra scripts and modules in Eclipse.
</p>
<p>The information provided in this document is effective as of GhidraDev 2.1.0 and is subject to
<p>The information provided in this document is effective as of GhidraDev 2.1.1 and is subject to
change with future releases.</p>
<ul>
@@ -53,6 +53,8 @@ change with future releases.</p>
</ul>
<h2><a name="ChangeHistory"></a>Change History</h2>
<p><u><b>2.1.1</b>:</u> Python debugging now works when PyDev is installed via the Eclipse "dropins"
directory.</p>
<p><u><b>2.1.0</b>:</u>
<ul>
<li>

View File

@@ -3,7 +3,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: GhidraDev
Bundle-SymbolicName: ghidra.ghidradev;singleton:=true
Bundle-Version: 2.1.0.qualifier
Bundle-Version: 2.1.1.qualifier
Bundle-Activator: ghidradev.Activator
Require-Bundle: org.eclipse.ant.core;bundle-version="3.5.200",
org.eclipse.buildship.core;bundle-version="3.0.0",

View File

@@ -6,8 +6,7 @@ NOTE: Only "Eclipse for RCP and RAP Developers" has the ability to do the below
following instructions assume that you are using this version of Eclipse.
Importing GhidraDev Eclipse projects (they are deactivated by default):
1) Uncomment the line in settings.gradle that includes the GhidraDev project.
2) Run "gradle eclipse" to generate the GhidraDev Eclipse projects.
1) Run gradle eclipse -PeclipsePDE
3) From Eclipse, File --> Import --> General --> Existing Projects into Workspace
4) From the ghidra repo, import "Eclipse GhidraDevFeature" and "Eclipse GhidraDevPlugin".
@@ -27,7 +26,7 @@ Building from Eclipse:
2) File --> Export --> Plug-in Development --> Deployable features
3) Check ghidra.ghidradev (x.y.z.qualifier)
4) Select "Archive file" and choose a directory to save it to. It must end up in
ghidra.bin/GhidraBuild/Eclipse/GhidraDev/. Name it GhidraDev-x.y.z.zip.
ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/. Name it GhidraDev-x.y.z.zip.
5) In the "Options" tab make sure things look like this:
- Export source: UNCHECKED
- Package as individual JAR archives: CHECKED

View File

@@ -16,14 +16,27 @@
package ghidradev.ghidraprojectcreator.utils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.naming.OperationNotSupportedException;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import ghidradev.Activator;
/**
* Utility methods for interacting with PyDev.
*/
@@ -142,21 +155,33 @@ public class PyDevUtils {
* Gets The PyDev source directory.
*
* @return The PyDev source directory, or null if it was not found.
* @throws CoreException if there was a problem searching for the PyDev source directory.
*/
public static File getPyDevSrcDir() {
public static File getPyDevSrcDir() throws CoreException {
String eclipsePath = Platform.getInstallLocation().getURL().getFile();
File pluginsDir = new File(eclipsePath, "plugins");
File[] pluginSubDirs = pluginsDir.listFiles(File::isDirectory);
if (pluginSubDirs != null) {
for (File dir : pluginSubDirs) {
if (dir.getName().startsWith("org.python.pydev")) {
File pysrcDir = new File(dir, "pysrc");
if (pysrcDir.isDirectory()) {
return pysrcDir;
}
List<File> searchDirs = new ArrayList<>();
searchDirs.add(new File(eclipsePath, "plugins"));
searchDirs.add(new File(eclipsePath, "dropins"));
for (File searchRoot : searchDirs) {
try (Stream<Path> paths = Files.walk(Paths.get(searchRoot.toURI()))) {
Optional<File> pysrcDir = paths.filter(
Files::isDirectory)
.filter(p -> p.endsWith("pysrc"))
.map(p -> p.toFile())
.filter(f -> f.getParentFile().getName().startsWith("org.python.pydev"))
.findFirst();
if (pysrcDir.isPresent()) {
return pysrcDir.get();
}
}
catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, "Problem searching for PyDev source directory", e));
}
}
return null;
}
}