def load_clang_format(file_system: FileSystem, resources: StageResources, cache: Dict[str, Any], program_arguments: Dict[str, Any], configuration: Dict[str, Any], remote_proxy: RemoteProxy): if 'clang-format-executable-path' in configuration: clang_format_executable = configuration['clang-format-executable-path'] if not file_system.is_file(clang_format_executable): raise ClangFormatConfigurationError(f"user supplied clang-format '{clang_format_executable}' is not a file") else: clang_format_executable = file_system.which('clang-format') if clang_format_executable is None: raise ClangFormatConfigurationError("coudn't find clang-format in path -- either supply it in the praline-client.config file or add it to the path environment variable") project_directory = resources['project_directory'] resources['clang_format_executable'] = clang_format_executable resources['clang_format_style_file'] = clang_format_style_file = join(project_directory, '.clang-format') file_system.create_file_if_missing(clang_format_style_file, clang_format_style_file_contents)
def load_main_sources(file_system: FileSystem, resources: StageResources, cache: Dict[str, Any], program_arguments: Dict[str, Any], configuration: Dict[str, Any], remote_proxy: RemoteProxy): main_sources_root = resources['main_sources_root'] pralinefile = resources['pralinefile'] main_executable_source = join(main_sources_root, pralinefile['organization'], pralinefile['artifact'], 'executable.cpp') if program_arguments['global']['executable']: resources['main_executable_source'] = main_executable_source file_system.create_file_if_missing(main_executable_source, main_executable_contents) elif file_system.is_file(main_executable_source): resources['main_executable_source'] = main_executable_source else: resources['main_executable_source'] = None resources['main_sources'] = [ f for f in file_system.files_in_directory(main_sources_root) if f.endswith('.cpp') and not f.endswith('.test.cpp') ]