am 5ae770fc: add option to @hide classes generated from .logtags files

Merge commit '5ae770fc0e43172e1efc5146a38e7d1f452143e2' into eclair-mr2-plus-aosp

* commit '5ae770fc0e43172e1efc5146a38e7d1f452143e2':
  add option to @hide classes generated from .logtags files
This commit is contained in:
Doug Zongker 2009-12-09 16:01:33 -08:00 committed by Android Git Automerger
commit 23c1f0ca7d
2 changed files with 21 additions and 0 deletions

View file

@ -93,6 +93,18 @@ class TagFile(object):
self.AddError(str(e))
def BooleanFromString(s):
"""Interpret 's' as a boolean and return its value. Raise
ValueError if it's not something we can interpret as true or
false."""
s = s.lower()
if s in ("true", "t", "1", "on", "yes", "y"):
return True
if s in ("false", "f", "0", "off", "no", "n"):
return False
raise ValueError("'%s' not a valid boolean" % (s,))
def WriteOutput(output_file, data):
"""Write 'data' to the given output filename (which may be None to
indicate stdout). Emit an error message and die on any failure.

View file

@ -60,6 +60,10 @@ tagfile = event_log_tags.TagFile(fn)
if "java_package" not in tagfile.options:
tagfile.AddError("java_package option not specified", linenum=0)
hide = True
if "javadoc_hide" in tagfile.options:
hide = event_log_tags.BooleanFromString(tagfile.options["javadoc_hide"][0])
if tagfile.errors:
for fn, ln, msg in tagfile.errors:
print >> sys.stderr, "%s:%d: error: %s" % (fn, ln, msg)
@ -73,6 +77,11 @@ buffer.write("/* This file is auto-generated. DO NOT MODIFY.\n"
buffer.write("package %s;\n\n" % (tagfile.options["java_package"][0],))
basename, _ = os.path.splitext(os.path.basename(fn))
if hide:
buffer.write("/**\n"
" * @hide\n"
" */\n")
buffer.write("public class %s {\n" % (basename,))
buffer.write(" private %s() { } // don't instantiate\n" % (basename,))