Esempio n. 1
0
def make_test(target_type, sources, requirements, target_name=None):

    if not target_name:
        target_name = stem(os.path.basename(sources[0]))

    # Having periods (".") in the target name is problematic because the typed
    # generator will strip the suffix and use the bare name for the file
    # targets. Even though the location-prefix averts problems most times it
    # does not prevent ambiguity issues when referring to the test targets. For
    # example when using the XML log output. So we rename the target to remove
    # the periods, and provide an alias for users.
    real_name = target_name.replace(".", "~")

    project = get_manager().projects().current()
    # The <location-prefix> forces the build system for generate paths in the
    # form '$build_dir/array1.test/gcc/debug'. This is necessary to allow
    # post-processing tools to work.
    t = get_manager().targets().create_typed_target(
        type.type_from_rule_name(target_type), project, real_name, sources,
        requirements + ["<location-prefix>" + real_name + ".test"], [], [])

    # The alias to the real target, per period replacement above.
    if real_name != target_name:
        get_manager().projects().project_rules().all_names_["alias"](
            target_name, [t])

    # Remember the test (for --dump-tests). A good way would be to collect all
    # given a project. This has some technical problems: e.g. we can not call
    # this dump from a Jamfile since projects referred by 'build-project' are
    # not available until the whole Jamfile has been loaded.
    __all_tests.append(t)
    return t
Esempio n. 2
0
def make_test(target_type, sources, requirements, target_name=None):

    if not target_name:
        target_name = stem(os.path.basename(sources[0]))

    # Having periods (".") in the target name is problematic because the typed
    # generator will strip the suffix and use the bare name for the file
    # targets. Even though the location-prefix averts problems most times it
    # does not prevent ambiguity issues when referring to the test targets. For
    # example when using the XML log output. So we rename the target to remove
    # the periods, and provide an alias for users.
    real_name = target_name.replace(".", "~")

    project = get_manager().projects().current()
    # The <location-prefix> forces the build system for generate paths in the
    # form '$build_dir/array1.test/gcc/debug'. This is necessary to allow
    # post-processing tools to work.
    t = get_manager().targets().create_typed_target(
        type.type_from_rule_name(target_type), project, real_name, sources,
        requirements + ["<location-prefix>" + real_name + ".test"], [], [])

    # The alias to the real target, per period replacement above.
    if real_name != target_name:
        get_manager().projects().project_rules().all_names_["alias"](
            target_name, [t])

    # Remember the test (for --dump-tests). A good way would be to collect all
    # given a project. This has some technical problems: e.g. we can not call
    # this dump from a Jamfile since projects referred by 'build-project' are
    # not available until the whole Jamfile has been loaded.
    __all_tests.append(t)
    return t
Esempio n. 3
0
def cast(name, type, sources, requirements, default_build, usage_requirements):

    from b2.manager import get_manager
    t = get_manager().targets()

    project = get_manager().projects().current()

    real_type = type_.type_from_rule_name(type)
    if not real_type:
        real_type = type
    return t.main_target_alternative(
        CastTargetClass(
            name, project, real_type, t.main_target_sources(sources, name),
            t.main_target_requirements(requirements, project),
            t.main_target_default_build(default_build, project),
            t.main_target_usage_requirements(usage_requirements, project)))
Esempio n. 4
0
def cast(name, type, sources, requirements, default_build, usage_requirements):

    from b2.manager import get_manager
    t = get_manager().targets()

    project = get_manager().projects().current()

    real_type = type_.type_from_rule_name(type)
    if not real_type:
        real_type = type
    return t.main_target_alternative(
        CastTargetClass(name, project, real_type,
                        t.main_target_sources(sources, name),
                        t.main_target_requirements(requirements, project),
                        t.main_target_default_build(default_build, project),
                        t.main_target_usage_requirements(usage_requirements, project)))