mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-1007: Fix GADP agent nodepJar issues
This commit is contained in:
41
gradle/debugger/hasExecutableJar.gradle
Normal file
41
gradle/debugger/hasExecutableJar.gradle
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ###
|
||||
* 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.
|
||||
*/
|
||||
apply from: "$rootProject.projectDir/gradle/debugger/hasNodepJar.gradle"
|
||||
|
||||
|
||||
task executableJar {
|
||||
ext.execsh = file("src/main/sh/execjar.sh")
|
||||
ext.jarfile = file(nodepJar.archivePath)
|
||||
ext.outjar = file("${buildDir}/bin/run")
|
||||
dependsOn(nodepJar)
|
||||
inputs.file { execsh }
|
||||
inputs.file { jarfile }
|
||||
outputs.file { outjar }
|
||||
doLast {
|
||||
outjar.parentFile.mkdirs()
|
||||
outjar.withOutputStream { output ->
|
||||
execsh.withInputStream { input ->
|
||||
output << input
|
||||
}
|
||||
jarfile.withInputStream { input ->
|
||||
output << input
|
||||
}
|
||||
}
|
||||
exec {
|
||||
commandLine("chmod", "+x", outjar)
|
||||
}
|
||||
}
|
||||
}
|
||||
61
gradle/debugger/hasNodepJar.gradle
Normal file
61
gradle/debugger/hasNodepJar.gradle
Normal file
@@ -0,0 +1,61 @@
|
||||
/* ###
|
||||
* 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.
|
||||
*/
|
||||
def boolean filterJar(File jarfile) {
|
||||
if (jarfile.name.contains("gradle-api")) {
|
||||
return false
|
||||
} else if (jarfile.name.contains("groovy-all")) {
|
||||
return false
|
||||
} else if (jarfile.name.contains("gradle-installation-beacon")) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
task configureNodepJar {
|
||||
dependsOn(configurations.default)
|
||||
doLast {
|
||||
configurations.default.files.forEach { jar ->
|
||||
if (filterJar(jar)) {
|
||||
nodepJar.from(zipTree(jar)) {
|
||||
// The real solution here is probably to sort out the dependency graph
|
||||
// Still, I imagine some of the excludes will be necessary
|
||||
exclude "help/**"
|
||||
exclude "images/**"
|
||||
exclude "OSGI-OPT/**"
|
||||
exclude "org/osgi/**"
|
||||
exclude "aQute/**"
|
||||
// Duplicate. And signature breaks nodep jar
|
||||
exclude "META-INF/*.SF"
|
||||
exclude "META-INF/*.DSA"
|
||||
exclude "META-INF/*.RSA"
|
||||
// Ensure all LICENSES are included, by renaming to avoid collisions
|
||||
rename("((LICENSE)|(AL2\\.0)|(LGPL2\\.1)|(NOTICE)|(NOTICE.txt)|(DEPENDENCIES))", "${jar.name}-\$1")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task nodepJar(type: Jar) {
|
||||
inputs.file(file(jar.archivePath))
|
||||
dependsOn(configureNodepJar)
|
||||
dependsOn(jar)
|
||||
|
||||
archiveAppendix = 'nodep'
|
||||
|
||||
from(zipTree(jar.archivePath))
|
||||
duplicatesStrategy = 'exclude'
|
||||
}
|
||||
Reference in New Issue
Block a user