Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-970: prepdev no longer fails when gradle cache is on a different drive than the repo

Ryan Kurtz81e0aa3de0bd
diff --git a/Ghidra/Features/GhidraServer/build.gradle b/Ghidra/Features/GhidraServer/build.gradle
index 0b84adadbf..2c628c66ed 100644
--- a/Ghidra/Features/GhidraServer/build.gradle
+++ b/Ghidra/Features/GhidraServer/build.gradle
@@ -153,13 +153,22 @@ task generateDevGhidraServerClasspath {
outfile.withPrintWriter { out ->
int idx = 0
configurations.runGhidraServer.each { jarFile ->
- def JAR_PATH = rootProject.relativePath(jarFile.absolutePath).replace('\\','/')
- def index = JAR_PATH.indexOf("build/")
+ def JAR_PATH = jarFile.absolutePath
+
+ // There might be dependencies in the gradle cache, which could be anywhere
+ // (including a different drive). We can only use relative paths if the jar is in
+ // the root project repo or bin repo.
+ if (JAR_PATH.startsWith(rootProject.getProjectDir().absolutePath) || JAR_PATH.startsWith(BIN_REPO)) {
+ JAR_PATH = "\${ghidra_home}/" + rootProject.relativePath(JAR_PATH)
+ }
+ JAR_PATH = JAR_PATH.replace('\\','/') // necessary for windows
+ def index = JAR_PATH.indexOf("/build/")
if (index != -1) {
- JAR_PATH = JAR_PATH.substring(0, index) + "bin/main"
+ // Use Module's bin/ class directory (produced by Eclipse) instead of jar
+ JAR_PATH = JAR_PATH.substring(0, index) + "/bin/main"
}
if (!jarFile.path.contains("/libsForBuild/")) {
- out.println("wrapper.java.classpath.${++idx}=\${ghidra_home}/${JAR_PATH}")
+ out.println("wrapper.java.classpath.${++idx}=${JAR_PATH}")
}
}
}