def _resolve_projects()

in builder/core/project.py [0:0]


def _resolve_projects(curr_proj, refs):
    """
    convert ProjectReference -> Project

    :param curr_proj: The root project these references belong to
    :type curr_proj: Project
    :type refs: [ProjectReference]
    :return: [Project]
    """
    projects = {}
    for r in refs:
        if not isinstance(r, Project) or not r.resolved():
            if isinstance(r, str):
                project = Project.find_project(r)
            else:
                project = Project.find_project(r.name)
                project = merge_unique_attrs(r, project)
        else:
            project = r

        # if this reference is an upstream dependency of the current project then
        # merge in the upstream config of the current project (e.g. to allow pre/post build steps to be added)
        upstream_ref = next((x for x in curr_proj.config.get('upstream', []) if x.name == r.name), None)
        if upstream_ref:
            src = upstream_ref._asdict() if isnamedtuple(upstream_ref) else upstream_ref.__dict__
            # upstream config may override the branch/revision to use
            project.revision = src['config'].get('revision', None)

        projects[project.name] = project
    return list(projects.values())