def has_headers_only(file_system: FileSystem, program_arguments: Dict[str, Any], configuration: Dict[str, Any]): sources_root = join(file_system.get_working_directory(), 'sources') files = file_system.files_in_directory(sources_root) return not program_arguments['global']['executable'] and all( f.endswith('.hpp') or f.endswith('.test.cpp') for f in files)
def load_headers(file_system: FileSystem, resources: StageResources, cache: Dict[str, Any], program_arguments: Dict[str, Any], configuration: Dict[str, Any], remote_proxy: RemoteProxy): resources['headers'] = [ f for f in file_system.files_in_directory(resources['headers_root']) if f.endswith('.hpp') ]
def has_non_executable_sources(file_system: FileSystem, program_arguments: Dict[str, Any], configuration: Dict[str, Any]): sources_root = join(file_system.get_working_directory(), 'sources') files = file_system.files_in_directory(sources_root) return (not program_arguments['global']['executable'] and all(basename(f) != 'executable.cpp' for f in files) and any( f.endswith('.cpp') and not f.endswith('.test.cpp') for f in files))
def load_test_sources(file_system: FileSystem, resources: StageResources, cache: Dict[str, Any], program_arguments: Dict[str, Any], configuration: Dict[str, Any], remote_proxy: RemoteProxy): pralinefile = resources['pralinefile'] test_sources_root = resources['test_sources_root'] test_executable_source = join(test_sources_root, pralinefile['organization'], pralinefile['artifact'], 'executable.test.cpp') file_system.create_file_if_missing(test_executable_source, test_executable_contents) resources['test_sources'] = [ f for f in file_system.files_in_directory(test_sources_root) if f.endswith('.test.cpp') ]
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') ]
def can_run_unit_tests(file_system: FileSystem, program_arguments: Dict[str, Any], configuration: Dict[str, Any]): return not program_arguments['global']['skip_unit_tests'] and any( f for f in file_system.files_in_directory('sources') if f.endswith('.test.cpp'))
def has_executable(file_system: FileSystem, program_arguments: Dict[str, Any], configuration: Dict[str, Any]): sources_root = join(file_system.get_working_directory(), 'sources') files = file_system.files_in_directory(sources_root) return program_arguments['global']['executable'] or any( basename(f) == 'executable.cpp' for f in files)
def load_resources(file_system: FileSystem, resources: StageResources, cache: Dict[str, Any], program_arguments: Dict[str, Any], configuration: Dict[str, Any], remote_proxy: RemoteProxy): resources['resources'] = file_system.files_in_directory( resources['resources_root'])