#2219 Copy Jars into lib folder during plugin build automatically

This commit is contained in:
rlee287 2020-08-25 17:11:09 -07:00 committed by Ryan Kurtz
parent 656060a1a5
commit 71b70cf8e5
2 changed files with 28 additions and 2 deletions

View file

@ -46,3 +46,29 @@ else {
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!") throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
} }
//----------------------END "DO NOT MODIFY" SECTION------------------------------- //----------------------END "DO NOT MODIFY" SECTION-------------------------------
// Include the code below if you want dependency jars to be automatically managed
task copyDependencies(type: Copy) {
from configurations.default
into "lib"
exclude {fileTreeElement ->
def fileAbsPath = fileTreeElement.getFile().getCanonicalFile().toPath()
// Avoid including Ghidra Jars in lib folder...
def isGhidraJar = fileAbsPath.startsWith(ghidraInstallDir)
// ...and jars already in the destination location
def destLibDir = project.file("lib").getCanonicalFile().toPath()
def isFromDest = fileAbsPath.startsWith(destLibDir)
return isGhidraJar || isFromDest
}
}
task cleanDependencyJars(type: Delete) {
delete fileTree("lib").matching {
include "**/*.jar"
}
}
tasks.buildExtension.dependsOn(copyDependencies)
tasks.copyDependencies.dependsOn(cleanDependencyJars)
tasks.clean.dependsOn(cleanDependencyJars)

View file

@ -1,3 +1,3 @@
The "lib" directory is intended to hold Jar files which this module The "lib" directory is intended to hold Jar files which this module
is dependent upon. This directory may be eliminated from a specific is dependent upon. If you use the copyDependencies task, this directory
module if no other Jar files are needed. is automatically managed by Gradle and should not be modified.