cherrypick I9edd6eab9ecb7e3b41c444e7e545702e855a5928
Add doclava flag 'referenceonly' to skip generating the HTML files.
Also add an override function in the template to allow a custom "docroot"
string in the override templates. (So we can set it to always be a web site.)
Change-Id: Iec2acadd6533d957fe5550b5e02e8a7ed68292c9
diff --git a/res/assets/templates/macros.cs b/res/assets/templates/macros.cs
index f561c50..e897cca 100644
--- a/res/assets/templates/macros.cs
+++ b/res/assets/templates/macros.cs
@@ -82,7 +82,11 @@
/each ?><?cs
/def ?>
-<?cs # Print a list of tags (e.g. description text ?><?cs
+<?cs def:doc_root_override()
+ ?><?cs var:toroot ?><?cs
+/def ?>
+
+<?cs # Print a list of tags (e.g. description text ?><?cs
def:tag_list(tags) ?><?cs
each:tag = tags ?><?cs
if:tag.name == "Text" ?><?cs var:tag.text?><?cs
@@ -105,7 +109,7 @@
elif:tag.kind == "@samplecode" ?><pre><?cs var:tag.text ?></pre><?cs
elif:tag.name == "@sample" ?><pre><?cs var:tag.text ?></pre><?cs
elif:tag.name == "@include" ?><?cs var:tag.text ?><?cs
- elif:tag.kind == "@docRoot" ?><?cs var:toroot ?><?cs
+ elif:tag.kind == "@docRoot" ?><?cs call:doc_root_override() ?><?cs
elif:tag.kind == "@sdkCurrent" ?><?cs var:sdk.current ?><?cs
elif:tag.kind == "@sdkCurrentVersion" ?><?cs var:sdk.version ?><?cs
elif:tag.kind == "@sdkCurrentRelId" ?><?cs var:sdk.rel.id ?><?cs
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 1b81ca1..32b9b81 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -99,6 +99,7 @@
public static boolean documentAnnotations = false;
public static String documentAnnotationsPath = null;
public static Map<String, String> annotationDocumentationMap = null;
+ public static boolean referenceOnly = false;
public static JSilver jSilver = null;
@@ -282,6 +283,8 @@
} else if (a[0].equals("-documentannotations")) {
documentAnnotations = true;
documentAnnotationsPath = a[1];
+ } else if (a[0].equals("-referenceonly")) {
+ referenceOnly = true;
}
}
@@ -332,26 +335,28 @@
TodoFile.writeTodoFile(todoFile);
}
- if (samplesRef) {
+ if (samplesRef) {
// always write samples without offlineMode behaviors
- writeSamples(false, sampleCodes, SORT_BY_NAV_GROUPS);
- }
-
- // HTML2 Pages -- Generate Pages from optional secondary dir
- if (!inputPathHtmlDir2.isEmpty()) {
- if (!outputPathHtmlDir2.isEmpty()) {
- ClearPage.outputDir = outputPathBase + "/" + outputPathHtmlDir2;
- }
- ClearPage.htmlDirs = inputPathHtmlDir2;
- writeHTMLPages();
- ClearPage.htmlDirs = inputPathHtmlDirs;
+ writeSamples(false, sampleCodes, SORT_BY_NAV_GROUPS);
}
- // HTML Pages
- if (!ClearPage.htmlDirs.isEmpty()) {
- ClearPage.htmlDirs = inputPathHtmlDirs;
- ClearPage.outputDir = outputPathHtmlDirs;
- writeHTMLPages();
+ if (!referenceOnly) {
+ // HTML2 Pages -- Generate Pages from optional secondary dir
+ if (!inputPathHtmlDir2.isEmpty()) {
+ if (!outputPathHtmlDir2.isEmpty()) {
+ ClearPage.outputDir = outputPathBase + "/" + outputPathHtmlDir2;
+ }
+ ClearPage.htmlDirs = inputPathHtmlDir2;
+ writeHTMLPages();
+ ClearPage.htmlDirs = inputPathHtmlDirs;
+ }
+
+ // HTML Pages
+ if (!ClearPage.htmlDirs.isEmpty()) {
+ ClearPage.htmlDirs = inputPathHtmlDirs;
+ ClearPage.outputDir = outputPathHtmlDirs;
+ writeHTMLPages();
+ }
}
writeAssets();
@@ -678,6 +683,9 @@
if (option.equals("-documentannotations")) {
return 2;
}
+ if (option.equals("-referenceonly")) {
+ return 1;
+ }
return 0;
}
public static boolean validOptions(String[][] options, DocErrorReporter r) {