def generate_origin_trial_features(info_provider, options, idl_filenames): reader = IdlReader(info_provider.interfaces_info, options.cache_directory) jinja_env = initialize_jinja_env(options.cache_directory) # Extract the bidirectional mapping of conditional features <-> interfaces # from the global info provider and the supplied list of IDL files. feature_info = origin_trial_features_info(info_provider, reader, idl_filenames, options.target_component) # Convert that mapping into the context required for the Jinja2 templates. template_context = origin_trial_features_context(MODULE_PYNAME, feature_info) file_basename = 'origin_trial_features_for_%s' % options.target_component # Generate and write out the header file header_text = render_template( jinja_env.get_template(file_basename + '.h.tmpl'), template_context) header_path = posixpath.join(options.output_directory, file_basename + '.h') write_file(header_text, header_path) # Generate and write out the implementation file cpp_text = render_template( jinja_env.get_template(file_basename + '.cc.tmpl'), template_context) cpp_path = posixpath.join(options.output_directory, file_basename + '.cc') write_file(cpp_text, cpp_path)
def generate_conditional_features(info_provider, options, idl_filenames): reader = IdlReader(info_provider.interfaces_info, options.cache_directory) jinja_env = initialize_jinja_env(options.cache_directory) # Extract the bidirectional mapping of conditional features <-> interfaces # from the global info provider and the supplied list of IDL files. feature_info = conditional_features_info(info_provider, reader, idl_filenames, options.target_component.lower()) # Convert that mapping into the context required for the Jinja2 templates. template_context = conditional_features_context(MODULE_PYNAME, feature_info) # Generate and write out the header file header_text = render_template( jinja_env.get_template("ConditionalFeaturesFor%s.h.tmpl" % options.target_component.title()), template_context) header_path = posixpath.join( options.output_directory, "ConditionalFeaturesFor%s.h" % options.target_component.title()) write_file(header_text, header_path) # Generate and write out the implementation file cpp_text = render_template( jinja_env.get_template("ConditionalFeaturesFor%s.cpp.tmpl" % options.target_component.title()), template_context) cpp_path = posixpath.join( options.output_directory, "ConditionalFeaturesFor%s.cpp" % options.target_component.title()) write_file(cpp_text, cpp_path)
def generate_conditional_features(info_provider, options, idl_filenames): reader = IdlReader(info_provider.interfaces_info, options.cache_directory) jinja_env = initialize_jinja_env(options.cache_directory) # Extract the bidirectional mapping of conditional features <-> interfaces # from the global info provider and the supplied list of IDL files. feature_info = conditional_features_info(info_provider, reader, idl_filenames, options.target_component.lower()) # Convert that mapping into the context required for the Jinja2 templates. template_context = conditional_features_context( MODULE_PYNAME, feature_info) # Generate and write out the header file header_text = render_template(jinja_env.get_template( "ConditionalFeaturesFor%s.h.tmpl" % options.target_component.title()), template_context) header_path = posixpath.join(options.output_directory, "ConditionalFeaturesFor%s.h" % options.target_component.title()) write_file(header_text, header_path) # Generate and write out the implementation file cpp_text = render_template(jinja_env.get_template( "ConditionalFeaturesFor%s.cpp.tmpl" % options.target_component.title()), template_context) cpp_path = posixpath.join(options.output_directory, "ConditionalFeaturesFor%s.cpp" % options.target_component.title()) write_file(cpp_text, cpp_path)
def generate(self): jinja_env = initialize_jinja_env(self._opts.cache_dir) context = self._create_template_context() cpp_template = jinja_env.get_template(TEMPLATE_FILE) cpp_text = cpp_template.render(context) return cpp_text
def generate(self): jinja_env = initialize_jinja_env(self._opts.cache_dir) context = self._create_template_context() cpp_template = jinja_env.get_template(TEMPLATE_FILE) cpp_text = cpp_template.render(context) return cpp_text