diff --git a/tools/droiddoc/src/Comment.java b/tools/droiddoc/src/Comment.java index f49be8fc7..68b6d202f 100644 --- a/tools/droiddoc/src/Comment.java +++ b/tools/droiddoc/src/Comment.java @@ -55,8 +55,6 @@ public class Comment "@sample", "@include", "@serial", - "@com.intel.drl.spec_ref", - "@ar.org.fitc.spec_ref", }; public Comment(String text, ContainerInfo base, SourcePositionInfo sp) @@ -184,6 +182,9 @@ public class Comment break; } } + if (!known) { + known = DroidDoc.knownTags.contains(name); + } if (!known) { Errors.error(Errors.UNKNOWN_TAG, pos == null ? null : new SourcePositionInfo(pos), "Unknown tag: " + name); diff --git a/tools/droiddoc/src/DroidDoc.java b/tools/droiddoc/src/DroidDoc.java index 91a795e1a..79d593c8f 100644 --- a/tools/droiddoc/src/DroidDoc.java +++ b/tools/droiddoc/src/DroidDoc.java @@ -58,6 +58,7 @@ public class DroidDoc public static Map escapeChars = new HashMap(); public static String title = ""; public static SinceTagger sinceTagger = new SinceTagger(); + public static HashSet knownTags = new HashSet(); private static boolean parseComments = false; private static boolean generateDocs = true; @@ -111,6 +112,7 @@ public class DroidDoc String apiFile = null; String debugStubsFile = ""; HashSet stubPackages = null; + ArrayList knownTagsFiles = new ArrayList(); root = r; @@ -125,6 +127,9 @@ public class DroidDoc else if (a[0].equals("-hdf")) { mHDFData.add(new String[] {a[1], a[2]}); } + else if (a[0].equals("-knowntags")) { + knownTagsFiles.add(a[1]); + } else if (a[0].equals("-toroot")) { ClearPage.toroot = a[1]; } @@ -214,6 +219,10 @@ public class DroidDoc } } + if (!readKnownTagsFiles(knownTags, knownTagsFiles)) { + return false; + } + // read some prefs from the template if (!readTemplateSettings()) { return false; @@ -316,6 +325,56 @@ public class DroidDoc return true; } + private static boolean readKnownTagsFiles(HashSet knownTags, + ArrayList knownTagsFiles) { + for (String fn: knownTagsFiles) { + BufferedReader in = null; + try { + in = new BufferedReader(new FileReader(fn)); + int lineno = 0; + boolean fail = false; + while (true) { + lineno++; + String line = in.readLine(); + if (line == null) { + break; + } + line = line.trim(); + if (line.length() == 0) { + continue; + } else if (line.charAt(0) == '#') { + continue; + } + String[] words = line.split("\\s+", 2); + if (words.length == 2) { + if (words[1].charAt(0) != '#') { + System.err.println(fn + ":" + lineno + + ": Only one tag allowed per line: " + line); + fail = true; + continue; + } + } + knownTags.add(words[0]); + System.out.println("Known tag: " + words[0]); + } + if (fail) { + return false; + } + } catch (IOException ex) { + System.err.println("Error reading file: " + fn + " (" + ex.getMessage() + ")"); + return false; + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + } + } + } + } + return true; + } + public static String escape(String s) { if (escapeChars.size() == 0) { return s; @@ -371,6 +430,9 @@ public class DroidDoc if (option.equals("-hdf")) { return 3; } + if (option.equals("-knowntags")) { + return 2; + } if (option.equals("-toroot")) { return 2; }