# -*- mode: python -*-

Import("env")

# WorkingSet target and associated test
env.Library(
    target = "working_set",
    source = [
        "working_set.cpp",
    ],
    LIBDEPS = [
        "$BUILD_DIR/mongo/bson",
    ],
)

env.CppUnitTest(
    target = "working_set_test",
    source = [
        "working_set_test.cpp"
    ],
    LIBDEPS = [
        "working_set",
    ],
)

env.Library(
    target = "scoped_timer",
    source = [
        "scoped_timer.cpp",
    ],
    LIBDEPS = [
    ],
)

env.Library(
    target = 'exec',
    source = [
        "and_hash.cpp",
        "and_sorted.cpp",
        "cached_plan.cpp",
        "collection_scan.cpp",
        "count.cpp",
        "count_scan.cpp",
        "delete.cpp",
        "distinct_scan.cpp",
        "eof.cpp",
        "fetch.cpp",
        "geo_near.cpp",
        "group.cpp",
        "idhack.cpp",
        "index_scan.cpp",
        "keep_mutations.cpp",
        "limit.cpp",
        "merge_sort.cpp",
        "multi_iterator.cpp",
        "multi_plan.cpp",
        "near.cpp",
        "oplogstart.cpp",
        "or.cpp",
        "pipeline_proxy.cpp",
        "projection.cpp",
        "projection_exec.cpp",
        "queued_data_stage.cpp",
        "shard_filter.cpp",
        "skip.cpp",
        "sort.cpp",
        "stagedebug_cmd.cpp",
        "subplan.cpp",
        "text.cpp",
        "update.cpp",
        "working_set_common.cpp",
    ],
    LIBDEPS = [
        "scoped_timer",
        "$BUILD_DIR/mongo/bson",
    ],
)

env.CppUnitTest(
    target = "queued_data_stage_test",
    source = [
        "queued_data_stage_test.cpp",
    ],
    LIBDEPS = [
        "exec",
        "$BUILD_DIR/mongo/serveronly",
        "$BUILD_DIR/mongo/coreserver",
        "$BUILD_DIR/mongo/coredb",
        "$BUILD_DIR/mongo/mocklib",
        "$BUILD_DIR/mongo/ntservice_mock",
    ],
    NO_CRUTCH = True,
)

env.CppUnitTest(
    target = "sort_test",
    source = [
        "sort_test.cpp",
    ],
    LIBDEPS = [
        "exec",
        "$BUILD_DIR/mongo/serveronly",
        "$BUILD_DIR/mongo/coreserver",
        "$BUILD_DIR/mongo/coredb",
        "$BUILD_DIR/mongo/mocklib",
        "$BUILD_DIR/mongo/ntservice_mock",
    ],
    NO_CRUTCH = True,
)

env.CppUnitTest(
    target = "projection_exec_test",
    source = [
        "projection_exec_test.cpp",
    ],
    LIBDEPS = [
        "exec",
        "$BUILD_DIR/mongo/serveronly",
        "$BUILD_DIR/mongo/coreserver",
        "$BUILD_DIR/mongo/coredb",
        "$BUILD_DIR/mongo/ntservice_mock",
    ],
    NO_CRUTCH = True,
)
