mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-1016: Fixing single jar mode exception
This commit is contained in:
parent
a3f3f7eb82
commit
2eea089265
3 changed files with 26 additions and 12 deletions
|
@ -86,6 +86,10 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
// include features unless they have been excluded via the module.manifest file.
|
// include features unless they have been excluded via the module.manifest file.
|
||||||
return !module.excludeFromGhidraJar();
|
return !module.excludeFromGhidraJar();
|
||||||
}
|
}
|
||||||
|
if (module.isDebug()) {
|
||||||
|
// include debug modules unless they have been excluded via the module.manifest file.
|
||||||
|
return !module.excludeFromGhidraJar();
|
||||||
|
}
|
||||||
if (module.isGPL()) {
|
if (module.isGPL()) {
|
||||||
// include features unless they have been excluded via the module.manifest file.
|
// include features unless they have been excluded via the module.manifest file.
|
||||||
return !module.excludeFromGhidraJar();
|
return !module.excludeFromGhidraJar();
|
||||||
|
@ -335,8 +339,8 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wroteToZip) {
|
if (wroteToZip) {
|
||||||
System.out.println(
|
System.out
|
||||||
"Can't create source zip! Has source been downloaded and installed?");
|
.println("Can't create source zip! Has source been downloaded and installed?");
|
||||||
// zip.close reports error if nothing has been written to it
|
// zip.close reports error if nothing has been written to it
|
||||||
zip.close();
|
zip.close();
|
||||||
}
|
}
|
||||||
|
@ -396,6 +400,7 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
JarEntry jarEntry = entries.nextElement();
|
JarEntry jarEntry = entries.nextElement();
|
||||||
|
String jarName = jarEntry.getName();
|
||||||
|
|
||||||
// Special case for Log4j:
|
// Special case for Log4j:
|
||||||
//
|
//
|
||||||
|
@ -415,7 +420,7 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
// point, even though it doesn't now. As such, we may want to try to merge
|
// point, even though it doesn't now. As such, we may want to try to merge
|
||||||
// all the .dat files together at some point.
|
// all the .dat files together at some point.
|
||||||
//
|
//
|
||||||
if (jarEntry.getName().contains("Log4j2Plugins.dat")) {
|
if (jarName.contains("Log4j2Plugins.dat")) {
|
||||||
if (jarFile.getName().contains("log4j-core")) {
|
if (jarFile.getName().contains("log4j-core")) {
|
||||||
jar.addJarEntry(jarFile, jarEntry, module);
|
jar.addJarEntry(jarFile, jarEntry, module);
|
||||||
}
|
}
|
||||||
|
@ -424,6 +429,10 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (jarName.endsWith(".SF") || jarName.endsWith(".DSA") || jarName.endsWith(".RSA")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
jar.addJarEntry(jarFile, jarEntry, module);
|
jar.addJarEntry(jarFile, jarEntry, module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,26 +571,26 @@ public class GhidraJarBuilder implements GhidraLaunchable {
|
||||||
}
|
}
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ApplicationModule> findAllModules(ApplicationLayout layout) throws IOException {
|
private List<ApplicationModule> findAllModules(ApplicationLayout layout) throws IOException {
|
||||||
List<ApplicationModule> modules = new ArrayList<>();
|
List<ApplicationModule> modules = new ArrayList<>();
|
||||||
|
|
||||||
for (GModule module : layout.getModules().values()) {
|
for (GModule module : layout.getModules().values()) {
|
||||||
File moduleDir = module.getModuleRoot().getFile(false).getCanonicalFile();
|
File moduleDir = module.getModuleRoot().getFile(false).getCanonicalFile();
|
||||||
File rootDir = getModuleRootDir(moduleDir);
|
File rootDir = getModuleRootDir(moduleDir);
|
||||||
modules.add(new ApplicationModule(rootDir, moduleDir));
|
modules.add(new ApplicationModule(rootDir, moduleDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getModuleRootDir(File moduleDir) {
|
private File getModuleRootDir(File moduleDir) {
|
||||||
// Look in GPL directories too
|
// Look in GPL directories too
|
||||||
List<File> rootDirs = new ArrayList<>(rootGhidraDirs);
|
List<File> rootDirs = new ArrayList<>(rootGhidraDirs);
|
||||||
for (File rootDir : rootGhidraDirs) {
|
for (File rootDir : rootGhidraDirs) {
|
||||||
rootDirs.add(new File(rootDir.getParentFile(), "GPL"));
|
rootDirs.add(new File(rootDir.getParentFile(), "GPL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check each root directory to see if it contains the module
|
// Check each root directory to see if it contains the module
|
||||||
for (File rootDir : rootDirs) {
|
for (File rootDir : rootDirs) {
|
||||||
if (FileUtilities.isPathContainedWithin(rootDir, moduleDir)) {
|
if (FileUtilities.isPathContainedWithin(rootDir, moduleDir)) {
|
||||||
|
|
|
@ -65,6 +65,10 @@ public class ApplicationModule implements Comparable<ApplicationModule> {
|
||||||
return moduleDir.getParentFile().getName().equalsIgnoreCase("Framework");
|
return moduleDir.getParentFile().getName().equalsIgnoreCase("Framework");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDebug() {
|
||||||
|
return moduleDir.getParentFile().getName().equalsIgnoreCase("Debug");
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isProcessor() {
|
public boolean isProcessor() {
|
||||||
return moduleDir.getParentFile().getName().equalsIgnoreCase("Processors");
|
return moduleDir.getParentFile().getName().equalsIgnoreCase("Processors");
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,10 +232,11 @@ public class GhidraLauncher {
|
||||||
typePriorityMap.put("Framework", 0);
|
typePriorityMap.put("Framework", 0);
|
||||||
typePriorityMap.put("Configurations", 1);
|
typePriorityMap.put("Configurations", 1);
|
||||||
typePriorityMap.put("Features", 2);
|
typePriorityMap.put("Features", 2);
|
||||||
typePriorityMap.put("Processors", 3);
|
typePriorityMap.put("Debug", 3);
|
||||||
typePriorityMap.put("GPL", 4);
|
typePriorityMap.put("Processors", 4);
|
||||||
typePriorityMap.put("Extensions", 5);
|
typePriorityMap.put("GPL", 5);
|
||||||
typePriorityMap.put("Test", 6);
|
typePriorityMap.put("Extensions", 6);
|
||||||
|
typePriorityMap.put("Test", 7);
|
||||||
|
|
||||||
String type1 = module1.getModuleRoot().getParentFile().getName();
|
String type1 = module1.getModuleRoot().getParentFile().getName();
|
||||||
String type2 = module2.getModuleRoot().getParentFile().getName();
|
String type2 = module2.getModuleRoot().getParentFile().getName();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue