def test_two_package_includes(self): p1_path = pj('path', 'g', 'p1') p2_path = pj('path', 'g', 'p2') g_path = pj('path', 'g') p1 = Package(p1_path, [], []) p2 = Package(p2_path, [p1], []) g = Group(g_path, [], [p2, p1]) assert([p2_path, p1_path] == list(g.includes()))
def test_sources_one_c_component_no_driver(self): c1_path = pj('path', 'g', 'p1', 'gp1_c1.c') p1_path = pj('path', 'g', 'p1') g_path = pj('path', 'g') p1 = Package(p1_path, [], [{ 'header': None, 'source': c1_path, 'driver': None, }]) g = Group(g_path, [], [p1]) assert([c1_path] == list(g.sources()))
def resolve(self, name: str, seen: Dict[str, Target]) -> Target: deps = lookup_dependencies(name, self.dependencies, seen) identification = self.identify(name) result: Target if identification.type == 'group': assert isinstance(identification.path, Path) path = identification.path / 'group' / (name + '.mem') packages = resolve(PackageResolver(identification.path), list(bde_items(path))) result = Group(str(identification.path), deps, packages) TargetResolver._add_override(identification, name, result) if identification.type == 'package': assert isinstance(identification.path, Path) components = build_components(identification.path) result = Package(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'application': assert isinstance(identification.path, Path) components = build_components(identification.path) main_file = str(identification.path / f'{name}.m.cpp') if main_file not in {c['source'] for c in components}: components.append({ 'header': None, 'source': main_file, 'driver': None, }) result = Application(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'cmake': result = CMake(name, str(identification.path), deps) if identification.type == 'pkg_config': assert isinstance(identification.package, str) result = Pkg(name, identification.package, deps) if identification.type == 'virtual': result = Target(name, deps) if name in self._providers: result.has_output = False if any(d.name in self._runtime_libraries for d in deps): result.lazily_bound = True if name in self._plugin_tests: result.plugin_tests = True return result
def test_sources_one_cpp_component_with_driver(self): c1_header = pj('path', 'g', 'p1', 'gp1_c1.h') c1_path = pj('path', 'g', 'p1', 'gp1_c1.cpp') c1_driver = pj('path', 'g', 'p1', 'gp1_c1.t.cpp') p1_path = pj('path', 'g', 'p1') g_path = pj('path', 'g') p1 = Package(p1_path, [], [{ 'header': c1_header, 'source': c1_path, 'driver': c1_driver, }]) g = Group(g_path, [], [p1]) assert([c1_path] == list(g.sources())) assert([c1_driver] == list(g.drivers()))
def resolve(self, name: str, seen: Dict[str, Target]) -> Target: deps = lookup_dependencies(name, self.dependencies, seen) identification = self.identify(name) result: Target if identification.type == 'group': assert isinstance(identification.path, Path) path = identification.path/'group'/(name + '.mem') packages = resolve(PackageResolver(identification.path), list(bde_items(path))) result = Group(str(identification.path), deps, packages) TargetResolver._add_override(identification, name, result) if identification.type == 'package': assert isinstance(identification.path, Path) components = build_components(identification.path) result = Package(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'cmake': result = bdemeta.types.CMake(name, str(identification.path)) if identification.type == 'pkg_config': assert isinstance(identification.package, str) result = bdemeta.types.Pkg(name, identification.package) if identification.type == 'virtual': result = Target(name, deps) if name in self._providers: result.has_output = False if any(d.name in self._runtime_libraries for d in deps): result.lazily_bound = True return result
def resolve(self, name: str, seen: Dict[str, Target]) -> Target: deps = lookup_dependencies(name, self.dependencies, seen) identification = self.identify(name) result: Target if identification.type == 'group': assert isinstance(identification.path, Path) path = identification.path / 'group' / (name + '.mem') packages = resolve(PackageResolver(identification.path), list(bde_items(path))) result = Group(str(identification.path), deps, packages) TargetResolver._add_override(identification, name, result) if identification.type == 'package': assert isinstance(identification.path, Path) components = build_components(identification.path) result = Package(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'cmake': result = bdemeta.types.CMake(name, str(identification.path)) if identification.type == 'pkg_config': assert isinstance(identification.package, str) result = bdemeta.types.Pkg(name, identification.package) if identification.type == 'virtual': result = Target(name, deps) if name in self._providers: result.has_output = False if any(d.name in self._runtime_libraries for d in deps): result.lazily_bound = True return result
def test_one_package_includes(self): p_path = pj('path', 'g', 'p') g_path = pj('path', 'g') p = Package(p_path, [], []) g = Group( g_path, [], [p]) assert([p_path] == list(g.includes()))
def test_no_package_includes(self): g = Group(pj('path', 'g'), [], []) assert([] == list(g.includes()))
def test_name(self): g = Group(pj('path', 'g'), [], []) assert('g' == g.name)
def test_str_ness(self): g = Group(pj('path', 'g'), [], []) assert ('g' == g)