mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 14:57:09 +08:00
GP-2677: Introduce TraceRmi (API only, experimental)
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*plugins {
|
||||
id 'com.google.protobuf' version '0.8.10'
|
||||
}*/
|
||||
|
||||
configurations {
|
||||
allProtocArtifacts
|
||||
protocArtifact
|
||||
}
|
||||
|
||||
def platform = getCurrentPlatformName()
|
||||
|
||||
|
||||
dependencies {
|
||||
allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe'
|
||||
allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe'
|
||||
allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe'
|
||||
allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe'
|
||||
allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe'
|
||||
|
||||
if (isCurrentWindows()) {
|
||||
protocArtifact 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe'
|
||||
}
|
||||
if (isCurrentLinux()) {
|
||||
if (platform.endsWith("x86_64")) {
|
||||
protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe'
|
||||
}
|
||||
else {
|
||||
protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe'
|
||||
}
|
||||
}
|
||||
if (isCurrentMac()) {
|
||||
if (platform.endsWith("x86_64")) {
|
||||
protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe'
|
||||
}
|
||||
else {
|
||||
protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*protobuf {
|
||||
protoc {
|
||||
artifact = 'com.google.protobuf:protoc:3.21.8'
|
||||
}
|
||||
}*/
|
||||
|
||||
task generateProto {
|
||||
ext.srcdir = file("src/main/proto")
|
||||
ext.src = fileTree(srcdir) {
|
||||
include "**/*.proto"
|
||||
}
|
||||
ext.outdir = file("build/generated/source/proto/main/java")
|
||||
outputs.dir(outdir)
|
||||
inputs.files(src)
|
||||
dependsOn(configurations.protocArtifact)
|
||||
doLast {
|
||||
def exe = configurations.protocArtifact.first()
|
||||
if (!isCurrentWindows()) {
|
||||
exe.setExecutable(true)
|
||||
}
|
||||
exec {
|
||||
commandLine exe, "--java_out=$outdir", "-I$srcdir"
|
||||
args src
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.compileJava.dependsOn(tasks.generateProto)
|
||||
tasks.eclipse.dependsOn(tasks.generateProto)
|
||||
rootProject.tasks.prepDev.dependsOn(tasks.generateProto)
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir tasks.generateProto.outdir
|
||||
}
|
||||
}
|
||||
}
|
||||
zipSourceSubproject.dependsOn generateProto
|
||||
@@ -0,0 +1,86 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
configurations {
|
||||
pypkgInstall
|
||||
}
|
||||
|
||||
task assemblePyPackage(type: Copy) {
|
||||
from "src/main/py"
|
||||
into "build/pypkg/"
|
||||
}
|
||||
|
||||
def getGdbPython() {
|
||||
def out = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine "gdb", "--batch"
|
||||
args "-ex", "python import sys"
|
||||
args "-ex", "python print(f'python{sys.version_info.major}.{sys.version_info.minor}')"
|
||||
standardOutput = out
|
||||
}
|
||||
return "$out".strip()
|
||||
}
|
||||
|
||||
def getLldbPython() {
|
||||
def out = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine "lldb", "--batch"
|
||||
args "-ex", "python import sys"
|
||||
args "-ex", "python print(f'python{sys.version_info.major}.{sys.version_info.minor}')"
|
||||
standardOutput = out
|
||||
}
|
||||
return "$out".strip()
|
||||
}
|
||||
|
||||
task configureBuildPyPackage {
|
||||
doLast {
|
||||
def gdbPython = getGdbPython()
|
||||
buildPyPackage.commandLine gdbPython, "-m", "build"
|
||||
}
|
||||
}
|
||||
|
||||
task buildPyPackage(type: Exec) {
|
||||
dependsOn(configureBuildPyPackage)
|
||||
ext.dist = { file("build/pypkg/dist") }
|
||||
inputs.files(assemblePyPackage)
|
||||
outputs.dir(dist)
|
||||
workingDir { "build/pypkg" }
|
||||
}
|
||||
|
||||
task configureInstallPyPackage {
|
||||
dependsOn(configurations.pypkgInstall)
|
||||
doLast {
|
||||
def gdbPython = getGdbPython()
|
||||
installPyPackage.commandLine gdbPython, "-m", "pip", "install", "--force-reinstall"
|
||||
installPyPackage.args configurations.pypkgInstall.filter { f -> !f.name.endsWith(".jar") }
|
||||
installPyPackage.args file("build/pypkg")
|
||||
}
|
||||
}
|
||||
|
||||
task installPyPackage(type: Exec) {
|
||||
dependsOn(configureInstallPyPackage)
|
||||
inputs.files(assemblePyPackage)
|
||||
}
|
||||
|
||||
task phonyJarPyPackage(type: Jar) {
|
||||
dependsOn(assemblePyPackage)
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
artifacts {
|
||||
pypkgInstall file("build/pypkg")
|
||||
pypkgInstall phonyJarPyPackage
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user