From a7668c7f85badd00932c71f036b7a6c90dacb172 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Tue, 6 Jun 2023 15:25:25 -0400 Subject: [PATCH] GP-3430 - Updated the gradle buildHelp task to better handle its inputs up-do-date state --- .../Debugger-swig-lldb/buildNatives.gradle | 2 +- Ghidra/Debug/Debugger/build.gradle | 4 - .../Extensions/MachineLearning/build.gradle | 1 - Ghidra/Features/Base/build.gradle | 18 +- Ghidra/Features/BytePatterns/build.gradle | 5 +- Ghidra/Features/ByteViewer/build.gradle | 2 - Ghidra/Features/Decompiler/build.gradle | 2 - Ghidra/Features/FileFormats/build.gradle | 2 - Ghidra/Features/FunctionGraph/build.gradle | 6 - .../FunctionGraphPlugin/Function_Graph.html | 4 - Ghidra/Features/FunctionID/build.gradle | 4 +- .../Features/GraphFunctionCalls/build.gradle | 9 +- .../Function_Call_Graph.html | 88 +++- Ghidra/Features/GraphServices/build.gradle | 3 - Ghidra/Features/PDB/build.gradle | 3 +- Ghidra/Features/ProgramDiff/build.gradle | 2 - Ghidra/Features/ProgramGraph/build.gradle | 5 +- .../ProgramGraphPlugin/ProgramGraph.htm | 3 +- Ghidra/Features/Python/build.gradle | 3 +- Ghidra/Features/SourceCodeLookup/build.gradle | 1 - Ghidra/Features/VersionTracking/build.gradle | 2 - Ghidra/Framework/Help/build.gradle | 2 - .../Help/src/main/java/help/GHelpBuilder.java | 11 - .../src/main/java/help/HelpBuildUtils.java | 6 +- .../main/java/help/JavaHelpFilesBuilder.java | 15 +- .../validator/UnusedHelpImageFileFinder.java | 12 +- .../location/HelpModuleCollection.java | 8 +- .../location/HelpModuleLocation.java | 12 +- .../location/JarHelpModuleLocation.java | 37 +- .../HelpModuleLocationTestDouble.java | 2 - .../Common/support/buildExtension.gradle | 270 +++++++++--- gradle/helpProject.gradle | 412 ++++++++++++++---- 32 files changed, 690 insertions(+), 266 deletions(-) diff --git a/Ghidra/Debug/Debugger-swig-lldb/buildNatives.gradle b/Ghidra/Debug/Debugger-swig-lldb/buildNatives.gradle index 6471028bd5..d72dceb1de 100644 --- a/Ghidra/Debug/Debugger-swig-lldb/buildNatives.gradle +++ b/Ghidra/Debug/Debugger-swig-lldb/buildNatives.gradle @@ -127,7 +127,7 @@ if (System.env.LLVM_HOME) { } } } else { - println "Debugger-swig-lldb:buildNatives skipped - LLVM_HOME not defined" + logger.debug('Debugger-swig-lldb:buildNatives skipped - LLVM_HOME not defined') } task checkLLVM { diff --git a/Ghidra/Debug/Debugger/build.gradle b/Ghidra/Debug/Debugger/build.gradle index 54783c069f..bd63aa1c01 100644 --- a/Ghidra/Debug/Debugger/build.gradle +++ b/Ghidra/Debug/Debugger/build.gradle @@ -31,10 +31,6 @@ dependencies { api project(':Decompiler') api project(':ProposedUtils') - helpPath project(path: ':Base', configuration: 'helpPath') - helpPath project(path: ':Decompiler', configuration: 'helpPath') - helpPath project(path: ':ProgramDiff', configuration: 'helpPath') - testImplementation project(path: ':Base', configuration: 'testArtifacts') testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts') testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts') diff --git a/Ghidra/Extensions/MachineLearning/build.gradle b/Ghidra/Extensions/MachineLearning/build.gradle index 0305c9117d..caaa610a7d 100644 --- a/Ghidra/Extensions/MachineLearning/build.gradle +++ b/Ghidra/Extensions/MachineLearning/build.gradle @@ -23,7 +23,6 @@ eclipse.project.name = 'Xtra MachineLearning' dependencies { api project(':Base') - helpPath project(path: ":Base", configuration: 'helpPath') api "com.oracle.labs.olcut:olcut-config-protobuf:5.2.0" //{exclude group: "com.google.protobuf", module: "protobuf-java"} api ("com.oracle.labs.olcut:olcut-core:5.2.0") {exclude group: "org.jline"} diff --git a/Ghidra/Features/Base/build.gradle b/Ghidra/Features/Base/build.gradle index d4cdd500a9..20d8b77242 100644 --- a/Ghidra/Features/Base/build.gradle +++ b/Ghidra/Features/Base/build.gradle @@ -61,7 +61,6 @@ dependencies { testImplementation project(path: ':Project', configuration: 'testArtifacts') testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') testImplementation project(path: ':DB', configuration: 'testArtifacts') - helpPath project(path: ':Docking', configuration: 'helpPath') // this module's help has links to Base help files javacc 'net.java.dev.javacc:javacc:5.0' } @@ -125,22 +124,29 @@ task buildJavacc { } // Note: this must happen before the standard buildHelp for Base -task generateExtraHelpFiles { +tasks.register('generateExtraHelpFiles') { group = 'private' description " Creates any extra help files for Base not covered by the standard build help system" - def rawTipsFile = file('src/main/resources/ghidra/app/plugin/core/totd/tips.txt') + def rawTipsFile = file('src/main/resources/ghidra/app/plugin/core/totd/tips.txt') inputs.file(rawTipsFile) - def htmlTipsFile = file('src/main/help/help/topics/Misc/Tips.htm') + def htmlTipsFile = file('build/help/main/help/topics/Misc/Tips.htm') outputs.file(htmlTipsFile) - doLast { + doLast { createTipsHelpFile(rawTipsFile, htmlTipsFile) } } +// Base's help includes the file generated by the 'generateExtraHelpFiles' task. Signal that we +// depend on that task and it's output file. +tasks.named('buildHelp') { + dependsOn(tasks.named('generateExtraHelpFiles')) + inputs.files tasks.named('generateExtraHelpFiles').get().outputs +} + def createTipsHelpFile(input, output) { // transform original contents - wrap each line in
  • tags def buffy = new StringBuilder() @@ -169,7 +175,7 @@ def createTipsHelpFile(input, output) { output.text = htmlContent - println '\n\n\nwrote file ' + output + '\n\n\n' + logger.info '\n\n\nwrote file ' + output + '\n\n\n' } diff --git a/Ghidra/Features/BytePatterns/build.gradle b/Ghidra/Features/BytePatterns/build.gradle index 923e3b0d14..08bfe86de3 100644 --- a/Ghidra/Features/BytePatterns/build.gradle +++ b/Ghidra/Features/BytePatterns/build.gradle @@ -24,8 +24,5 @@ eclipse.project.name = 'Features BytePatterns' dependencies { api project(':Base') - api project(':Utility') - - helpPath project(path: ":Base", configuration: 'helpPath') - + api project(':Utility') } diff --git a/Ghidra/Features/ByteViewer/build.gradle b/Ghidra/Features/ByteViewer/build.gradle index a5a9b62913..dec49659a3 100644 --- a/Ghidra/Features/ByteViewer/build.gradle +++ b/Ghidra/Features/ByteViewer/build.gradle @@ -26,6 +26,4 @@ dependencies { api project(':Base') testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') - - helpPath project(path: ':Base', configuration: 'helpPath') // this module's help has links to Base help files } diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index a7c3c61af4..db7ca6b223 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -32,8 +32,6 @@ dependencies { // include Base src/test/resources when running decompiler integration tests (uses defaultTools) integrationTestImplementation project(path: ':Base', configuration: 'testArtifacts') integrationTestImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') - - helpPath project(path: ":Base", configuration: 'helpPath') } // Include buildable native source in distribution diff --git a/Ghidra/Features/FileFormats/build.gradle b/Ghidra/Features/FileFormats/build.gradle index d08615ec53..fb3b46febb 100644 --- a/Ghidra/Features/FileFormats/build.gradle +++ b/Ghidra/Features/FileFormats/build.gradle @@ -47,8 +47,6 @@ dependencies { api 'net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01' runtimeOnly 'net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01' - helpPath project(path: ":Base", configuration: 'helpPath') - // include code from src/test/slow in Base testImplementation project(path: ':Base', configuration: 'integrationTestArtifacts') } diff --git a/Ghidra/Features/FunctionGraph/build.gradle b/Ghidra/Features/FunctionGraph/build.gradle index c85d2dd912..ed32cfb512 100644 --- a/Ghidra/Features/FunctionGraph/build.gradle +++ b/Ghidra/Features/FunctionGraph/build.gradle @@ -22,15 +22,9 @@ apply plugin: 'eclipse' eclipse.project.name = 'Features Graph FunctionGraph' - - dependencies { - api project(":Base") - api project(":GraphServices") - - helpPath project(path: ":Base", configuration: 'helpPath') } diff --git a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html index e052020152..2ea00b278f 100644 --- a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html +++ b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html @@ -770,10 +770,6 @@ mouse scroll wheel. Disabling this option restores the original function graph scroll wheel behavior of zooming when scrolled.

    -

    The Start Fully Zoomed Out option causes the initial graph to zoom out far enough - that the entire graph is displayed. When this option is off a new graph rendering will zoom - all the way in (no scaling) to the active vertex.

    -

    The Update Vertex Colors When Grouping option signals to the graph to make the color of the grouped vertex be that of the vertices being grouped.

    diff --git a/Ghidra/Features/FunctionID/build.gradle b/Ghidra/Features/FunctionID/build.gradle index d8f26e7e2f..73471b1c3d 100644 --- a/Ghidra/Features/FunctionID/build.gradle +++ b/Ghidra/Features/FunctionID/build.gradle @@ -26,9 +26,7 @@ eclipse.project.name = 'Features FunctionID' dependencies { api project(":Base") api project(":DB") - api project(":SoftwareModeling") - helpPath project(path: ":Base", configuration: 'helpPath') - + api project(":SoftwareModeling") } // All *.fidb files located in the dependencies/fid directory OR the diff --git a/Ghidra/Features/GraphFunctionCalls/build.gradle b/Ghidra/Features/GraphFunctionCalls/build.gradle index 8a941be103..f455f99652 100644 --- a/Ghidra/Features/GraphFunctionCalls/build.gradle +++ b/Ghidra/Features/GraphFunctionCalls/build.gradle @@ -26,14 +26,7 @@ eclipse.project.name = 'Features Graph FunctionCalls' // Note: this module's name is 'GraphFunctionCalls' dependencies { api project(":Base") - - helpPath project(path: ":Base", configuration: 'helpPath') - - // This is needed now because we like to the help of the FunctionGraph. If and when that - // help is extracted to a higher-level help page, like 'Graphing', then this link should be - // removed - helpPath project(path: ":FunctionGraph", configuration: 'helpPath') - + // These have abstract test classes and stubs needed by this module testImplementation project(path: ':Project', configuration: 'testArtifacts') testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') diff --git a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/topics/FunctionCallGraphPlugin/Function_Call_Graph.html b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/topics/FunctionCallGraphPlugin/Function_Call_Graph.html index 65f61c7826..bd40e55ce7 100644 --- a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/topics/FunctionCallGraphPlugin/Function_Call_Graph.html +++ b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/topics/FunctionCallGraphPlugin/Function_Call_Graph.html @@ -226,20 +226,88 @@

    Satellite View

    -

    The Satellite View works exactly as the - - Function Graph's Satellite View. -

    -
    +

    The Satellite View provides an overview of the graph. From this view you may also perform + basic adjustment of the overall graph location. In addition to the complete graph, the + satellite view contains a lens (the white rectangle) that indicates how much of the + current graph fits into the primary view.

    + +

    When you single left mouse click in the satellite view the graph is centered around the + corresponding point in the primary view. Alternatively, you may drag the lens of the + satellite view to the desired location by performing a mouse drag operation on the lens.

    + +

    You may hide the satellite view by right-clicking anywhere in the Primary View and + deselecting the Display Satellite View toggle button from the popup menu.

    + +
    +

    If the Primary View is painting + sluggishly, then hiding the Satellite View cause the Primary View to be more + responsive.

    +
    + +

    Detached Satellite

    + +
    +

    The Satellite View is attached, or docked, to the Primary View by default. + However, you can detach, or undock, the Satellite View, which will put the view into a + Component Provider, which itself can be moved, resized and docked anywhere in the Tool you + wish.

    + +

    To undock the Satellite View, right-click in the graph and deselect the Dock + Satellite View menu item.

    + +

    To re-dock the Satellite View, right-click in the graph and select the Dock Satellite + View menu item.

    +
    + +
    +

    To reshow the Satellite View if it is + hidden, whether docked or undocked, you can press the button. This button is in the lower-right + hand corner of the graph and is only visible if the Satellite View is hidden or + undocked.

    +
    +

    Options

    -

    The Function Call Graph options are currently a subset of the - - Function Graph's Options. -

    -
    + +

    The Scroll Wheel Pans option signals to move the graph vertical when scrolling the + mouse scroll wheel. Disabling this option restores the original function graph scroll wheel + behavior of zooming when scrolled.

    + +

    The Use Animation option signals to the graph whether to animate mutative graph + operations and navigations.

    + +

    The Use Condensed Layout option signals to the + graph to bring vertices as close together as possible when laying out the graph. Using this + option to fit as many vertices on the screen as possible. Disable this option to make the + overall layout of the graph more aesthetic.

    + +

    The Use Mouse-relative Zoom option signals zoom the graph to and from the mouse + location when zooming from the middle-mouse. The default for this option is off, which + triggers zoom to work from the center of the graph, regardless of the mouse location.

    + +

    The View Settings option describes how the graph will be zoomed when it is first + loaded. The values are:

    + + +
    +
    + +

    There are various edge color and highlight color options available to change. The + highlight colors are those to be used when the flow animations take place.

    + + diff --git a/Ghidra/Features/GraphServices/build.gradle b/Ghidra/Features/GraphServices/build.gradle index cd019a0b31..38dcd74452 100644 --- a/Ghidra/Features/GraphServices/build.gradle +++ b/Ghidra/Features/GraphServices/build.gradle @@ -36,8 +36,5 @@ dependencies { api ("org.jgrapht:jgrapht-io:1.5.1") { exclude group: "org.antlr", module: "antlr4-runtime" } runtimeOnly "org.jheaps:jheaps:0.13" - - helpPath project(path: ":Base", configuration: 'helpPath') - } diff --git a/Ghidra/Features/PDB/build.gradle b/Ghidra/Features/PDB/build.gradle index 2e4a66fd07..58c4aef6d9 100644 --- a/Ghidra/Features/PDB/build.gradle +++ b/Ghidra/Features/PDB/build.gradle @@ -33,8 +33,7 @@ dependencies { // Demangler Analyzer needs to find MicrosoftDemangler api project(":MicrosoftDemangler") - helpPath project(path: ':Base', configuration: 'helpPath') // this module's help has links to Base help files - + testImplementation project(path: ':Base', configuration: 'testArtifacts') testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') } diff --git a/Ghidra/Features/ProgramDiff/build.gradle b/Ghidra/Features/ProgramDiff/build.gradle index f3f9f6c152..15f32fdbd0 100644 --- a/Ghidra/Features/ProgramDiff/build.gradle +++ b/Ghidra/Features/ProgramDiff/build.gradle @@ -25,6 +25,4 @@ eclipse.project.name = 'Features ProgramDiff' dependencies { api project(":Base") - helpPath project(path: ":Base", configuration: 'helpPath') - } diff --git a/Ghidra/Features/ProgramGraph/build.gradle b/Ghidra/Features/ProgramGraph/build.gradle index 58757b5c2d..8e5af7fc80 100644 --- a/Ghidra/Features/ProgramGraph/build.gradle +++ b/Ghidra/Features/ProgramGraph/build.gradle @@ -25,9 +25,6 @@ eclipse.project.name = 'Features Graph ProgramGraph' dependencies { api project(":Base") - - helpPath project(path: ":Base", configuration: 'helpPath') - helpPath project(path: ":GraphServices", configuration: 'helpPath') - + api project(":GraphServices") } diff --git a/Ghidra/Features/ProgramGraph/src/main/help/help/topics/ProgramGraphPlugin/ProgramGraph.htm b/Ghidra/Features/ProgramGraph/src/main/help/help/topics/ProgramGraphPlugin/ProgramGraph.htm index a8e3fce42b..ed5570b7f1 100644 --- a/Ghidra/Features/ProgramGraph/src/main/help/help/topics/ProgramGraphPlugin/ProgramGraph.htm +++ b/Ghidra/Features/ProgramGraph/src/main/help/help/topics/ProgramGraphPlugin/ProgramGraph.htm @@ -495,8 +495,7 @@

    These are the display options for graphs that are types of "Program Graphs" such as Call graphs, Block graphs, etc. These types of graphs use program elements as vertices and reference types as edges. See - Graph Type Display Options for - general help on graph type display options.

    + Graph Type Display Options for general help on graph type display options.

    Provided by: Program Graph Plugin

    diff --git a/Ghidra/Features/Python/build.gradle b/Ghidra/Features/Python/build.gradle index 6987fa8f47..32abc8a940 100644 --- a/Ghidra/Features/Python/build.gradle +++ b/Ghidra/Features/Python/build.gradle @@ -33,8 +33,7 @@ configurations { dependencies { api project(':Base') - helpPath project(path: ":Base", configuration: "helpPath") - jython JYTHON + jython JYTHON api JYTHON } diff --git a/Ghidra/Features/SourceCodeLookup/build.gradle b/Ghidra/Features/SourceCodeLookup/build.gradle index f361d43f7e..bd231f9257 100644 --- a/Ghidra/Features/SourceCodeLookup/build.gradle +++ b/Ghidra/Features/SourceCodeLookup/build.gradle @@ -25,5 +25,4 @@ eclipse.project.name = 'Features SourceCodeLookup' dependencies { api project(":Base") api project(":Decompiler") - helpPath project(path: ":Decompiler", configuration: 'helpPath') } diff --git a/Ghidra/Features/VersionTracking/build.gradle b/Ghidra/Features/VersionTracking/build.gradle index 58554eef85..9c7e973a3e 100644 --- a/Ghidra/Features/VersionTracking/build.gradle +++ b/Ghidra/Features/VersionTracking/build.gradle @@ -27,8 +27,6 @@ project.ext.excludeFromParallelIntegrationTests = true dependencies { api project(":Base") - helpPath project(path: ":Base", configuration: "helpPath") - testImplementation project(path: ':Project', configuration: 'testArtifacts') testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') } diff --git a/Ghidra/Framework/Help/build.gradle b/Ghidra/Framework/Help/build.gradle index e62b9f8d71..ba6960c375 100644 --- a/Ghidra/Framework/Help/build.gradle +++ b/Ghidra/Framework/Help/build.gradle @@ -30,6 +30,4 @@ dependencies { // Only include this debug version of the jh library if necessary. //api name:'jh2.with.debug' api 'javax.help:javahelp:2.0.05' - - } diff --git a/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java b/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java index 9ea3447e66..c343bdc3bb 100644 --- a/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java +++ b/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java @@ -357,17 +357,6 @@ public class GHelpBuilder { errorMessage(buffy.toString()); } - private static void warningMessage(String... message) { - StringBuilder buffy = new StringBuilder(); - buffy.append("\n"); - buffy.append(" !!!!! WARNING !!!!!\n"); - for (String string : message) { - buffy.append('\t').append('\t').append(string).append('\n'); - } - buffy.append("\n"); - errorMessage(buffy.toString()); - } - private static void printErrorMessage(String message) { // this prevents error messages getting interspersed with output messages flush(); diff --git a/Ghidra/Framework/Help/src/main/java/help/HelpBuildUtils.java b/Ghidra/Framework/Help/src/main/java/help/HelpBuildUtils.java index 56f4a6f429..58efa2c0be 100644 --- a/Ghidra/Framework/Help/src/main/java/help/HelpBuildUtils.java +++ b/Ghidra/Framework/Help/src/main/java/help/HelpBuildUtils.java @@ -68,7 +68,11 @@ public class HelpBuildUtils { return new DirectoryHelpModuleLocation(file); } else if (file.isFile()) { - return new JarHelpModuleLocation(file); + JarHelpModuleLocation jarLocation = JarHelpModuleLocation.fromFile(file); + if (jarLocation == null) { + HelpBuildUtils.debug("Jar file does not contain help: " + file); + } + return jarLocation; } throw new IllegalArgumentException( "Don't know how to create a help module location for file: " + file); diff --git a/Ghidra/Framework/Help/src/main/java/help/JavaHelpFilesBuilder.java b/Ghidra/Framework/Help/src/main/java/help/JavaHelpFilesBuilder.java index e07e1e540e..d57f8c007e 100644 --- a/Ghidra/Framework/Help/src/main/java/help/JavaHelpFilesBuilder.java +++ b/Ghidra/Framework/Help/src/main/java/help/JavaHelpFilesBuilder.java @@ -15,16 +15,16 @@ */ package help; +import java.io.*; +import java.nio.file.*; +import java.util.*; + import ghidra.util.exception.AssertException; import help.validator.LinkDatabase; import help.validator.location.HelpModuleCollection; import help.validator.model.AnchorDefinition; import help.validator.model.GhidraTOCFile; -import java.io.*; -import java.nio.file.*; -import java.util.*; - /** * This class: *