Merge "remove hard-coded behavior for Android libraries, replacing them with support for a new doclava option, "dac_libraryroot", which specifies the path to this API's root URL (after accounting for DAC's reference/ path). For example, the wearable doclava build must specify libraryroot as "android/support/constraint/". Also required is a unique name for array created inside lists.js, specified with the "dac_dataname" option. For wearable, it is "SUPPORT_WEARABLE_DATA"" into oc-dev am: d001ea7777
am: fcdf0ec660  -s ours

Change-Id: I3fc9208016807f79e8f4a49b1e86b533701884d0
diff --git a/res/assets/templates-sdk/head_tag.cs b/res/assets/templates-sdk/head_tag.cs
index 0d85b8c..1f24860 100644
--- a/res/assets/templates-sdk/head_tag.cs
+++ b/res/assets/templates-sdk/head_tag.cs
@@ -82,7 +82,7 @@
             elif:samples ?>/samples<?cs
             elif:reference ?>/reference<?cs
             elif:downloads ?>/downloads<?cs /if ?><?cs
-          elif:library.root ?><?cs var:library.root ?><?cs
+          elif:library.root ?>/reference/<?cs var:library.root ?><?cs
           else ?><?cs
             if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
               if:guide ?>/guide<?cs
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 8cf17e8..8c29ac7 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -317,7 +317,8 @@
       } else if (a[0].equals("-yaml")) {
         yamlNavFile = a[1];
       } else if (a[0].equals("-dac_libraryroot")) {
-        libraryRoot = a[1];
+        libraryRoot = ensureSlash(a[1]);
+        mHDFData.add(new String[] {"library.root", a[1]});
       } else if (a[0].equals("-dac_dataname")) {
         mHDFData.add(new String[] {"dac_dataname", a[1]});
       } else if (a[0].equals("-documentannotations")) {
@@ -1039,7 +1040,6 @@
     if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
       if (libraryRoot != null) {
         listDir = listDir + libraryRoot;
-        data.setValue("library.root", libraryRoot);
       }
     }
     for (String s : sorted.keySet()) {