GhidraDev new module project wizard can now optionally include/exclude

processor.  Also fixed building processor using buildLanguage.xml.
This commit is contained in:
Ryan Kurtz 2019-08-14 08:41:17 -04:00
parent 8caa0b0f4c
commit 5c74632fdb
2 changed files with 16 additions and 7 deletions

View File

@ -42,7 +42,8 @@ public class GhidraModuleUtils {
PLUGIN("Plugin", "Extends the Ghidra user interface"),
LOADER("Loader", "Loads/imports a binary file format into Ghidra"),
FILESYSTEM("FileSystem", "Opens a file system format for browsing or batch import"),
EXPORTER("Exporter", "Exports/saves a Ghidra program to a specific file format");
EXPORTER("Exporter", "Exports/saves a Ghidra program to a specific file format"),
PROCESSOR("Processor", "Enables disassembly/decompilation of a processor/architecture");
private String name;
private String description;
@ -136,7 +137,14 @@ public class GhidraModuleUtils {
List<String> excludeRegexes = new ArrayList<>();
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
if (!moduleTemplateTypes.contains(moduleTemplateType)) {
excludeRegexes.add(SKELETON_CLASS + moduleTemplateType.getName() + "\\.java");
if (moduleTemplateType.equals(ModuleTemplateType.PROCESSOR)) {
excludeRegexes.add("languages");
excludeRegexes.add("buildLanguage\\.xml");
excludeRegexes.add("sleighArgs\\.txt");
}
else {
excludeRegexes.add(SKELETON_CLASS + moduleTemplateType.getName() + "\\.java");
}
}
}
@ -199,7 +207,7 @@ public class GhidraModuleUtils {
* Writes project-specific ant properties, which get imported by the module project's language
* build.xml file to allow building against a Ghidra that lives in an external location. If the
* given project is not a Ghidra module project, or if the Ghidra module project does not have a
* language build.xml ant file, this method has no effect.
* language buildLanguage.xml ant file, this method has no effect.
*
* @param project The project to receive the ant properties.
* @param ghidraLayout The layout that contains the Ghidra installation directory that the project
@ -216,7 +224,7 @@ public class GhidraModuleUtils {
if (!dataFolder.exists()) {
return;
}
IFile buildXmlFile = dataFolder.getFile("build.xml");
IFile buildXmlFile = dataFolder.getFile("buildLanguage.xml");
if (!buildXmlFile.exists()) {
return;
}

View File

@ -49,12 +49,12 @@ public class ConfigureGhidraModuleProjectWizardPage extends WizardPage {
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout(2, false));
container.setLayout(new GridLayout(1, false));
Label moduleTemplateLabel = new Label(container, SWT.NULL);
moduleTemplateLabel.setText("Module template:");
Group moduleTemplateGroup = new Group(container, SWT.SHADOW_ETCHED_OUT);
moduleTemplateGroup.setLayout(new RowLayout(SWT.HORIZONTAL));
moduleTemplateGroup.setLayout(new RowLayout(SWT.VERTICAL));
SelectionListener selectionListener = new SelectionListener() {
@Override
@ -71,7 +71,8 @@ public class ConfigureGhidraModuleProjectWizardPage extends WizardPage {
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
Button checkboxButton = new Button(moduleTemplateGroup, SWT.CHECK);
checkboxButton.setSelection(true);
checkboxButton.setText(moduleTemplateType.getName());
checkboxButton.setText(
moduleTemplateType.getName() + " - " + moduleTemplateType.getDescription());
checkboxButton.setToolTipText(moduleTemplateType.getDescription());
checkboxButton.addSelectionListener(selectionListener);
moduleTemplateCheckboxMap.put(checkboxButton, moduleTemplateType);