mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-27 06:30:51 +00:00
GP-1144: Some tweaks to extension dependency pull-request
This commit is contained in:
parent
71b70cf8e5
commit
a17d00bf0c
@ -25,7 +25,8 @@ apply plugin: 'java-library'
|
|||||||
* release name, and distro prefix (ghidira_<version>)
|
* release name, and distro prefix (ghidira_<version>)
|
||||||
*
|
*
|
||||||
*****************************************************************************************/
|
*****************************************************************************************/
|
||||||
def ghidraDir = buildscript.sourceFile.getAbsolutePath() + "/../../Ghidra"
|
def ghidraInstallDir = file(buildscript.sourceFile.getAbsolutePath() + "/../..").getCanonicalFile().getAbsolutePath()
|
||||||
|
def ghidraDir = file(ghidraInstallDir + "/Ghidra").getCanonicalFile().getAbsolutePath()
|
||||||
def ghidraProps = new Properties()
|
def ghidraProps = new Properties()
|
||||||
file(ghidraDir + "/application.properties").withReader { reader ->
|
file(ghidraDir + "/application.properties").withReader { reader ->
|
||||||
ghidraProps.load(reader)
|
ghidraProps.load(reader)
|
||||||
@ -42,9 +43,24 @@ artifacts {
|
|||||||
helpPath jar
|
helpPath jar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task copyDependencies(type: Copy) {
|
||||||
|
from configurations.runtimeClasspath
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
sourceCompatibility = ghidraProps.getProperty('application.java.compiler')
|
sourceCompatibility = ghidraProps.getProperty('application.java.compiler')
|
||||||
targetCompatibility = ghidraProps.getProperty('application.java.compiler')
|
targetCompatibility = ghidraProps.getProperty('application.java.compiler')
|
||||||
|
dependsOn copyDependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -64,9 +80,9 @@ def pathInZip = "${project.name}"
|
|||||||
task zipSource (type: Zip) {
|
task zipSource (type: Zip) {
|
||||||
|
|
||||||
// Define some metadata about the zip (name, location, version, etc....)
|
// Define some metadata about the zip (name, location, version, etc....)
|
||||||
it.baseName project.name + "-src"
|
it.archiveBaseName = project.name + "-src"
|
||||||
it.extension 'zip'
|
it.archiveExtension = 'zip'
|
||||||
it.destinationDir file(project.projectDir.path + "/build/tmp/src")
|
it.destinationDirectory = file(project.projectDir.path + "/build/tmp/src")
|
||||||
|
|
||||||
// We MUST copy from a directory, and not just grab a list of source files.
|
// We MUST copy from a directory, and not just grab a list of source files.
|
||||||
// This is the only way to preserve the directory structure.
|
// This is the only way to preserve the directory structure.
|
||||||
@ -74,13 +90,12 @@ task zipSource (type: Zip) {
|
|||||||
it.include 'src/**/*'
|
it.include 'src/**/*'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task buildExtension (type: Zip) {
|
task buildExtension (type: Zip) {
|
||||||
|
|
||||||
archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}"
|
archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}"
|
||||||
archiveExtension = 'zip'
|
archiveExtension = 'zip'
|
||||||
destinationDir DISTRIBUTION_DIR
|
destinationDirectory = DISTRIBUTION_DIR
|
||||||
version ''
|
archiveVersion = ''
|
||||||
|
|
||||||
// Make sure that we don't try to copy the same file with the same path into the
|
// Make sure that we don't try to copy the same file with the same path into the
|
||||||
// zip (this can happen!)
|
// zip (this can happen!)
|
||||||
@ -154,7 +169,7 @@ task buildExtension (type: Zip) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
println "\nCreated " + archiveBaseName + "." + archiveExtension + " in " + destinationDir
|
println "\nCreated " + archiveBaseName + "." + archiveExtension + " in " + destinationDirectory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +186,7 @@ task indexHelp(type: JavaExec) {
|
|||||||
|
|
||||||
classpath = sourceSets.main.runtimeClasspath // this modules runtime classpath (contains jhall.jar)
|
classpath = sourceSets.main.runtimeClasspath // this modules runtime classpath (contains jhall.jar)
|
||||||
|
|
||||||
main = 'com.sun.java.help.search.Indexer' // main class to call
|
mainClass = 'com.sun.java.help.search.Indexer' // main class to call
|
||||||
|
|
||||||
// tell the indexer where send its output
|
// tell the indexer where send its output
|
||||||
|
|
||||||
@ -222,7 +237,7 @@ task buildHelp(type: JavaExec, dependsOn: indexHelp) {
|
|||||||
|
|
||||||
classpath = sourceSets.main.runtimeClasspath // this modules runtime classpath (contains jhall.jar)
|
classpath = sourceSets.main.runtimeClasspath // this modules runtime classpath (contains jhall.jar)
|
||||||
|
|
||||||
main = 'help.GHelpBuilder' // program to run to build help files.
|
mainClass = 'help.GHelpBuilder' // program to run to build help files.
|
||||||
|
|
||||||
args '-n', "${project.name}" // use the modules name as the base for the help file name
|
args '-n', "${project.name}" // use the modules name as the base for the help file name
|
||||||
|
|
||||||
@ -242,7 +257,7 @@ task buildHelp(type: JavaExec, dependsOn: indexHelp) {
|
|||||||
jar {
|
jar {
|
||||||
from "build/help/main" // include the generated help index files
|
from "build/help/main" // include the generated help index files
|
||||||
from "src/main/help" // include the help source files
|
from "src/main/help" // include the help source files
|
||||||
version = ""
|
archiveVersion = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the help whenever this module's jar file is built
|
// build the help whenever this module's jar file is built
|
||||||
|
@ -47,28 +47,14 @@ else {
|
|||||||
}
|
}
|
||||||
//----------------------END "DO NOT MODIFY" SECTION-------------------------------
|
//----------------------END "DO NOT MODIFY" SECTION-------------------------------
|
||||||
|
|
||||||
// Include the code below if you want dependency jars to be automatically managed
|
repositories {
|
||||||
|
// Declare dependency repositories here. This is not needed if dependencies are manually
|
||||||
task copyDependencies(type: Copy) {
|
// dropped into the lib/ directory.
|
||||||
from configurations.default
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html for more info.
|
||||||
into "lib"
|
// Ex: mavenCentral()
|
||||||
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) {
|
dependencies {
|
||||||
delete fileTree("lib").matching {
|
// Any external dependencies added here will automatically be copied to the lib/ directory when
|
||||||
include "**/*.jar"
|
// this extension is built.
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.buildExtension.dependsOn(copyDependencies)
|
|
||||||
tasks.copyDependencies.dependsOn(cleanDependencyJars)
|
|
||||||
tasks.clean.dependsOn(cleanDependencyJars)
|
|
||||||
|
@ -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. Jar files
|
||||||
is dependent upon. If you use the copyDependencies task, this directory
|
may be placed in this directory manually, or automatically by maven via the dependencies block
|
||||||
is automatically managed by Gradle and should not be modified.
|
of this module's build.gradle file.
|
Loading…
Reference in New Issue
Block a user