Merge "Add support for multiple html directories to droiddoc." into gingerbread

This commit is contained in:
Rohit Mungee 2010-08-24 22:58:30 -07:00 committed by Android (Google) Code Review
commit cb92616f11
3 changed files with 18 additions and 13 deletions

View file

@ -144,7 +144,7 @@ $(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_
$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := $(foreach dir,$(LOCAL_DROIDDOC_HTML_DIR),-htmldir $(dir))
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
endif

View file

@ -23,6 +23,7 @@ import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ClearPage
{
@ -43,7 +44,7 @@ public class ClearPage
private static boolean mTemplateDirSet = false;
public static String outputDir = "docs";
public static String htmlDir = null;
public static List<String> htmlDirs = new ArrayList<String>();
public static String toroot = null;
public static void addTemplateDir(String dir)
@ -76,7 +77,7 @@ public class ClearPage
public static void write(HDF data, String templ, String filename, boolean fullPath)
{
if (htmlDir != null) {
if (!htmlDirs.isEmpty()) {
data.setValue("hasindex", "true");
}
@ -103,9 +104,11 @@ public class ClearPage
}
int i=0;
if (htmlDir != null) {
data.setValue("hdf.loadpaths." + i, htmlDir);
i++;
if (!htmlDirs.isEmpty()) {
for (String dir : htmlDirs) {
data.setValue("hdf.loadpaths." + i, dir);
i++;
}
}
if (mTemplateDirSet) {
for (String dir: mTemplateDirs) {

View file

@ -122,7 +122,7 @@ public class DroidDoc
sampleCodes.add(new SampleCode(a[1], a[2], a[3]));
}
else if (a[0].equals("-htmldir")) {
ClearPage.htmlDir = a[1];
ClearPage.htmlDirs.add(a[1]);
}
else if (a[0].equals("-title")) {
DroidDoc.title = a[1];
@ -224,7 +224,7 @@ public class DroidDoc
}
// HTML Pages
if (ClearPage.htmlDir != null) {
if (!ClearPage.htmlDirs.isEmpty()) {
writeHTMLPages();
}
@ -233,7 +233,7 @@ public class DroidDoc
// Packages Pages
writePackages(javadocDir
+ (ClearPage.htmlDir!=null
+ (!ClearPage.htmlDirs.isEmpty()
? "packages" + htmlExtension
: "index" + htmlExtension));
@ -575,11 +575,13 @@ public class DroidDoc
public static void writeHTMLPages()
{
File f = new File(ClearPage.htmlDir);
if (!f.isDirectory()) {
System.err.println("htmlDir not a directory: " + ClearPage.htmlDir);
for (String htmlDir : ClearPage.htmlDirs) {
File f = new File(htmlDir);
if (!f.isDirectory()) {
System.err.println("htmlDir not a directory: " + htmlDir);
}
writeDirectory(f, "");
}
writeDirectory(f, "");
}
public static void writeLists()