GP-5819 - Help - Added validation code to check all Ghidra TOC files after help is built

This commit is contained in:
dragonmacher
2025-07-21 11:59:01 -04:00
parent 8c56fc8e04
commit 17c28209ef
23 changed files with 427 additions and 155 deletions

View File

@@ -197,14 +197,14 @@ def getModuleResourcesDirs(Collection<File> fullClasspath) {
.findAll(dir -> dir.exists())
}
// Locatates 'buildHelp' tasks in projects that this project depends on. The output of the tasks
// is the module's help jar, which is only used to build help and not in the final release. The
// jar file names follow this format: <Module>-help.jar.
// Locates 'buildModuleHelp' tasks in projects that this project depends on. The output of the
// tasks is the module's help jar, which is only used to build help and not in the final release.
// The jar file names follow this format: <Module>-help.jar.
def getDependentProjectHelpTasks(Collection<File> fullClasspath) {
def myModules = getMyModules(fullClasspath)
def myProjects = filterProjectsBy(myModules)
return myProjects.collect(p -> p.tasks.findByPath('buildHelp'))
return myProjects.collect(p -> p.tasks.findByPath('buildModuleHelp'))
.findAll(t -> t != null)
}
@@ -313,6 +313,8 @@ tasks.register('buildGlobalMarkdown') {
}
}
// Task for building Ghidra help files
// - depends on the output from the help indexer
// - validates help
@@ -376,7 +378,7 @@ tasks.register('buildHelpFiles', JavaExec) {
//
// The classpath needs to include items used by internal Java code to validate help
// resources:
// 1) The jar path of each dependent Module. The jar file will be on the 'main' runtime
// 1) The jar path of each depended upon Module. The jar file will be on the 'main' runtime
// classpath, but may not yet exist. Regardless, the Java code will use the path to
// locate the module for that path.
// 2) Each module's 'src/main/resources' dir (this is needed when the jar files from 1
@@ -395,7 +397,7 @@ tasks.register('buildHelpFiles', JavaExec) {
// To build help, the validator needs any other help content that this module may reference.
// Add each of these dependencies as an argument to the validator.
// The dependency file is the <Module>-help.jar file from the 'buildHelp' tasks upon which
// The dependency file is <Module>-help.jar from the 'buildModuleHelp' tasks upon which
// we depend.
def buildHelpTasks = getDependentProjectHelpTasks(sourceSets.main.runtimeClasspath.files)
buildHelpTasks.each {
@@ -423,7 +425,7 @@ tasks.register('buildHelpFiles', JavaExec) {
* this jar is <Module>-help.jar. This is in contrast to each module's jar which itself contains
* all help needed in production. The module's jar filename is <Module>.jar.
*/
tasks.register('buildHelp', Jar) {
tasks.register('buildModuleHelp', Jar) {
group = rootProject.GHIDRA_GROUP
description = " Builds the help for this module. [gradle/helpProject.gradle]\n"
@@ -473,11 +475,11 @@ jar {
}
// build the help whenever this module's jar file is built
processResources.dependsOn buildHelp
jar.dependsOn buildHelp
processResources.dependsOn buildModuleHelp
jar.dependsOn buildModuleHelp
// make sure generated help directories exist during prepdev so that the directories are created and
// eclipse doesn't complain about missing src directories.
rootProject.prepDev.dependsOn buildHelp
rootProject.prepDev.dependsOn buildModuleHelp

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,8 +27,8 @@ GHIDRA GRADLE
be run against a specific module. For example:
from root project, "gradle buildHelp" builds help for all modules.
from root project, "gradle :Base:buildHelp" builds help for the "Base" module
from the Base project dir, "gradle buildHelp" builds help for the "Base" module
from root project, "gradle :Base:buildModuleHelp" builds help for the "Base" module
from the Base project dir, "gradle buildModuleHelp" builds help for the "Base" module
Primary gradle tasks for Ghidra