mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-23 12:49:45 +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>)
|
||||
*
|
||||
*****************************************************************************************/
|
||||
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()
|
||||
file(ghidraDir + "/application.properties").withReader { reader ->
|
||||
ghidraProps.load(reader)
|
||||
@ -42,9 +43,24 @@ artifacts {
|
||||
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 {
|
||||
sourceCompatibility = ghidraProps.getProperty('application.java.compiler')
|
||||
targetCompatibility = ghidraProps.getProperty('application.java.compiler')
|
||||
dependsOn copyDependencies
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -64,9 +80,9 @@ def pathInZip = "${project.name}"
|
||||
task zipSource (type: Zip) {
|
||||
|
||||
// Define some metadata about the zip (name, location, version, etc....)
|
||||
it.baseName project.name + "-src"
|
||||
it.extension 'zip'
|
||||
it.destinationDir file(project.projectDir.path + "/build/tmp/src")
|
||||
it.archiveBaseName = project.name + "-src"
|
||||
it.archiveExtension = 'zip'
|
||||
it.destinationDirectory = file(project.projectDir.path + "/build/tmp/src")
|
||||
|
||||
// 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.
|
||||
@ -74,13 +90,12 @@ task zipSource (type: Zip) {
|
||||
it.include 'src/**/*'
|
||||
}
|
||||
|
||||
|
||||
task buildExtension (type: Zip) {
|
||||
|
||||
archiveBaseName = "${ZIP_NAME_PREFIX}_${project.name}"
|
||||
archiveExtension = 'zip'
|
||||
destinationDir DISTRIBUTION_DIR
|
||||
version ''
|
||||
destinationDirectory = DISTRIBUTION_DIR
|
||||
archiveVersion = ''
|
||||
|
||||
// Make sure that we don't try to copy the same file with the same path into the
|
||||
// zip (this can happen!)
|
||||
@ -154,7 +169,7 @@ task buildExtension (type: Zip) {
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
@ -222,7 +237,7 @@ task buildHelp(type: JavaExec, dependsOn: indexHelp) {
|
||||
|
||||
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
|
||||
|
||||
@ -242,7 +257,7 @@ task buildHelp(type: JavaExec, dependsOn: indexHelp) {
|
||||
jar {
|
||||
from "build/help/main" // include the generated help index files
|
||||
from "src/main/help" // include the help source files
|
||||
version = ""
|
||||
archiveVersion = ""
|
||||
}
|
||||
|
||||
// build the help whenever this module's jar file is built
|
||||
|
@ -47,28 +47,14 @@ else {
|
||||
}
|
||||
//----------------------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
|
||||
}
|
||||
repositories {
|
||||
// Declare dependency repositories here. This is not needed if dependencies are manually
|
||||
// dropped into the lib/ directory.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html for more info.
|
||||
// Ex: mavenCentral()
|
||||
}
|
||||
|
||||
task cleanDependencyJars(type: Delete) {
|
||||
delete fileTree("lib").matching {
|
||||
include "**/*.jar"
|
||||
}
|
||||
dependencies {
|
||||
// Any external dependencies added here will automatically be copied to the lib/ directory when
|
||||
// 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
|
||||
is dependent upon. If you use the copyDependencies task, this directory
|
||||
is automatically managed by Gradle and should not be modified.
|
||||
The "lib" directory is intended to hold Jar files which this module is dependent upon. Jar files
|
||||
may be placed in this directory manually, or automatically by maven via the dependencies block
|
||||
of this module's build.gradle file.
|
Loading…
Reference in New Issue
Block a user