Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
0
    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