diff --git a/Ghidra/Debug/Debugger-gadp/build.gradle b/Ghidra/Debug/Debugger-gadp/build.gradle index 248542d00e..86185f5b42 100644 --- a/Ghidra/Debug/Debugger-gadp/build.gradle +++ b/Ghidra/Debug/Debugger-gadp/build.gradle @@ -94,3 +94,5 @@ sourceSets { } } } +zipSourceSubproject.dependsOn generateProto + diff --git a/Ghidra/Features/Base/build.gradle b/Ghidra/Features/Base/build.gradle index f8fbfd252f..47d2746757 100644 --- a/Ghidra/Features/Base/build.gradle +++ b/Ghidra/Features/Base/build.gradle @@ -18,10 +18,15 @@ apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/helpProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Features Base' + +rootProject.createJavadocs.exclude '**/ghidra/app/plugin/core/**' +rootProject.createJsondocs.exclude '**/ghidra/app/plugin/core/**' + /* This build file is a bit different than most project build files, as it initializes tools needed for the system to compile some of the code. Also, this module has @@ -174,3 +179,7 @@ rootProject.prepDev.dependsOn buildJavacc // 'indexHelp' is defined in the buildHelp.gradle 'script plugin' indexHelp.dependsOn generateExtraHelpFiles + +zipSourceSubproject.dependsOn buildCPPParser +zipSourceSubproject.dependsOn buildCParser + diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index 12eea15bec..6f46538159 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -19,6 +19,8 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" apply from: "$rootProject.projectDir/gradle/nativeProject.gradle" apply from: "$rootProject.projectDir/gradle/helpProject.gradle" apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" + apply plugin: 'eclipse' eclipse.project.name = 'Features Decompiler' diff --git a/Ghidra/Features/Python/build.gradle b/Ghidra/Features/Python/build.gradle index f042afd3f0..ab0e74d087 100644 --- a/Ghidra/Features/Python/build.gradle +++ b/Ghidra/Features/Python/build.gradle @@ -18,6 +18,7 @@ apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/helpProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Features Python' diff --git a/Ghidra/Framework/DB/build.gradle b/Ghidra/Framework/DB/build.gradle index 59d0575b0b..6f0186737f 100644 --- a/Ghidra/Framework/DB/build.gradle +++ b/Ghidra/Framework/DB/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework DB' diff --git a/Ghidra/Framework/Docking/build.gradle b/Ghidra/Framework/Docking/build.gradle index ae2a4525c1..233e2ba577 100644 --- a/Ghidra/Framework/Docking/build.gradle +++ b/Ghidra/Framework/Docking/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Docking' diff --git a/Ghidra/Framework/FileSystem/build.gradle b/Ghidra/Framework/FileSystem/build.gradle index ad15b86330..56e98c9b31 100644 --- a/Ghidra/Framework/FileSystem/build.gradle +++ b/Ghidra/Framework/FileSystem/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework FileSystem' diff --git a/Ghidra/Framework/Generic/build.gradle b/Ghidra/Framework/Generic/build.gradle index 8198e578cb..27ff746e1b 100644 --- a/Ghidra/Framework/Generic/build.gradle +++ b/Ghidra/Framework/Generic/build.gradle @@ -19,6 +19,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Generic' @@ -45,3 +46,4 @@ ext.addExports([ 'java.base/sun.security.util=ALL-UNNAMED', 'java.desktop/sun.awt=ALL-UNNAMED' ]) + diff --git a/Ghidra/Framework/Graph/build.gradle b/Ghidra/Framework/Graph/build.gradle index a0372fe667..e35ba7b4b9 100644 --- a/Ghidra/Framework/Graph/build.gradle +++ b/Ghidra/Framework/Graph/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Graph' diff --git a/Ghidra/Framework/Help/build.gradle b/Ghidra/Framework/Help/build.gradle index cfe24fe559..9f9785185e 100644 --- a/Ghidra/Framework/Help/build.gradle +++ b/Ghidra/Framework/Help/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Help' diff --git a/Ghidra/Framework/Project/build.gradle b/Ghidra/Framework/Project/build.gradle index 96f5cf9456..2411541a76 100644 --- a/Ghidra/Framework/Project/build.gradle +++ b/Ghidra/Framework/Project/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Project' diff --git a/Ghidra/Framework/SoftwareModeling/build.gradle b/Ghidra/Framework/SoftwareModeling/build.gradle index b94c5ce7c3..f59c866513 100644 --- a/Ghidra/Framework/SoftwareModeling/build.gradle +++ b/Ghidra/Framework/SoftwareModeling/build.gradle @@ -17,12 +17,16 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework SoftwareModeling' apply plugin: 'antlr' +rootProject.createJavadocs.exclude '**/pcodeCPort/**' +rootProject.createJsondocs.exclude '**/pcodeCPort/**' + // make sure antlr code gets built during prepdev so that the directories are created and // eclipse doesn't complain about missing src directories. rootProject.prepDev.dependsOn compileJava @@ -103,3 +107,5 @@ generateGrammarSource { } } } +// must generate grammar before zipping if we want to include it in the source zip +zipSourceSubproject.dependsOn generateGrammarSource diff --git a/Ghidra/Framework/Utility/build.gradle b/Ghidra/Framework/Utility/build.gradle index 8c93d86ce6..a572882b37 100644 --- a/Ghidra/Framework/Utility/build.gradle +++ b/Ghidra/Framework/Utility/build.gradle @@ -17,6 +17,7 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" +apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework Utility' diff --git a/gradle/javadoc.gradle b/gradle/javadoc.gradle new file mode 100644 index 0000000000..4788748306 --- /dev/null +++ b/gradle/javadoc.gradle @@ -0,0 +1,30 @@ +/* ### + * IP: GHIDRA + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/***************************************************************************************** + This file is a "mix-in" gradle script that individual gradle projects should include if they + have java code and want javadocs generated for that project + + A gradle project can add javadoc support by including the following to its build.gradle file: + apply from: "$rootProject.projectDir/gradle/javadoc.gradle" + *****************************************************************************************/ + +rootProject.createJavadocs { + source sourceSets.main.allJava +} + +rootProject.createJsondocs { + source sourceSets.main.allJava +} diff --git a/gradle/root/distribution.gradle b/gradle/root/distribution.gradle index a1eebd064f..867fb85ee3 100644 --- a/gradle/root/distribution.gradle +++ b/gradle/root/distribution.gradle @@ -46,17 +46,6 @@ if (extensionsList.isFile()) { } } -FileTree javadocFiles = fileTree (rootProject.projectDir.toString()) { - include '**/Framework/**/*.java' - include '**/Features/Base/src/main/java/**/*.java' - exclude '**/Features/Base/src/main/java/ghidra/app/plugin/**/*.java'; - include '**/Features/Decompiler/src/main/java/ghidra/app/decompiler/**/*.java' - include '**/Features/Python/**/*.java' - exclude '**/GhidraBuild/**/*.java'; - exclude '**/src/test/**' - exclude '**/src/test.slow/**' - exclude '**/pcodeCPort/**' // not intended for general consumption -} ext.ghidraPath = files() /******************************************************************************** @@ -122,12 +111,14 @@ task createJavadocs(type: Javadoc, description: 'Generate javadocs for all proje destinationDir file(rootProject.projectDir.toString() + "/build/tmp/javadoc") failOnError false + + // the "source" property must be set in individual project's build.gradle files. + // projects that want to be included in the Jsondocs should add the following to + // their build.gradle file: + // + // apply from: "$rootProject.projectDir/gradle/javadoc.gradle" + // - // Here for reference. If we want to turn on javadoc for all source files, uncomment - // the following line (and comment out the next one): - // source subprojects.collect { it.sourceSets.main.allJava } - source javadocFiles - // Must add classpath for main and test source sets. Javadoc will fail if it cannot // find referenced classes. classpath = rootProject.ext.ghidraPath @@ -170,6 +161,7 @@ configurations { dependencies { jsondoc project('JsonDoclet') } + task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all projects', group: 'Documentation') { @@ -181,15 +173,19 @@ task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all proj failOnError false - // Here for reference. If we want to turn on javadoc for all source files, uncomment - // the following line (and comment out the next one): - // source subprojects.collect { it.sourceSets.main.allJava } - source javadocFiles // Must add classpath for main and test source sets. Javadoc will fail if it cannot // find referenced classes. classpath = rootProject.ext.ghidraPath + // the "source" property must be set in individual project's build.gradle files. + // projects that want to be included in the Jsondocs should add the following to + // their build.gradle file: + // + // apply from: "$rootProject.projectDir/gradle/javadoc.gradle" + // + + // Generate at package level because user may try to get help directly on an object they have // rather than its public interface. options.addBooleanOption("package", true)