private static final int TYPE_WIDGET = 1;
private static final int TYPE_LAYOUT = 2;
private static final int TYPE_LAYOUT_PARAM = 3;
-
+
public static final int SHOW_PUBLIC = 0x00000001;
public static final int SHOW_PROTECTED = 0x00000003;
public static final int SHOW_PACKAGE = 0x00000007;
}
return false;
}
-
+
public static boolean start(RootDoc r)
{
String keepListFile = null;
String stubsDir = null;
//Create the dependency graph for the stubs directory
boolean apiXML = false;
+ boolean noDocs = false;
String apiFile = null;
String debugStubsFile = "";
HashSet<String> stubPackages = null;
apiXML = true;
apiFile = a[1];
}
+ else if (a[0].equals("-nodocs")) {
+ noDocs = true;
+ }
else if (a[0].equals("-since")) {
sinceTagger.addVersion(a[1], a[2]);
}
// Set up the data structures
Converter.makeInfo(r);
- // Files for proofreading
- if (proofreadFile != null) {
- Proofread.initProofread(proofreadFile);
- }
- if (todoFile != null) {
- TodoFile.writeTodoFile(todoFile);
- }
+ if (!noDocs) {
+ long startTime = System.nanoTime();
- // Apply @since tags from the XML file
- sinceTagger.tagAll(Converter.rootClasses());
+ // Apply @since tags from the XML file
+ sinceTagger.tagAll(Converter.rootClasses());
- // HTML Pages
- if (ClearPage.htmlDir != null) {
- writeHTMLPages();
- }
+ // Files for proofreading
+ if (proofreadFile != null) {
+ Proofread.initProofread(proofreadFile);
+ }
+ if (todoFile != null) {
+ TodoFile.writeTodoFile(todoFile);
+ }
- // Navigation tree
- NavTree.writeNavTree(javadocDir);
+ // HTML Pages
+ if (ClearPage.htmlDir != null) {
+ writeHTMLPages();
+ }
- // Packages Pages
- writePackages(javadocDir
- + (ClearPage.htmlDir!=null
- ? "packages" + htmlExtension
- : "index" + htmlExtension));
+ // Navigation tree
+ NavTree.writeNavTree(javadocDir);
- // Classes
- writeClassLists();
- writeClasses();
- writeHierarchy();
- // writeKeywords();
+ // Packages Pages
+ writePackages(javadocDir
+ + (ClearPage.htmlDir!=null
+ ? "packages" + htmlExtension
+ : "index" + htmlExtension));
- // Lists for JavaScript
- writeLists();
- if (keepListFile != null) {
- writeKeepList(keepListFile);
- }
+ // Classes
+ writeClassLists();
+ writeClasses();
+ writeHierarchy();
+ // writeKeywords();
- // Sample Code
- for (SampleCode sc: sampleCodes) {
- sc.write();
- }
+ // Lists for JavaScript
+ writeLists();
+ if (keepListFile != null) {
+ writeKeepList(keepListFile);
+ }
- // Index page
- writeIndex();
+ // Sample Code
+ for (SampleCode sc: sampleCodes) {
+ sc.write();
+ }
- Proofread.finishProofread(proofreadFile);
+ // Index page
+ writeIndex();
+
+ Proofread.finishProofread(proofreadFile);
+
+ if (sdkValuePath != null) {
+ writeSdkValues(sdkValuePath);
+ }
+
+ long time = System.nanoTime() - startTime;
+ System.out.println("DroidDoc took " + (time / 1000000000) + " sec. to write docs to "
+ + ClearPage.outputDir);
+ }
// Stubs
if (stubsDir != null) {
Stubs.writeStubs(stubsDir, apiXML, apiFile, stubPackages);
}
- if (sdkValuePath != null) {
- writeSdkValues(sdkValuePath);
- }
-
Errors.printErrors();
return !Errors.hadError;
}
if (option.equals("-apixml")) {
return 2;
}
+ if (option.equals("-nodocs")) {
+ return 1;
+ }
if (option.equals("-since")) {
return 3;
}
data.setValue("package.since", pkg.getSince());
data.setValue("package.descr", "...description...");
- makeClassListHDF(data, "package.interfaces",
+ makeClassListHDF(data, "package.interfaces",
ClassInfo.sortByName(pkg.interfaces()));
makeClassListHDF(data, "package.classes",
ClassInfo.sortByName(pkg.ordinaryClasses()));
HDF data = makeHDF();
Collections.sort(keywords);
-
+
int i=0;
for (KeywordEntry entry: keywords) {
String base = "keywords." + entry.firstChar() + "." + i;
}
/**
- * Returns true if the given element has an @hide annotation.
+ * Returns true if the given element has an @hide or @pending annotation.
*/
private static boolean hasHideAnnotation(Doc doc) {
- return doc.getRawCommentText().indexOf("@hide") != -1;
+ String comment = doc.getRawCommentText();
+ return comment.indexOf("@hide") != -1 || comment.indexOf("@pending") != -1;
}
/**
if (methodName.equals("getRawCommentText")) {
return filterComment((String) method.invoke(target, args));
}
-
+
// escape "&" in disjunctive types.
if (proxy instanceof Type && methodName.equals("toString")) {
return ((String) method.invoke(target, args))
throw new RuntimeException("invalid scope for object " + scoped);
}
}
-
+
/**
* Collect the values used by the Dev tools and write them in files packaged with the SDK
* @param output the ouput directory for the files.
ArrayList<String> broadcastActions = new ArrayList<String>();
ArrayList<String> serviceActions = new ArrayList<String>();
ArrayList<String> categories = new ArrayList<String>();
-
+
ArrayList<ClassInfo> layouts = new ArrayList<ClassInfo>();
ArrayList<ClassInfo> widgets = new ArrayList<ClassInfo>();
ArrayList<ClassInfo> layoutParams = new ArrayList<ClassInfo>();
-
+
ClassInfo[] classes = Converter.allClasses();
// Go through all the fields of all the classes, looking SDK stuff.
for (ClassInfo clazz : classes) {
-
+
// first check constant fields for the SdkConstant annotation.
FieldInfo[] fields = clazz.allSelfFields();
for (FieldInfo field : fields) {
}
}
}
-
+
// Now check the class for @Widget or if its in the android.widget package
// (unless the class is hidden or abstract, or non public)
if (clazz.isHidden() == false && clazz.isPublic() && clazz.isAbstract() == false) {
}
}
}
-
+
if (annotated == false) {
// lets check if this is inside android.widget
PackageInfo pckg = clazz.containingPackage();
Collections.sort(categories);
writeValues(output + "/categories.txt", categories);
-
+
// before writing the list of classes, we do some checks, to make sure the layout params
// are enclosed by a layout class (and not one that has been declared as a widget)
for (int i = 0 ; i < layoutParams.size();) {
i++;
}
}
-
+
writeClasses(output + "/widgets.txt", widgets, layouts, layoutParams);
}
-
+
/**
* Writes a list of values into a text files.
* @param pathname the absolute os path of the output file.
try {
fw = new FileWriter(pathname, false);
bw = new BufferedWriter(fw);
-
+
for (String value : values) {
bw.append(value).append('\n');
}
try {
fw = new FileWriter(pathname, false);
bw = new BufferedWriter(fw);
-
+
// write the 3 types of classes.
for (ClassInfo clazz : widgets) {
writeClass(bw, clazz, 'W');
}
writer.append('\n');
}
-
+
/**
* Checks the inheritance of {@link ClassInfo} objects. This method return
* <ul>
* <li>{@link #TYPE_WIDGET}: if the class extends <code>android.view.View</code></li>
* <li>{@link #TYPE_LAYOUT_PARAM}: if the class extends <code>android.view.ViewGroup$LayoutParams</code></li>
* <li>{@link #TYPE_NONE}: in all other cases</li>
- * </ul>
+ * </ul>
* @param clazz the {@link ClassInfo} to check.
*/
private static int checkInheritance(ClassInfo clazz) {
} else if ("android.view.ViewGroup.LayoutParams".equals(clazz.qualifiedName())) {
return TYPE_LAYOUT_PARAM;
}
-
+
ClassInfo parent = clazz.superclass();
if (parent != null) {
return checkInheritance(parent);
}
-
+
return TYPE_NONE;
}
}