mirror of
https://github.com/google/nomulus
synced 2026-02-05 04:21:07 +00:00
Migrate the documentation package to Java 11 (#729)
* Migrate the documentation package to Java 11 The old Doclet API is deprected and removed in Java 12. This commit changes the documentation package to use the new recommended API. However it is not a drop-in replacement and there are non-idiomatic usages all over the place. I think it is eaiser to keep the current code logic and kind of shoehorn in the new API than starting afresh as the return on investment of a do-over is not great. Also note that the docs package is disabled as of this commit because we are still using Java 8 to compile which lacks the new API. Once we switch our toolchains to Java 11 (but still compiling Java 8 bytecode) we can re-enable this package. TESTED=ran `./gradlew :docs:test` locally with the documentation package enabled.
This commit is contained in:
@@ -27,19 +27,22 @@ import java.io.IOException;
|
||||
/**
|
||||
* Tool to generate documentation for the EPP flows and corresponding external API.
|
||||
*
|
||||
* <p>Mostly responsible for producing standalone documentation files (HTML
|
||||
* and Markdown) from flow information objects; those call into javadoc to
|
||||
* extract documentation information from the flows package source files.
|
||||
* See the {@link FlowDocumentation} class for more details.
|
||||
* <p>Mostly responsible for producing standalone documentation files (HTML and Markdown) from flow
|
||||
* information objects; those call into javadoc to extract documentation information from the flows
|
||||
* package source files. See the {@link FlowDocumentation} class for more details.
|
||||
*/
|
||||
@Parameters(separators = " =", commandDescription = "Tool to generate EPP API documentation")
|
||||
public class FlowDocumentationTool {
|
||||
|
||||
@Parameter(names = {"-o", "--output_file"},
|
||||
@Parameter(
|
||||
names = {"-o", "--output_file"},
|
||||
description = "file where generated documentation will be written (use '-' for stdout)")
|
||||
private String outputFileName;
|
||||
|
||||
@Parameter(names = {"--help", "--helpshort"}, description = "print this help", help = true)
|
||||
@Parameter(
|
||||
names = {"--help", "--helpshort"},
|
||||
description = "print this help",
|
||||
help = true)
|
||||
private boolean displayHelp = false;
|
||||
|
||||
/** Parses command line flags and then runs the documentation tool. */
|
||||
@@ -68,7 +71,7 @@ public class FlowDocumentationTool {
|
||||
DocumentationGenerator docGenerator;
|
||||
try {
|
||||
docGenerator = new DocumentationGenerator();
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("IO error while running Javadoc tool", e);
|
||||
}
|
||||
String output = docGenerator.generateMarkdown();
|
||||
@@ -76,7 +79,7 @@ public class FlowDocumentationTool {
|
||||
System.out.println(output);
|
||||
} else {
|
||||
if (outputFileName == null) {
|
||||
outputFileName = "doclet.html";
|
||||
outputFileName = "doclet.md";
|
||||
}
|
||||
try {
|
||||
Files.asCharSink(new File(outputFileName), UTF_8).write(output);
|
||||
@@ -86,5 +89,3 @@ public class FlowDocumentationTool {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user