Auto-generate docs based on annotations. am: d85b5c88af
am: 361cf77394
Change-Id: I1aeb80c6769094995055e9c5790ab9cccbd21432
diff --git a/res/assets/templates-sdk/head_tag.cs b/res/assets/templates-sdk/head_tag.cs
index 0665391..0d85b8c 100644
--- a/res/assets/templates-sdk/head_tag.cs
+++ b/res/assets/templates-sdk/head_tag.cs
@@ -82,12 +82,9 @@
elif:samples ?>/samples<?cs
elif:reference ?>/reference<?cs
elif:downloads ?>/downloads<?cs /if ?><?cs
+ elif:library.root ?><?cs var:library.root ?><?cs
else ?><?cs
- if:reference.testSupport ?>/reference/android/support/test<?cs
- elif:reference.wearableSupport ?>/reference/android/support/wearable<?cs
- elif:reference.androidSupport ?>/reference/android/support<?cs
- elif:reference.constraintSupport ?>/reference/android/support/constraint<?cs
- elif:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
+ if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
if:guide ?>/guide<?cs
elif:training ?>/training<?cs
elif:reference ?>/reference<?cs
diff --git a/res/assets/templates-sdk/lists.cs b/res/assets/templates-sdk/lists.cs
index f08abba..9d86dfa 100644
--- a/res/assets/templates-sdk/lists.cs
+++ b/res/assets/templates-sdk/lists.cs
@@ -1,8 +1,7 @@
var <?cs
- if:reference.testSupport ?>SUPPORT_TEST_<?cs
- elif: reference.wearableSupport ?>SUPPORT_WEARABLE_<?cs
- elif: reference.constraintSupport ?>CONSTRAINT_<?cs
- /if ?>DATA = [
+ if:dac_dataname ?><?cs var:dac_dataname ?><?cs
+ else ?>DATA<?cs
+ /if ?> = [
<?cs each:page = docs.pages
?> { id:<?cs var: page.id ?>, label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>", type:"<?cs var:page.type ?>", deprecated:"<?cs var:page.deprecated ?>" }<?cs if:!last(page) ?>,<?cs /if ?>
<?cs /each ?>
diff --git a/src/com/google/doclava/AtLinksNavTree.java b/src/com/google/doclava/AtLinksNavTree.java
index 532e8b6..f311c12 100644
--- a/src/com/google/doclava/AtLinksNavTree.java
+++ b/src/com/google/doclava/AtLinksNavTree.java
@@ -47,7 +47,7 @@
* }</pre>
*
* @param dir The directory path to prepend to the output path if the generated navtree is for
- * the /support/test or /support/wearable reference docs.
+ * one the a supplemental library references (such as the wearable support library)
*/
public static void writeAtLinksNavTree(String dir) {
StringBuilder buf = new StringBuilder();
@@ -60,10 +60,8 @@
data.setValue("navtree", buf.toString());
String output_path;
- if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && Doclava.testSupportRef) {
- output_path = dir + Doclava.testSupportPath + "at_links_navtree.json";
- } else if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && Doclava.wearableSupportRef) {
- output_path = dir + Doclava.wearableSupportPath + "at_links_navtree.json";
+ if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && (Doclava.libraryRoot != null)) {
+ output_path = dir + Doclava.libraryRoot + "at_links_navtree.json";
} else {
output_path = "at_links_navtree.json";
}
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 8fc0b4f..528ebf1 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -121,14 +121,7 @@
//API reference extensions
private static boolean gmsRef = false;
private static boolean gcmRef = false;
- public static boolean testSupportRef = false;
- public static String testSupportPath = "android/support/test/";
- public static boolean wearableSupportRef = false;
- public static String wearableSupportPath = "android/support/wearable/";
- public static boolean androidSupportRef = false;
- public static String androidSupportPath = "android/support/";
- public static boolean constraintSupportRef = false;
- public static String constraintSupportPath = "android/support/constraint/";
+ public static String libraryRoot = null;
private static boolean samplesRef = false;
private static boolean sac = false;
@@ -315,6 +308,10 @@
federationTagger.addSiteApi(name, file);
} else if (a[0].equals("-yaml")) {
yamlNavFile = a[1];
+ } else if (a[0].equals("-dac_libraryroot")) {
+ libraryRoot = a[1];
+ } else if (a[0].equals("-dac_dataname")) {
+ mHDFData.add(new String[] {"dac_dataname", a[1]});
} else if (a[0].equals("-documentannotations")) {
documentAnnotations = true;
documentAnnotationsPath = a[1];
@@ -359,6 +356,12 @@
for (String tmpl : templates) {
resourceLoaders.add(new FileSystemResourceLoader(tmpl));
}
+ // If no custom template path is provided, and this is a devsite build,
+ // then use the bundled templates-sdk/ files by default
+ if (templates.isEmpty() && USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
+ resourceLoaders.add(new ClassResourceLoader(Doclava.class, "/assets/templates-sdk"));
+ System.out.println("\n######### OK, Using templates-sdk ############\n");
+ }
templates = ClearPage.getBundledTemplateDirs();
for (String tmpl : templates) {
@@ -648,6 +651,12 @@
if (option.equals("-devsite")) {
return 1;
}
+ if (option.equals("-dac_libraryroot")) {
+ return 2;
+ }
+ if (option.equals("-dac_dataname")) {
+ return 2;
+ }
if (option.equals("-ignoreJdLinks")) {
return 1;
}
@@ -761,22 +770,6 @@
gcmRef = true;
return 1;
}
- if (option.equals("-testSupportRef")) {
- testSupportRef = true;
- return 1;
- }
- if (option.equals("-wearableSupportRef")) {
- wearableSupportRef = true;
- return 1;
- }
- if (option.equals("-androidSupportRef")) {
- androidSupportRef = true;
- return 1;
- }
- if (option.equals("-constraintSupportRef")) {
- constraintSupportRef = true;
- return 1;
- }
if (option.equals("-metadataDebug")) {
return 1;
}
@@ -894,14 +887,6 @@
data.setValue("reference.gms", "true");
} else if(gcmRef){
data.setValue("reference.gcm", "true");
- } else if(testSupportRef){
- data.setValue("reference.testSupport", "true");
- } else if(wearableSupportRef){
- data.setValue("reference.wearableSupport", "true");
- } else if(androidSupportRef){
- data.setValue("reference.androidSupport", "true");
- } else if(constraintSupportRef){
- data.setValue("reference.constraintSupport", "true");
}
data.setValue("reference", "1");
data.setValue("reference.apilevels", sinceTagger.hasVersions() ? "1" : "0");
@@ -1037,18 +1022,9 @@
int i = 0;
String listDir = javadocDir;
if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
- if (testSupportRef) {
- listDir = listDir + testSupportPath;
- data.setValue("reference.testSupport", "true");
- } else if (wearableSupportRef) {
- listDir = listDir + wearableSupportPath;
- data.setValue("reference.wearableSupport", "true");
- } else if (androidSupportRef) {
- listDir = listDir + androidSupportPath;
- data.setValue("reference.androidSupport", "true");
- } else if (constraintSupportRef) {
- listDir = listDir + constraintSupportPath;
- data.setValue("reference.constraintSupport", "true");
+ if (libraryRoot != null) {
+ listDir = listDir + libraryRoot;
+ data.setValue("library.root", libraryRoot);
}
}
for (String s : sorted.keySet()) {
@@ -1337,14 +1313,8 @@
String packageDir = javadocDir;
if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
- if (testSupportRef) {
- packageDir = packageDir + testSupportPath;
- } else if (wearableSupportRef) {
- packageDir = packageDir + wearableSupportPath;
- } else if (androidSupportRef) {
- packageDir = packageDir + androidSupportPath;
- } else if (constraintSupportRef) {
- packageDir = packageDir + constraintSupportPath;
+ if (libraryRoot != null) {
+ packageDir = packageDir + libraryRoot;
}
}
data.setValue("page.not-api", "true");
@@ -1433,14 +1403,8 @@
String packageDir = javadocDir;
if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
- if (testSupportRef) {
- packageDir = packageDir + testSupportPath;
- } else if (wearableSupportRef) {
- packageDir = packageDir + wearableSupportPath;
- } else if (androidSupportRef) {
- packageDir = packageDir + androidSupportPath;
- } else if (constraintSupportRef) {
- packageDir = packageDir + constraintSupportPath;
+ if (libraryRoot != null) {
+ packageDir = packageDir + libraryRoot;
}
}
diff --git a/src/com/google/doclava/NavTree.java b/src/com/google/doclava/NavTree.java
index 0f79917..03926b2 100644
--- a/src/com/google/doclava/NavTree.java
+++ b/src/com/google/doclava/NavTree.java
@@ -49,21 +49,8 @@
ClearPage.write(data, "gms_navtree_data.cs", "gms_navtree_data.js");
} else if (refPrefix == "gcm-"){
ClearPage.write(data, "gcm_navtree_data.cs", "gcm_navtree_data.js");
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS)
- && (Doclava.testSupportRef)){
- ClearPage.write(data, "navtree_data.cs", dir + Doclava.testSupportPath
- + "navtree_data.js");
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS)
- && (Doclava.wearableSupportRef)){
- ClearPage.write(data, "navtree_data.cs", dir + Doclava.wearableSupportPath
- + "navtree_data.js");
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS)
- && (Doclava.androidSupportRef)){
- ClearPage.write(data, "navtree_data.cs", dir + Doclava.androidSupportPath
- + "navtree_data.js");
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS)
- && (Doclava.constraintSupportRef)){
- ClearPage.write(data, "navtree_data.cs", dir + Doclava.constraintSupportPath
+ } else if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && (Doclava.libraryRoot != null)) {
+ ClearPage.write(data, "navtree_data.cs", dir + Doclava.libraryRoot
+ "navtree_data.js");
} else {
ClearPage.write(data, "navtree_data.cs", "navtree_data.js");
@@ -97,14 +84,8 @@
data = makeYamlHDF(sorted, "docs.pages", data);
- if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.testSupportRef)) {
- dir = Doclava.ensureSlash(dir) + Doclava.testSupportPath;
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.wearableSupportRef)) {
- dir = Doclava.ensureSlash(dir) + Doclava.wearableSupportPath;
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.androidSupportRef)) {
- dir = Doclava.ensureSlash(dir) + Doclava.androidSupportPath;
- } else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.constraintSupportRef)) {
- dir = Doclava.ensureSlash(dir) + Doclava.constraintSupportPath;
+ if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && (Doclava.libraryRoot != null)) {
+ dir = Doclava.ensureSlash(dir) + Doclava.libraryRoot;
}
data.setValue("docs.classes.link", Doclava.ensureSlash(dir) + "classes.html");