def render_source(output_dir, package_spec, jenv=JENV):
path, module_name = package_spec.filepath<EOL>java_template = jenv.get_template(TEMPLATE_NAME)<EOL>module_path = "<STR_LIT>" + package_spec.identifier<EOL>yaml_filepath = "<STR_LIT:/>".join(package_spec.filepath) + "<STR_LIT>"<EOL>includes = ["<STR_LIT:.>".join(i.split("<STR_LIT:.>")[:-<NUM_LIT:1>]) for i in package_spec.includes]<EOL>includes = [i for i in includes if i != "<STR_LIT>"]<EOL>for msg in package_spec.definitions:<EOL><INDENT>msg_name = classnameify(msg.identifier) if msg.sbp_id else msg.identifier<EOL>l = "<STR_LIT:/>".join(package_spec.filepath)<EOL>destination_filename = "<STR_LIT>" % (output_dir, l , msg_name)<EOL>if not os.path.exists(os.path.dirname(destination_filename)):<EOL><INDENT>os.mkdir(os.path.dirname(destination_filename))<EOL><DEDENT>with open(destination_filename, '<STR_LIT>') as f:<EOL><INDENT>print(destination_filename)<EOL>f.write(java_template.render(m=msg,<EOL>filepath=yaml_filepath,<EOL>module_path=module_path,<EOL>include=includes,<EOL>description=package_spec.description))<EOL><DEDENT><DEDENT>
Render and output