ghidra/gradle/debugger/hasNodepJar.gradle
2024-06-12 10:04:40 -04:00

62 lines
1.8 KiB
Groovy

/* ###
* 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.runtimeClasspath)
doLast {
configurations.runtimeClasspath.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(jar.archiveFile)
dependsOn(configureNodepJar)
dependsOn(jar)
archiveAppendix = 'nodep'
from(zipTree(jar.archiveFile))
duplicatesStrategy = 'exclude'
}