Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6385: Some more gradle tweaks

Ryan Kurtz675be71ebb1f
diff --git a/Ghidra/Features/FileFormats/build.gradle b/Ghidra/Features/FileFormats/build.gradle
index 2c77ea6cbf..e70ae01188 100644
--- a/Ghidra/Features/FileFormats/build.gradle
+++ b/Ghidra/Features/FileFormats/build.gradle
@@ -82,15 +82,17 @@ String getSevenZipJarPath() {
}
task extractSevenZipNativeLibs(type: Copy) {
- String jarPath = getSevenZipJarPath();
- from zipTree(jarPath)
- include "Linux-amd64/*.so"
- include "Windows-amd64/*.dll"
- include "Mac-x86_64/*.dylib"
- exclude "META-INF"
- exclude "Linux-i386"
- exclude "Windows-x86"
- into ("build/data/sevenzipnativelibs")
+ gradle.taskGraph.whenReady {
+ String jarPath = getSevenZipJarPath();
+ from zipTree(jarPath)
+ include "Linux-amd64/*.so"
+ include "Windows-amd64/*.dll"
+ include "Mac-x86_64/*.dylib"
+ exclude "META-INF"
+ exclude "Linux-i386"
+ exclude "Windows-x86"
+ into ("build/data/sevenzipnativelibs")
+ }
}
rootProject.prepDev.dependsOn extractSevenZipNativeLibs
diff --git a/Ghidra/Features/Jython/build.gradle b/Ghidra/Features/Jython/build.gradle
index 6ec5fa7c01..9056a8023c 100644
--- a/Ghidra/Features/Jython/build.gradle
+++ b/Ghidra/Features/Jython/build.gradle
@@ -45,10 +45,12 @@ task jythonUnpack(type: Copy) {
!file("build/data/${JYTHON_DIR}").exists()
}
- from zipTree(configurations.jython.singleFile)
- include "Lib/**"
-
- destinationDir = file("build/data/${JYTHON_DIR}")
+ gradle.taskGraph.whenReady {
+ from zipTree(configurations.jython.singleFile)
+ include "Lib/**"
+
+ destinationDir = file("build/data/${JYTHON_DIR}")
+ }
}
task jythonSrcCopy(type: Copy) {
diff --git a/Ghidra/Framework/Help/build.gradle b/Ghidra/Framework/Help/build.gradle
index de3410c49c..87afbf0833 100644
--- a/Ghidra/Framework/Help/build.gradle
+++ b/Ghidra/Framework/Help/build.gradle
@@ -55,7 +55,7 @@ def getAllHelpTasks() {
*/
tasks.register('buildHelp') {
- description 'Build all Ghidra help'
+ description = 'Build all Ghidra help'
dependsOn { getAllHelpTasks() } // all 'buildHelpModule' tasks
dependsOn 'validateHelpTocFiles' // the validate TOC task to run after all help is built
diff --git a/Ghidra/Test/DebuggerIntegrationTest/build.gradle b/Ghidra/Test/DebuggerIntegrationTest/build.gradle
index 67c93efb05..5ba74c63c6 100644
--- a/Ghidra/Test/DebuggerIntegrationTest/build.gradle
+++ b/Ghidra/Test/DebuggerIntegrationTest/build.gradle
@@ -53,7 +53,9 @@ dependencies {
evaluationDependsOn(p.path)
- api p
+ p.plugins.withType(JavaPlugin) {
+ api p
+ }
}
}
diff --git a/GhidraBuild/MarkdownSupport/build.gradle b/GhidraBuild/MarkdownSupport/build.gradle
index 4c84b1d9e8..9d12ceb714 100644
--- a/GhidraBuild/MarkdownSupport/build.gradle
+++ b/GhidraBuild/MarkdownSupport/build.gradle
@@ -25,12 +25,12 @@ dependencies {
}
project.afterEvaluate {
- rootProject.ext.mdDeps.clear()
+ rootProject.ext.markdownDeps.clear()
configurations.runtimeClasspath.resolve().each { File f ->
- rootProject.ext.mdDeps.add(f.getAbsolutePath())
+ rootProject.ext.markdownDeps.add(f.getAbsolutePath())
}
sourceSets.main.output.files.each { File f ->
- rootProject.ext.mdDeps.add(f.getAbsolutePath())
+ rootProject.ext.markdownDeps.add(f.getAbsolutePath())
}
}
diff --git a/build.gradle b/build.gradle
index 31f55d9bd6..15cd261406 100644
--- a/build.gradle
+++ b/build.gradle
@@ -93,7 +93,7 @@ else {
* Force all project compile classpaths to be resolved at configuration time.
*********************************************************************************/
allprojects {
- afterEvaluate {
+ gradle.taskGraph.whenReady {
configurations.matching { it.name.endsWith("compileClasspath") }.all { cfg ->
if (cfg.canBeResolved) {
try {
@@ -107,7 +107,7 @@ allprojects {
/*********************************************************************************
* Store :MarkdownSupport ClassPath to fix issues with Gradle 9.
*********************************************************************************/
-ext.mdDeps = []
+ext.markdownDeps = []
/*********************************************************************************
* Imports
diff --git a/gradle/helpProject.gradle b/gradle/helpProject.gradle
index a4d71beceb..9ad85ce313 100644
--- a/gradle/helpProject.gradle
+++ b/gradle/helpProject.gradle
@@ -300,14 +300,13 @@ tasks.register('buildGlobalMarkdown') {
doLast {
markdownFiles.each { f ->
- def htmlFile = "build/src/global/docs/" + f.name[0..-3] + "html"
- [
- 'java',
- '-cp', project.files(rootProject.ext.mdDeps).asPath,
- 'ghidra.markdown.MarkdownToHtml',
- f,
- file(htmlFile)
- ].execute()
+ def htmlName = f.name[0..-3] + "html"
+ providers.javaexec {
+ classpath = rootProject.files(rootProject.ext.markdownDeps)
+ mainClass = 'ghidra.markdown.MarkdownToHtml'
+ args f
+ args file("build/src/global/docs/${htmlName}")
+ }.result.get()
}
}
}
diff --git a/gradle/root/distribution.gradle b/gradle/root/distribution.gradle
index 9ab2c9052d..f9816e4637 100644
--- a/gradle/root/distribution.gradle
+++ b/gradle/root/distribution.gradle
@@ -551,18 +551,16 @@ task assembleMarkdownToHtml (type: Copy) {
outputs.upToDateWhen {false}
destinationDir = file(DISTRIBUTION_DIR.getPath() + "/" + ZIP_DIR_PREFIX)
- doLast {
- eachFile { f ->
- def htmlName = f.sourceName[0..-3] + "html"
- def htmlPath = f.relativePath.replaceLastName(htmlName).pathString
- [
- 'java',
- '-cp', project.files(rootProject.ext.mdDeps).asPath,
- 'ghidra.markdown.MarkdownToHtml',
- f.file,
- file("${destinationDir.path}/${htmlPath}")
- ].execute()
- }
+ eachFile { f ->
+ def htmlName = f.sourceName[0..-3] + "html"
+ def htmlPath = f.relativePath.replaceLastName(htmlName).pathString
+
+ providers.javaexec {
+ classpath = rootProject.files(rootProject.ext.markdownDeps)
+ mainClass = 'ghidra.markdown.MarkdownToHtml'
+ args f.file
+ args file("${destinationDir.path}/${htmlPath}")
+ }.result.get()
}
}