Attempts to generate the target given by target reference, which
    can refer both to a main target or to a file.
    Returns a list consisting of
    - usage requirements
    - generated virtual targets, if any
    target_reference:  Target reference
    project:           Project where the reference is made
    property_set:      Properties of the main target that makes the reference

def generate_from_reference(target_reference, project, property_set_):
    """ Attempts to generate the target given by target reference, which
    can refer both to a main target or to a file.
    Returns a list consisting of
    - usage requirements
    - generated virtual targets, if any
    target_reference:  Target reference
    project:           Project where the reference is made
    property_set:      Properties of the main target that makes the reference
    """
    assert isinstance(target_reference, basestring)
    assert isinstance(project, ProjectTarget)
    assert isinstance(property_set_, property_set.PropertySet)
    target, sproperties = resolve_reference(target_reference, project)

    # Take properties which should be propagated and refine them
    # with source-specific requirements.
    propagated = property_set_.propagated()
    rproperties = propagated.refine(sproperties)

    return target.generate(rproperties)