mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-10 14:11:59 +00:00
00533b2869
architectures. Support for building on ARM.
42 lines
1.9 KiB
Groovy
42 lines
1.9 KiB
Groovy
/* ###
|
|
* IP: Public Domain
|
|
*/
|
|
|
|
/******************************************************************************************
|
|
* Helper method that returns a file that is the same relative location in the bin repo
|
|
* as the given project is in its repo.
|
|
******************************************************************************************/
|
|
ext.getProjectLocationInBinRepo = { p ->
|
|
String relativePath = getGhidraRelativePath(p)
|
|
File binRepoRootProject = new File("${BIN_REPO}")
|
|
return new File(binRepoRootProject, relativePath)
|
|
}
|
|
/****************************************************************************************
|
|
* Returns the "effective" relative path (Path starting with Ghidra)
|
|
* Normally, for files in the ghidra repo this is just the relative path from
|
|
* the root project (ghidra) to the given project.
|
|
*
|
|
* For example <...>/ghidra/Ghidra/Features/Base will return Ghidra/Features/Base
|
|
*
|
|
* If the project is in a sibling repo (ghidra.<other> that lives in the same directory
|
|
* as ghidra), then this method returns a relative path as though the project lived
|
|
* in ghidra.
|
|
*
|
|
* for example <...>/ghidra.foo/Ghidra/Features/OtherProject will return Ghidra/Features/OtherProject
|
|
****************************************************************************************/
|
|
ext.getGhidraRelativePath = { p ->
|
|
String path = rootProject.relativePath(p.projectDir)
|
|
|
|
// If the project lives outside the ghidra repo, then its relative path will
|
|
// start with "../". In this case, we want to remove the "../" and the next path element
|
|
// so that the path will appear as though the project lived under the ghidra repo.
|
|
// example: "../ghidra/Ghidra/Features/Foo" will get changed to "Ghidra/Features/Foo"
|
|
String prefix = ".."+File.separator
|
|
if (path.startsWith(prefix)) {
|
|
int index = path.indexOf(File.separator,3)
|
|
path = path.substring(index+1)
|
|
}
|
|
|
|
return path
|
|
}
|