mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-1080: Preventing native test binaries from getting built for the
distribution
This commit is contained in:
@@ -87,6 +87,16 @@ def isNativeBinaryMakeTask(Task task, String platform) {
|
||||
return false
|
||||
}
|
||||
|
||||
/*******************************************************************************************
|
||||
* Returns true if the native binaries for the given task should be skipped during build.
|
||||
*
|
||||
* NOTE: Some native binaries are test-only and should not be built for a distribution.
|
||||
*
|
||||
******************************************************************************************/
|
||||
def shouldSkipNative(task) {
|
||||
return task.ext.has("skipNative") && task.ext.get("skipNative")
|
||||
}
|
||||
|
||||
/*******************************************************************************************
|
||||
* Task Rule : builds all the natives in this module for a given platform.
|
||||
*
|
||||
@@ -113,6 +123,11 @@ tasks.addRule("Pattern: buildNatives_<platform name>]: build all natives for giv
|
||||
myTask.dependsOn t.path
|
||||
t.dependsOn CheckToolChain
|
||||
}
|
||||
|
||||
// buildNatives task natives end up in the distribution...mark test natives as "skip"
|
||||
if (project.findProperty("nativesTestOnly") ?: false) {
|
||||
t.ext.set("skipNative", true)
|
||||
}
|
||||
}
|
||||
|
||||
// add callbacks to look for native build tasks when new tasks are added later
|
||||
@@ -169,18 +184,22 @@ tasks.addRule("Pattern: prebuildNatives_<platform name>]: build all natives for
|
||||
gradle.taskGraph.whenReady {
|
||||
def p = this.project
|
||||
p.tasks.withType(LinkExecutable).each { t ->
|
||||
File f = t.linkedFile.getAsFile().get()
|
||||
String filename = f.getName()
|
||||
NativePlatform platform = t.targetPlatform.get()
|
||||
String osName = platform.getName()
|
||||
t.linkedFile = p.file("build/os/${osName}/$filename")
|
||||
if (!shouldSkipNative(t)) {
|
||||
File f = t.linkedFile.getAsFile().get()
|
||||
String filename = f.getName()
|
||||
NativePlatform platform = t.targetPlatform.get()
|
||||
String osName = platform.getName()
|
||||
t.linkedFile = p.file("build/os/${osName}/$filename")
|
||||
}
|
||||
}
|
||||
p.tasks.withType(LinkSharedLibrary).each { t ->
|
||||
File f = t.linkedFile.getAsFile().get()
|
||||
String filename = f.getName()
|
||||
NativePlatform platform = t.targetPlatform.get()
|
||||
String osName = platform.getName()
|
||||
t.linkedFile = p.file("build/os/${osName}/$filename")
|
||||
if (!shouldSkipNative(t)) {
|
||||
File f = t.linkedFile.getAsFile().get()
|
||||
String filename = f.getName()
|
||||
NativePlatform platform = t.targetPlatform.get()
|
||||
String osName = platform.getName()
|
||||
t.linkedFile = p.file("build/os/${osName}/$filename")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user