Merge commit '23c1f0ca7d629af4de06fb2b05ee9add2bf0a4d5' * commit '23c1f0ca7d629af4de06fb2b05ee9add2bf0a4d5': add option to @hide classes generated from .logtags files
This commit is contained in:
commit
0235b4d595
2 changed files with 21 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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,))
|
||||
|
||||
|
|
Loading…
Reference in a new issue