def __generate_component_client(context, base_code_path, destination_code_path, namespace_name, jinja, swagger): if not os.path.exists(destination_code_path): print 'Making directory {}'.format(destination_code_path) os.makedirs(destination_code_path) template_h = jinja.get_template('component-client/component_template.h') out_path_h = os.path.join(destination_code_path, '{}ClientComponent.h'.format(namespace_name)) template_cpp = jinja.get_template( 'component-client/component_template.cpp') out_path_cpp = os.path.join(destination_code_path, '{}ClientComponent.cpp'.format(namespace_name)) jinja_json = component_gen_utils.generate_component_json( namespace_name, swagger) jinja_json["UUIDs"] = component_gen_utils.get_UUIDs( out_path_cpp, jinja_json) __write_file(template_h, jinja_json, out_path_h) __write_file(template_cpp, jinja_json, out_path_cpp) return { 'auto': { 'Include': [__make_wscript_relative_path(base_code_path, out_path_h)], 'Source': [__make_wscript_relative_path(base_code_path, out_path_cpp)] } }
def __generate_component_client(context, base_code_path, destination_code_path, namespace_name, jinja, swagger, gem): if not os.path.exists(destination_code_path): print 'Making directory {}'.format(destination_code_path) os.makedirs(destination_code_path) template_h = jinja.get_template('component-client/component_template.h') out_path_h = os.path.join(destination_code_path, '{}ClientComponent.h'.format(namespace_name)) template_cpp = jinja.get_template( 'component-client/component_template.cpp') out_path_cpp = os.path.join(destination_code_path, '{}ClientComponent.cpp'.format(namespace_name)) jinja_json = component_gen_utils.generate_component_json( namespace_name, swagger) jinja_json["UUIDs"] = component_gen_utils.get_UUIDs( out_path_cpp, jinja_json) jinja_json["HasStdAfx"] = component_gen_utils.has_stdafx_files( gem.cpp_base_directory_path) # Set to True to match CLOUD_GEM_WSCRIPT_FILE_CONTENT->disable_pch. jinja_json["DisabledPCH"] = True __write_file(template_h, jinja_json, out_path_h) __write_file(template_cpp, jinja_json, out_path_cpp) return { 'auto': { 'Include': [__make_wscript_relative_path(base_code_path, out_path_h)], 'Source': [__make_wscript_relative_path(base_code_path, out_path_cpp)] } }
def __generate_component_client(context, args, jinja, swagger): destination_code_path = args.component_client_path if destination_code_path is None: resource_group = context.resource_groups.get(args.resource_group, None) if resource_group.is_gem: destination_code_path = os.path.abspath( os.path.join(resource_group.directory_path, '..', 'Code', 'Include', 'AWS', 'ServiceAPI')) else: destination_code_path = os.path.join( resource_group.game_cpp_code_path, 'ServiceAPI') if not os.path.exists(destination_code_path): print 'Making directory {}'.format(destination_code_path) os.makedirs(destination_code_path) template = jinja.get_template('component-client/component_template.h') out_file_path = os.path.join( destination_code_path, '{}ClientComponent.h'.format(args.resource_group)) jinja_json = component_gen_utils.generate_component_json( args.resource_group, swagger) jinja_json["UUIDs"] = component_gen_utils.get_UUIDs( out_file_path, jinja_json) result = template.render(json_object=jinja_json) print 'Writing file {}.'.format(out_file_path) print 'Add to the approriate .waf_files file to include in your project' with open(out_file_path, 'w') as file: file.write(result) lambda_code_path = context.resource_groups.get(args.resource_group, None).lambda_code_path print 'lambda_code_path', lambda_code_path