Skip to content

Commit

Permalink
Make java_object_gen.py friendly to use via API. (#294)
Browse files Browse the repository at this point in the history
Intended to support a proposed process for publishing documentation.
  • Loading branch information
Stewori committed Dec 25, 2023
1 parent a9a4942 commit 7e57b5c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions build-tools/python/tool/java_object_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,13 @@ def get_parser():
return parser


def main():
# Parse the command line to argparse arguments
parser = get_parser()
args = parser.parse_args()

# Embed results of parse into factory
def process(src_dir, dest_dir, error, verbose=False):
'''Friendly entry point to use this script via API.'''
# Embed arguments into factory
factory = ImplementationTemplateProcessorFactory(
args.source_dir, args.dest_dir, parser.error, args.verbose)
src_dir, dest_dir, error, verbose)

# Process all Java files in the template tree at args.source_dir
src_dir = args.source_dir
# Process all Java files in the template tree at src_dir
for dirpath, dirnames, filenames in os.walk(src_dir):
# Any .java files here?
javanames = [n for n in filenames
Expand All @@ -158,6 +154,13 @@ def main():
proc.process()


def main():
# Parse the command line to argparse arguments
parser = get_parser()
args = parser.parse_args()
process(args.source_dir, args.dest_dir, parser.error, args.verbose)


if __name__ == '__main__':
main()

0 comments on commit 7e57b5c

Please sign in to comment.