Ghidra is a software reverse engineering (SRE) framework
#2219 Copy Jars into lib folder during plugin build automatically
rlee28771b70cf8e55d
diff --git a/GhidraBuild/Skeleton/buildTemplate.gradle b/GhidraBuild/Skeleton/buildTemplate.gradleindex 7bf7fc7579..6efe651bc4 100644--- a/GhidraBuild/Skeleton/buildTemplate.gradle+++ b/GhidraBuild/Skeleton/buildTemplate.gradle@@ -46,3 +46,29 @@ else {throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")}//----------------------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)diff --git a/GhidraBuild/Skeleton/lib/README.txt b/GhidraBuild/Skeleton/lib/README.txtindex 224d94f8ca..b192e0177e 100644--- a/GhidraBuild/Skeleton/lib/README.txt+++ b/GhidraBuild/Skeleton/lib/README.txt@@ -1,3 +1,3 @@The "lib" directory is intended to hold Jar files which this module-is dependent upon. This directory may be eliminated from a specific-module if no other Jar files are needed.+is dependent upon. If you use the copyDependencies task, this directory+is automatically managed by Gradle and should not be modified.