Skip to content

Commit

Permalink
GP-3430 - Updated the gradle buildHelp task to better handle its inpu…
Browse files Browse the repository at this point in the history
…ts up-do-date state
  • Loading branch information
dragonmacher committed Jun 6, 2023
1 parent 0d71657 commit a7668c7
Show file tree
Hide file tree
Showing 32 changed files with 679 additions and 255 deletions.
2 changes: 1 addition & 1 deletion Ghidra/Debug/Debugger-swig-lldb/buildNatives.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions Ghidra/Debug/Debugger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 0 additions & 1 deletion Ghidra/Extensions/MachineLearning/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
18 changes: 12 additions & 6 deletions Ghidra/Features/Base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down Expand Up @@ -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 <li> tags
def buffy = new StringBuilder()
Expand Down Expand Up @@ -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'
}


Expand Down
5 changes: 1 addition & 4 deletions Ghidra/Features/BytePatterns/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
2 changes: 0 additions & 2 deletions Ghidra/Features/ByteViewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 0 additions & 2 deletions Ghidra/Features/Decompiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Ghidra/Features/FileFormats/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
6 changes: 0 additions & 6 deletions Ghidra/Features/FunctionGraph/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}


Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,6 @@ <H2><A name="Options"></A>Function Graph Options</H2>
mouse scroll wheel. Disabling this option restores the original function graph scroll wheel
behavior of zooming when scrolled.</P>

<P>The <B>Start Fully Zoomed Out</B> 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.</P>

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

Expand Down
4 changes: 1 addition & 3 deletions Ghidra/Features/FunctionID/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions Ghidra/Features/GraphFunctionCalls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,88 @@ <H3><A NAME="Graph_Node_Function_Calls"></A>Graph '<I>Function Name</I>'</H3>
<H2><A name="Satellite_View"></A>Satellite View</H2>

<BLOCKQUOTE>
<P>The Satellite View works exactly as the
<A href="help/topics/FunctionGraphPlugin/Function_Graph.html#Satellite_View">
Function Graph's Satellite View</A>.
</P>
</BLOCKQUOTE>
<P>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 <B>lens</B> (the white rectangle) that indicates how much of the
current graph fits into the primary view.</P>

<P>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.</P>

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

<BLOCKQUOTE>
<P><IMG src="help/shared/tip.png" alt="" border="0"> If the Primary View is painting
sluggishly, then hiding the Satellite View cause the Primary View to be more
responsive.</P>
</BLOCKQUOTE>

<H3><A name="Satellite_View_Dock"></A>Detached Satellite</H3>

<BLOCKQUOTE>
<P>The Satellite View is attached, or <B>docked</B>, 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.</P>

<P>To undock the Satellite View, right-click in the graph and deselect the <B>Dock
Satellite View</B> menu item.</P>

<P>To re-dock the Satellite View, right-click in the graph and select the <B>Dock Satellite
View</B> menu item.</P>
</BLOCKQUOTE>

<BLOCKQUOTE>
<P><IMG src="help/shared/tip.png" alt="" border="0"> To reshow the Satellite View if it is
hidden, whether docked or undocked, you can press the <IMG src=
"images/network-wireless.png" alt="" border="1"> 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.</P>
</BLOCKQUOTE>
</BLOCKQUOTE>

<H2><A name="Options"></A>Options</H2>

<BLOCKQUOTE>
<P>The Function Call Graph options are currently a subset of the
<A href="help/topics/FunctionGraphPlugin/Function_Graph.html#Options">
Function Graph's Options</A>.
</P>
</BLOCKQUOTE>

<P>The <B>Scroll Wheel Pans</B> 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.</P>

<P>The <B>Use Animation</B> option signals to the graph whether to animate mutative graph
operations and navigations.</P>

<P><A name="Layout_Compressing"></A>The <B>Use Condensed Layout</B> 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.</P>

<P>The <B>Use Mouse-relative Zoom</B> 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.</P>

<P>The <B>View Settings</B> option describes how the graph will be zoomed when it is first
loaded. The values are:</P>

<UL>
<LI><B>Start Fully Zoomed Out</B> - always start fully zoomed out so that the entire
graph can be seen.</LI>

<LI><B>Start Fully Zoomed In</B> - always start fully zoomed in on the vertex containing
the current location.</LI>

<LI><B>Remember User Settings</B> - keep the zoom level where the user previously left
it.</LI>
</UL>
<BR>
<BR>

<P>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.</P>
</BLOCKQUOTE>



</BLOCKQUOTE>
Expand Down
3 changes: 0 additions & 3 deletions Ghidra/Features/GraphServices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')

}

3 changes: 1 addition & 2 deletions Ghidra/Features/PDB/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
2 changes: 0 additions & 2 deletions Ghidra/Features/ProgramDiff/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ eclipse.project.name = 'Features ProgramDiff'

dependencies {
api project(":Base")
helpPath project(path: ":Base", configuration: 'helpPath')

}
5 changes: 1 addition & 4 deletions Ghidra/Features/ProgramGraph/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ <H2><A NAME="Program_Graphs_Display_Options">Program Graphs Display Options</H2>
<P>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
<A href="help/topics/GraphServices/GraphDisplay.htm#Graph_Type_Display_Options">Graph Type Display Options</A> for
general help on graph type display options.</P>
<B>Graph Type Display Options</B> for general help on graph type display options.</P>
</BLOCKQUOTE>
<P class="providedbyplugin">Provided by: <I>Program Graph Plugin</I></P>

Expand Down
3 changes: 1 addition & 2 deletions Ghidra/Features/Python/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ configurations {

dependencies {
api project(':Base')
helpPath project(path: ":Base", configuration: "helpPath")
jython JYTHON
jython JYTHON
api JYTHON
}

Expand Down
1 change: 0 additions & 1 deletion Ghidra/Features/SourceCodeLookup/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ eclipse.project.name = 'Features SourceCodeLookup'
dependencies {
api project(":Base")
api project(":Decompiler")
helpPath project(path: ":Decompiler", configuration: 'helpPath')
}
2 changes: 0 additions & 2 deletions Ghidra/Features/VersionTracking/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
2 changes: 0 additions & 2 deletions Ghidra/Framework/Help/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'


}
11 changes: 0 additions & 11 deletions Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,6 @@ private static void printUsage() {
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();
Expand Down
6 changes: 5 additions & 1 deletion Ghidra/Framework/Help/src/main/java/help/HelpBuildUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public static HelpModuleLocation toLocation(File file) {
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);
Expand Down
Loading

0 comments on commit a7668c7

Please sign in to comment.