# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Library(
    target='repl_server_parameters',
    source=[
        env.Idlc('repl_server_parameters.idl')[0]
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/client/read_preference',
        '$BUILD_DIR/mongo/idl/server_parameter',
    ]
)

env.Library(
    target='local_oplog_info',
    source=[
        'local_oplog_info.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection',
        '$BUILD_DIR/mongo/db/logical_time',
        '$BUILD_DIR/mongo/db/storage/flow_control',
        '$BUILD_DIR/mongo/db/vector_clock_mutable',
        'optime',
        'repl_coordinator_interface',
    ],
)

env.Library(
    target='oplog',
    source=[
        'apply_ops.cpp',
        'oplog.cpp',
        'oplog_entry_or_grouped_inserts.cpp',
        'tenant_migration_decoration.cpp',
        'transaction_oplog_application.cpp',
        env.Idlc('apply_ops.idl')[0],
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/database_holder',
        '$BUILD_DIR/mongo/db/catalog/index_build_oplog_entry',
        '$BUILD_DIR/mongo/db/catalog/multi_index_block',
        '$BUILD_DIR/mongo/db/commands/feature_compatibility_parsers',
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/op_observer',
        '$BUILD_DIR/mongo/db/s/resharding_util',
        '$BUILD_DIR/mongo/db/stats/counters',
        '$BUILD_DIR/mongo/db/stats/server_read_concern_write_concern_metrics',
        '$BUILD_DIR/mongo/db/transaction',
        '$BUILD_DIR/mongo/idl/idl_parser',
        '$BUILD_DIR/mongo/rpc/command_status',
        'dbcheck',
        'local_oplog_info',
        'repl_coordinator_interface',
        'repl_server_parameters',
        'repl_settings',
        'tenant_migration_donor',
        'timestamp_block',
    ],
)

env.Library(
    target='replication_auth',
    source=[
        'replication_auth.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/client/authentication',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
    ],
)

env.Library(
    target='timestamp_block',
    source=[
        'timestamp_block.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/storage/storage_options',
    ],
)

env.Library(
    target='rollback_source_impl',
    source=[
        'rollback_source_impl.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/index/index_descriptor',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/util/fail_point',
        'oplog',
        'oplog_interface_remote',
        'repl_coordinator_interface',
    ],
    LIBDEPS_PRIVATE=[
        'replication_auth',
    ]
)

env.Library(
    target='bgsync',
    source=[
        'bgsync.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/connection_pool',
        '$BUILD_DIR/mongo/client/fetcher',
        '$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        'abstract_async_component',
        'data_replicator_external_state_impl',
        'oplog',
        'oplog_fetcher',
        'oplog_interface_local',
        'oplog_interface_remote',
        'repl_coordinator_interface',
        'rollback_impl',
        'rollback_source_impl',
        'rs_rollback',
        'storage_interface',
        'sync_source_resolver',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor',
        'repl_server_parameters',
    ],
)

env.Library(
    target='repl_settings',
    source=[
        'repl_settings.cpp',
        env.Idlc('repl_settings.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/idl/server_parameter',
    ],
)

env.Library(
    target='abstract_async_component',
    source=[
        'abstract_async_component.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
    ],
)

env.Library(
    target='dbcheck',
    source=[
        'dbcheck.cpp',
        "dbcheck_idl.cpp",
        env.Idlc('dbcheck.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/catalog/health_log',
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/util/md5',
    ],
)

env.Library(
    target='rollback_idl',
    source=[
        env.Idlc('rollback.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/idl/idl_parser',
        'optime',
    ],
)

env.Library(
    target='storage_interface',
    source=[
        'storage_interface.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/service_context',
        'optime',
    ],
)

env.Library(
    target='storage_interface_impl',
    source=[
        'storage_interface_impl.cpp',
        'collection_bulk_loader_impl.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/multi_index_block',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/query_exec',
        'oplog',
        'rollback_idl',
        'storage_interface',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/database_holder',
        '$BUILD_DIR/mongo/db/storage/oplog_cap_maintainer_thread',
        '$BUILD_DIR/mongo/db/storage/storage_control',
        '$BUILD_DIR/mongo/db/vector_clock',
        'repl_server_parameters',
    ],
)

env.Library(
    target='replication_consistency_markers_idl',
    source=[
        env.Idlc('replication_consistency_markers.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/idl/idl_parser',
        'optime',
    ],
)

env.Library(
    target='replication_consistency_markers_impl',
    source=[
        'replication_consistency_markers_impl.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/server_options',
        'optime',
        'repl_coordinator_interface',
        'replication_consistency_markers_idl',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog_raii',
        '$BUILD_DIR/mongo/db/storage/journal_flusher',
    ],
)

env.Library(
    target='replication_recovery',
    source=[
        'replication_recovery.cpp',
    ],
    LIBDEPS=[
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/storage/journal_flusher',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        'oplog',
        'oplog_application',
        'oplog_interface_local',
    ],
)

env.Library(
    target='replication_process',
    source=[
        'replication_consistency_markers.cpp',
        'replication_process.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/service_context',
        'optime',
        'rollback_idl',
        'storage_interface',
    ],
)

env.Library(
    target='drop_pending_collection_reaper',
    source=[
        'drop_pending_collection_reaper.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/db/service_context',
        'optime',
        'storage_interface',
    ],
)

env.Library(
    target='scatter_gather',
    source=[
        'scatter_gather_algorithm.cpp',
        'scatter_gather_runner.cpp',
        ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/executor/task_executor_interface',
    ],
)

env.Library(
    target='oplog_buffer_blocking_queue',
    source=[
        'oplog_buffer_blocking_queue.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.Library(
    target='oplog_buffer_collection',
    source=[
        'oplog_buffer_collection.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/service_context',
        'storage_interface',
    ],
)

env.Library(
    target='oplog_buffer_proxy',
    source=[
        'oplog_buffer_proxy.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)


env.Library(
    target='oplog_interface_local',
    source=[
        'oplog_interface_local.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/transaction',
    ],
)

env.Library(
    target='oplog_interface_mock',
    source=[
        'oplog_interface_mock.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/net/network',
        'oplog_entry',
    ],
)

env.Library(
    target='oplog_interface_remote',
    source=[
        'oplog_interface_remote.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/clientdriver_network',
    ],
)

env.Library(
    target='rs_rollback',
    source=[
        'rs_rollback.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/database_holder',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/db/storage/remove_saver',
        '$BUILD_DIR/mongo/util/fail_point',
        'drop_pending_collection_reaper',
        'oplog',
        'replication_process',
        'roll_back_local_operations',
        'rollback_impl',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/index_build_oplog_entry',
        '$BUILD_DIR/mongo/db/storage/journal_flusher',
    ],
)

env.Library(
    target="isself",
    source=[
        'isself.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/util/net/network',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
    ],
)

env.Library(
    target='task_executor_mock',
    source=[
        'task_executor_mock.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/unittest/task_executor_proxy',
    ],
)

env.Library(
    target='rollback_test_fixture',
    source=[
        'rollback_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/read_write_concern_defaults_mock',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        'drop_pending_collection_reaper',
        'oplog_interface_mock',
        'optime',
        'replication_process',
        'replication_recovery',
        'replmocks',
        'rs_rollback',
        'storage_interface_impl',
    ],
)

env.Library(
    target='rollback_impl',
    source=[
        'rollback_impl.cpp',
        env.Idlc('rollback_impl.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/kill_sessions_local',
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/write_ops',
        '$BUILD_DIR/mongo/util/net/network',
        'optime',
        'repl_coordinator_interface',
        'roll_back_local_operations',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/idl/server_parameter',
        'drop_pending_collection_reaper',
    ],
)

env.Library(
    target='oplog_entry',
    source=[
        'oplog_entry.cpp',
        env.Idlc('oplog_entry.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/idl/idl_parser',
        'optime',
        'optime_and_wall_time_base',
    ],
   LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/namespace_string',
    ],
)

env.Library(
    target='optime_and_wall_time_base',
    source=[
        env.Idlc('optime_and_wall_time_base.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.Library(
    target='oplog_application_interface',
    source=[
        'oplog_applier.cpp',
        'oplog_batcher.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        'oplog_entry',
    ],
    LIBDEPS_PRIVATE=[
        'repl_server_parameters',
    ],
)

env.Library(
    target='oplog_application',
    source=[
        'insert_group.cpp',
        'oplog_applier_impl.cpp',
        'oplog_applier_utils.cpp',
        'session_update_tracker.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
        '$BUILD_DIR/mongo/db/curop',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/db/stats/timer_stats',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        '$BUILD_DIR/mongo/util/net/network',
        'initial_syncer',
        'oplog',
        'oplog_application_interface',
        'oplog_entry',
        'repl_coordinator_interface',
        'repl_settings',
        'replication_metrics',
        'storage_interface',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/mongod_fsync',
        '$BUILD_DIR/mongo/db/storage/storage_control',
        'repl_server_parameters',
        'replication_auth',
    ],
)

env.Library(
    target='oplog_entry_test_helpers',
    source=[
        'oplog_entry_test_helpers.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/logical_session_id',
        '$BUILD_DIR/mongo/db/namespace_string',
        'oplog_entry',
        'optime',
    ]
)

env.Library(
    target='idempotency_test_fixture',
    source=[
        'idempotency_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/catalog/collection_validation',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        'oplog_applier_impl_test_fixture',
        'oplog_entry_test_helpers',
    ],
)

env.Library(
    target='oplog_applier_impl_test_fixture',
    source=[
        'oplog_applier_impl_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/document_validation',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger',
        'drop_pending_collection_reaper',
        'oplog_application',
        'replmocks',
        'storage_interface_impl',

    ],
)

env.Library(
    target='idempotency_test_util',
    source=[
        'idempotency_document_structure.cpp',
        'idempotency_scalar_generator.cpp',
        'idempotency_update_sequence.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value'
    ],
)

env.Library(
    target='split_horizon',
    source=[
        'split_horizon.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/util/net/network',
    ],
)

env.Library(
    target='member_data',
    source=[
        'member_data.cpp',
    ],
    LIBDEPS=[
        'replica_set_messages',
    ]
)

env.Library(
    target='topology_coordinator',
    source=[
        'heartbeat_response_action.cpp',
        'topology_coordinator.cpp',
        env.Idlc('topology_coordinator.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/audit',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/util/fail_point',
        'isself',
        'member_data',
        'repl_coordinator_interface',
        'repl_settings',
        'replica_set_messages',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/commit_quorum_options',
        '$BUILD_DIR/mongo/idl/server_parameter',
        'repl_server_parameters',
    ]
)

env.Library(
    target='repl_coordinator_impl',
    source=[
        'check_quorum_for_config_change.cpp',
        'repl_set_config_checks.cpp',
        'replication_coordinator_impl.cpp',
        'replication_coordinator_impl_elect_v1.cpp',
        'replication_coordinator_impl_heartbeat.cpp',
        'vote_requester.cpp',
        env.Idlc('replication_coordinator_impl.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/index/index_descriptor',
        '$BUILD_DIR/mongo/db/kill_sessions_local',
        '$BUILD_DIR/mongo/db/mongod_options',
        '$BUILD_DIR/mongo/db/prepare_conflict_tracker',
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        '$BUILD_DIR/mongo/rpc/command_status',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/transport/transport_layer_common',
        '$BUILD_DIR/mongo/util/fail_point',
        'data_replicator_external_state_initial_sync',
        'initial_syncer',
        'repl_coordinator_interface',
        'repl_settings',
        'replica_set_messages',
        'replication_metrics',
        'replication_process',
        'reporter',
        'scatter_gather',
        'tenant_migration_cloners',
        'topology_coordinator',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_catalog',
        '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/storage/journal_flusher',
        '$BUILD_DIR/mongo/idl/server_parameter',
        'local_oplog_info',
        'repl_server_parameters',
        'replica_set_aware_service',
        'split_horizon',
    ],
)

env.Library(
    target='repl_coordinator_test_fixture',
    source=[
        'replication_coordinator_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/executor/network_interface_factory',
        '$BUILD_DIR/mongo/executor/network_interface_mock',
        '$BUILD_DIR/mongo/executor/network_interface_thread_pool',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor',
        '$BUILD_DIR/mongo/unittest/unittest',
        'repl_coordinator_impl',
        'replmocks',
        'topology_coordinator',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/storage/ephemeral_for_test/storage_ephemeral_for_test',
        '$BUILD_DIR/mongo/db/storage/storage_engine_common',
    ],
)

env.Library(
    target='repl_coordinator_interface',
    source=[
        'always_allow_non_local_writes.cpp',
        'repl_client_info.cpp',
        'replication_coordinator.cpp',
        'replication_coordinator_noop.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/util/net/network',
        'optime',
        'replication_process',
    ],
)

env.Library(
    target='replica_set_aware_service',
    source=[
        'replica_set_aware_service.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/service_context',
    ],
)

env.Library(
    target='replmocks',
    source=[
        'replication_consistency_markers_mock.cpp',
        'replication_coordinator_external_state_mock.cpp',
        'replication_coordinator_mock.cpp',
        'storage_interface_mock.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/executor/network_interface_mock',
        'isself',
        'oplog_buffer_blocking_queue',
        'repl_coordinator_interface',
        'repl_settings',
        'replica_set_messages',
        'storage_interface',
    ],
)

env.Library('read_concern_args',
            [
                'read_concern_args.cpp'
            ],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
                '$BUILD_DIR/mongo/bson/util/bson_extract',
                '$BUILD_DIR/mongo/db/logical_time',
                '$BUILD_DIR/mongo/db/read_write_concern_provenance',
                'optime',
            ])

env.Library('speculative_majority_read_info',
            [
                'speculative_majority_read_info.cpp'
            ],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
                'optime',
            ])

env.Library(
    target='replica_set_messages',
    source=[
        'is_master_response.cpp',
        'member_config.cpp',
        'repl_set_config.cpp',
        'repl_set_config_validators.cpp',
        'repl_set_heartbeat_args_v1.cpp',
        'repl_set_heartbeat_response.cpp',
        'repl_set_request_votes_args.cpp',
        'repl_set_tag.cpp',
        'repl_set_write_concern_mode_definitions.cpp',
        'update_position_args.cpp',
        'last_vote.cpp',
        env.Idlc('member_config.idl')[0],
        env.Idlc('repl_set_config.idl')[0],
        env.Idlc('repl_set_config_params.idl')[0],
            ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/bson/util/bson_extract',
        '$BUILD_DIR/mongo/client/connection_string',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/rpc/command_status',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/transport/transport_layer_common',
        '$BUILD_DIR/mongo/util/net/network',
        'optime',
        'read_concern_args',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/idl/server_parameter',
        'repl_server_parameters',
        'split_horizon',
    ]
)

env.Library(
    target='repl_set_status_commands',
    source=[
        'repl_set_command.cpp',
        'repl_set_get_status_cmd.cpp',
        'repl_set_test_egress.cpp',
        env.Idlc('repl_set_test_egress.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/db/auth/authprivilege',
        '$BUILD_DIR/mongo/db/commands',
        '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
        '$BUILD_DIR/mongo/db/lasterror',
        '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/executor/connection_pool_executor',
        '$BUILD_DIR/mongo/executor/network_interface',
        '$BUILD_DIR/mongo/executor/network_interface_factory',
        '$BUILD_DIR/mongo/executor/network_interface_tl',
    ],
)

env.Library(
    target='repl_set_commands',
    source=[
        'repl_set_commands.cpp',
        'repl_set_request_votes.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/commands',
        '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/lasterror',
        '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        'drop_pending_collection_reaper',
        'repl_server_parameters',
        'repl_set_status_commands',
        'repl_settings',
        'replica_set_messages',
        'replication_process',
        'serveronly_repl',
    ],
)

env.Library(
    target='oplog_fetcher',
    source=[
        'oplog_fetcher.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/db/logical_time_metadata_hook',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/db/stats/counters',
        '$BUILD_DIR/mongo/db/stats/timer_stats',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        'abstract_async_component',
        'repl_coordinator_interface',
        'replica_set_messages',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/server_status_core',
        '$BUILD_DIR/mongo/db/matcher/expressions',
        'repl_server_parameters',
        'replication_auth',
    ],
)

env.Library(
    target='reporter',
    source=[
        'reporter.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/executor/remote_command',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        '$BUILD_DIR/mongo/rpc/command_status',
        'replica_set_messages',
    ],
)

env.Library(
    target='sync_source_resolver',
    source=[
        'sync_source_resolver.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/fetcher',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/util/net/network',
        'oplog_entry',
        'optime',
        'read_concern_args',
    ],
)

env.Library(
    target='sync_source_selector_mock',
    source=[
        'sync_source_selector_mock.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/util/net/network',
        'optime',
    ],
)

env.Library(
    target='initial_sync_cloners',
    source=[
        'all_database_cloner.cpp',
        'collection_cloner.cpp',
        'database_cloner.cpp',
        'initial_sync_base_cloner.cpp',
    ],
    LIBDEPS = [
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        '$BUILD_DIR/mongo/util/net/network',
        'base_cloner',
        'cloner_utils',
        'member_data',
        'repl_sync_shared_data',
        'replication_consistency_markers_impl',
        'task_runner',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/list_collections_filter',
        '$BUILD_DIR/mongo/db/index_build_entry_helpers',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/util/progress_meter',
        'repl_server_parameters',
        'replication_auth',
    ]
)

env.Library(
    target='tenant_migration_cloners',
    source=[
        'tenant_all_database_cloner.cpp',
        'tenant_collection_cloner.cpp',
        'tenant_database_cloner.cpp',
        'tenant_base_cloner.cpp',
    ],
    LIBDEPS = [
        '$BUILD_DIR/mongo/base',
        'base_cloner',
        'cloner_utils',
        'repl_sync_shared_data',
        'task_runner',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/list_collections_filter',
        '$BUILD_DIR/mongo/rpc/metadata',
        '$BUILD_DIR/mongo/util/progress_meter',
        'repl_server_parameters',
    ]
)

env.Library(
    target='task_runner',
    source=[
        'task_runner.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
    ],
)

env.Library(
    target='optime',
    source=[
        'bson_extract_optime.cpp',
        'optime.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/bson/util/bson_extract',
        'optime_and_wall_time_base',
    ],
)

env.Library(
    target='multiapplier',
    source=[
        'multiapplier.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        'oplog_entry',
    ],
)

env.Library(
    target='data_replicator_external_state_impl',
    source=[
        'data_replicator_external_state_impl.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        'oplog_application',
        'oplog_buffer_blocking_queue',
        'oplog_buffer_collection',
        'oplog_buffer_proxy',
        'optime',
        'repl_coordinator_interface',
        'storage_interface',
    ],
    LIBDEPS_PRIVATE=[
        'repl_server_parameters',
    ],
)

env.Library(
    target='data_replicator_external_state_initial_sync',
    source=[
        'data_replicator_external_state_initial_sync.cpp',
    ],
    LIBDEPS=[
        'data_replicator_external_state_impl',
    ],
)

env.Library(
    target='data_replicator_external_state_mock',
    source=[
        'data_replicator_external_state_mock.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/util/net/network',
        'oplog_application_interface',
        'oplog_buffer_blocking_queue',
        'oplog_entry',
        'optime',
        'replica_set_messages',
    ],
)

env.Library(
    target='repl_sync_shared_data',
    source=[
        'repl_sync_shared_data.cpp',
        'initial_sync_shared_data.cpp',
        'tenant_migration_shared_data.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ]
)

env.Library(
    target='base_cloner',
    source=[
        'base_cloner.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/util/fail_point',
        'repl_sync_shared_data',
    ],
    LIBDEPS_PRIVATE=[
        'repl_server_parameters',
        'replication_consistency_markers_impl',
    ]
)

env.Library(
    target='cloner_utils',
    source=[
        'cloner_utils.cpp',
        'database_cloner_common.cpp',
        env.Idlc('database_cloner.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/idl/idl_parser',
        'read_concern_args',
    ]
)

env.Library(
    target='initial_syncer',
    source=[
        'initial_syncer.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/client/fetcher',
        '$BUILD_DIR/mongo/db/commands/server_status_core',
        '$BUILD_DIR/mongo/db/transaction',
        'initial_sync_cloners',
        'multiapplier',
        'oplog',
        'oplog_application_interface',
        'oplog_buffer_blocking_queue',
        'oplog_entry',
        'oplog_fetcher',
        'optime',
        'repl_sync_shared_data',
        'rollback_checker',
        'storage_interface',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/feature_compatibility_parsers',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/executor/scoped_task_executor',
        'repl_server_parameters',
    ]
)

env.Library(
    target='rollback_checker',
    source=[
        'rollback_checker.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/executor/task_executor_interface',
    ],
)

env.Library(
    target='roll_back_local_operations',
    source=[
        'roll_back_local_operations.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/fail_point',
        'oplog_entry',
        'optime',
    ],
)

env.Library(
    target="replication_info",
    source=[
        "replication_info.cpp",
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/db/auth/saslauth',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/query_exec',
        "$BUILD_DIR/mongo/util/fail_point",
        'oplog',
        'repl_coordinator_interface',
        'repl_settings',
        'replica_set_messages',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/server_status',
        '$BUILD_DIR/mongo/db/repl/speculative_authenticate',
        '$BUILD_DIR/mongo/db/stats/counters',
        '$BUILD_DIR/mongo/transport/message_compressor',
        'primary_only_service',
        'replication_auth',
        'split_horizon',
    ],
)

env.Library(
    target='tenant_migration_conflict_info',
    source= [
        'tenant_migration_conflict_info.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.Library(
    target='tenant_migration_state_machine_idl',
    source=[
        env.Idlc('tenant_migration_state_machine.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/read_preference',
        '$BUILD_DIR/mongo/idl/idl_parser',
        'optime',
    ],
)

env.Library(
    target='tenant_migration_recipient_utils',
    source=[
        "tenant_migration_recipient_entry_helpers.cpp",
    ],
    LIBDEPS_PRIVATE=[
        "$BUILD_DIR/mongo/base",
        "$BUILD_DIR/mongo/db/catalog_raii",
        "$BUILD_DIR/mongo/db/dbhelpers",
        "$BUILD_DIR/mongo/db/namespace_string",
        '$BUILD_DIR/mongo/db/service_context',
        "$BUILD_DIR/mongo/db/storage/write_unit_of_work",
        "tenant_migration_state_machine_idl",
    ],
)

env.Library(
    target='tenant_migration_recipient_service',
    source= [
        'tenant_migration_recipient_service.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/read_preference',
        'primary_only_service',
        'tenant_migration_recipient_utils',
        'wait_for_majority_service',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/db/transaction',
        'oplog_entry',
        'tenant_migration_state_machine_idl',
    ]
)

env.Library(
    target='tenant_migration_donor',
    source=[
        'tenant_migration_access_blocker.cpp',
        'tenant_migration_access_blocker_by_prefix.cpp',
        'tenant_migration_access_blocker_server_status_section.cpp',
        'tenant_migration_donor_op_observer.cpp',
        'tenant_migration_donor_util.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/remote_command_targeter',
        '$BUILD_DIR/mongo/db/catalog_raii',
        '$BUILD_DIR/mongo/db/commands/server_status',
        '$BUILD_DIR/mongo/db/commands/tenant_migration_cmds_request',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/rw_concern_d',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/executor/network_interface_factory',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor',
        'local_oplog_info',
        'optime',
        'repl_coordinator_interface',
        'tenant_migration_conflict_info',
        'tenant_migration_state_machine_idl'
    ],
)

env.Library(
    target='tenant_migration_donor_service',
    source=[
        'tenant_migration_donor_service.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/util/future_util',
        'primary_only_service',
        'repl_server_parameters',
        'tenant_migration_donor',
        'wait_for_majority_service',
    ],
)

env.Library(
    target="serveronly_repl",
    source=[
        'noop_writer.cpp',
        "replication_coordinator_external_state_impl.cpp",
        "sync_source_feedback.cpp",
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/cloner',
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/curop',
        '$BUILD_DIR/mongo/db/free_mon/free_mon_mongod',
        '$BUILD_DIR/mongo/db/kill_sessions_local',
        '$BUILD_DIR/mongo/db/lasterror',
        '$BUILD_DIR/mongo/db/logical_time',
        '$BUILD_DIR/mongo/db/op_observer',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/repl/oplog_buffer_proxy',
        '$BUILD_DIR/mongo/db/repl/replication_metrics',
        '$BUILD_DIR/mongo/db/s/balancer',
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/stats/counters',
        '$BUILD_DIR/mongo/db/system_index',
        '$BUILD_DIR/mongo/db/vector_clock',
        '$BUILD_DIR/mongo/rpc/client_metadata',
        '$BUILD_DIR/mongo/util/fail_point',
        'bgsync',
        'drop_pending_collection_reaper',
        'oplog_application',
        'oplog_buffer_collection',
        'oplog_interface_remote',
        'optime',
        'primary_only_service',
        'repl_coordinator_interface',
        'repl_settings',
        'replication_consistency_markers_impl',
        'replication_info',
        'replication_process',
        'replication_recovery',
        'reporter',
        'rollback_source_impl',
        'tenant_migration_donor',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/mongod_fcv',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/storage/flow_control',
        '$BUILD_DIR/mongo/db/storage/storage_control',
        'local_oplog_info',
        'repl_server_parameters',
    ],
)

env.Library(
    target='mock_repl_coord_server_fixture',
    source=[
        'mock_repl_coord_server_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog_raii',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        'drop_pending_collection_reaper',
        'oplog',
        'oplog_entry',
        'replmocks',
    ]
)

env.CppUnitTest(
    target='db_repl_test',
    source=[
        'abstract_async_component_test.cpp',
        'apply_ops_test.cpp',
        'check_quorum_for_config_change_test.cpp',
        'drop_pending_collection_reaper_test.cpp',
        'idempotency_document_structure_test.cpp',
        'idempotency_test.cpp',
        'idempotency_update_sequence_test.cpp',
        'initial_syncer_test.cpp',
        'isself_test.cpp',
        'member_config_test.cpp',
        'multiapplier_test.cpp',
        'oplog_applier_impl_test.cpp',
        'oplog_applier_test.cpp',
        'oplog_batcher_test_fixture.cpp',
        'oplog_buffer_collection_test.cpp',
        'oplog_buffer_proxy_test.cpp',
        'oplog_entry_test.cpp',
        'oplog_fetcher_mock.cpp',
        'oplog_fetcher_test.cpp',
        'oplog_test.cpp',
        'optime_extract_test.cpp',
        'primary_only_service_test.cpp',
        'read_concern_args_test.cpp',
        'repl_set_config_checks_test.cpp',
        'repl_set_config_test.cpp',
        'repl_set_heartbeat_response_test.cpp',
        'repl_set_tag_test.cpp',
        'repl_set_write_concern_mode_definitions_test.cpp',
        'replication_consistency_markers_impl_test.cpp',
        'replication_process_test.cpp',
        'replication_recovery_test.cpp',
        'reporter_test.cpp',
        'roll_back_local_operations_test.cpp',
        'rollback_checker_test.cpp',
        'rollback_impl_test.cpp',
        'rs_rollback_test.cpp',
        'scatter_gather_test.cpp',
        'speculative_majority_read_info_test.cpp',
        'split_horizon_test.cpp',
        'storage_interface_impl_test.cpp',
        'sync_source_resolver_test.cpp',
        'task_runner_test.cpp',
        'task_runner_test_fixture.cpp',
        'tenant_oplog_applier_test.cpp',
        'tenant_oplog_batcher_test.cpp',
        'vote_requester_test.cpp',
        'wait_for_majority_service_test.cpp',
        'tenant_migration_recipient_service_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/bson/mutable/mutable_bson',
        '$BUILD_DIR/mongo/client/replica_set_monitor_protocol_test_util',
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/catalog_raii',
        '$BUILD_DIR/mongo/db/commands/feature_compatibility_parsers',
        '$BUILD_DIR/mongo/db/commands/mongod_fcv',
        '$BUILD_DIR/mongo/db/commands/txn_cmd_request',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/index/index_access_methods',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_mongod',
        '$BUILD_DIR/mongo/db/logical_session_id_helpers',
        '$BUILD_DIR/mongo/db/logical_time',
        '$BUILD_DIR/mongo/db/op_observer',
        '$BUILD_DIR/mongo/db/query/command_request_response',
        '$BUILD_DIR/mongo/db/service_context_d',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/db/service_context_test_fixture',
        '$BUILD_DIR/mongo/db/stats/counters',
        '$BUILD_DIR/mongo/db/storage/ephemeral_for_test/storage_ephemeral_for_test_core',
        '$BUILD_DIR/mongo/db/transaction',
        '$BUILD_DIR/mongo/db/update/update_test_helpers',
        '$BUILD_DIR/mongo/dbtests/mocklib',
        '$BUILD_DIR/mongo/executor/network_interface_factory',
        '$BUILD_DIR/mongo/executor/network_interface_mock',
        '$BUILD_DIR/mongo/executor/network_interface_thread_pool',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
        '$BUILD_DIR/mongo/rpc/command_status',
        '$BUILD_DIR/mongo/transport/transport_layer_mock',
        '$BUILD_DIR/mongo/unittest/task_executor_proxy',
        '$BUILD_DIR/mongo/unittest/unittest',
        '$BUILD_DIR/mongo/util/clock_source_mock',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        'abstract_async_component',
        'data_replicator_external_state_mock',
        'drop_pending_collection_reaper',
        'idempotency_test_fixture',
        'idempotency_test_util',
        'initial_syncer',
        'isself',
        'multiapplier',
        'oplog',
        'oplog_application_interface',
        'oplog_applier_impl_test_fixture',
        'oplog_buffer_collection',
        'oplog_buffer_proxy',
        'oplog_entry',
        'oplog_entry_test_helpers',
        'oplog_fetcher',
        'oplog_interface_local',
        'oplog_interface_mock',
        'oplog_interface_remote',
        'optime',
        'primary_only_service',
        'repl_coordinator_impl',
        'repl_server_parameters',
        'replica_set_messages',
        'replication_consistency_markers_impl',
        'replication_process',
        'replication_recovery',
        'replmocks',
        'reporter',
        'roll_back_local_operations',
        'rollback_checker',
        'rollback_impl',
        'rollback_test_fixture',
        'rs_rollback',
        'scatter_gather',
        'speculative_majority_read_info',
        'split_horizon',
        'storage_interface_impl',
        'sync_source_resolver',
        'sync_source_selector_mock',
        'task_executor_mock',
        'task_runner',
        'tenant_migration_recipient_service',
        'tenant_oplog_processing',
        'wait_for_majority_service',
    ],
)

# The following two tests appear to clash when combined with the above list.

env.CppUnitTest(
    target='db_repl_coordinator_test',
    source=[
        'replication_coordinator_impl_elect_v1_test.cpp',
        'replication_coordinator_impl_heartbeat_v1_test.cpp',
        'replication_coordinator_impl_reconfig_test.cpp',
        'replication_coordinator_impl_test.cpp',
        'topology_coordinator_v1_test.cpp',
    ],
    LIBDEPS=[
        'isself',
        'repl_coordinator_impl',
        'repl_coordinator_test_fixture',
        'repl_server_parameters',
        'topology_coordinator',
    ]
)

env.CppUnitTest(
    target='topology_version_observer_test',
    source=[
        'topology_version_observer_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/bson/util/bson_extract',
        '$BUILD_DIR/mongo/util/clock_sources',
        'repl_coordinator_impl',
        'repl_coordinator_test_fixture',
        'topology_version_observer',
    ]
)

env.CppUnitTest(
    target='db_repl_cloners_test',
    source=[
        'all_database_cloner_test.cpp',
        'cloner_test_fixture.cpp',
        'collection_cloner_test.cpp',
        'database_cloner_test.cpp',
        'initial_sync_cloner_test_fixture.cpp',
        'initial_sync_shared_data_test.cpp',
        'tenant_all_database_cloner_test.cpp',
        'tenant_collection_cloner_test.cpp',
        'tenant_database_cloner_test.cpp',
        'tenant_cloner_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',  # Required for service context test fixture
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/dbtests/mocklib',
        '$BUILD_DIR/mongo/util/clock_source_mock',
        'initial_sync_cloners',
        'repl_server_parameters',
        'repl_sync_shared_data',
        'replmocks',
        'tenant_migration_cloners'
    ],
)

env.CppUnitTest(
    target='db_repl_set_aware_service_test',
    source=[
        'replica_set_aware_service_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/service_context_test_fixture',
        'repl_coordinator_impl',
        'repl_coordinator_test_fixture',
        'replica_set_aware_service',
    ],
)

env.Library(
    target='replication_metrics',
    source=[
        'replication_metrics.cpp',
        env.Idlc('replication_metrics.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/commands/server_status',
        '$BUILD_DIR/mongo/db/service_context',
        'election_reason_counter',
        'election_reason_counter_parser',
        'topology_coordinator',
    ],
)

env.Library(
    target='election_reason_counter',
    source=[
        'election_reason_counter.cpp',
        env.Idlc('election_reason_counter.idl')[0],
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.Library(
    target='election_reason_counter_parser',
    source=[
        'election_reason_counter_parser.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        'election_reason_counter',
    ],
)

env.Library(
    target='topology_version_observer',
    source=[
        'topology_version_observer.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/service_context',
        'repl_coordinator_interface',
        'replica_set_messages',
    ],
)

env.Library(
    target='speculative_authenticate',
    source=[
        'speculative_auth.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/auth/authservercommon',
        '$BUILD_DIR/mongo/db/commands/authentication_commands',
    ],
)

env.Library(
    target='wait_for_majority_service',
    source=[
        'wait_for_majority_service.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/rw_concern_d',
    ],
)

env.Library(
    target='primary_only_service',
    source=[
        'primary_only_service.cpp',
        'primary_only_service_op_observer.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/executor/task_executor_interface',
        'replica_set_aware_service',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/db_raii',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/logical_time_metadata_hook',
        '$BUILD_DIR/mongo/executor/connection_pool_executor',
        '$BUILD_DIR/mongo/executor/network_interface',
        '$BUILD_DIR/mongo/executor/network_interface_factory',
        '$BUILD_DIR/mongo/executor/network_interface_thread_pool',
        '$BUILD_DIR/mongo/executor/network_interface_tl',
        '$BUILD_DIR/mongo/executor/scoped_task_executor',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor',
        '$BUILD_DIR/mongo/util/concurrency/thread_pool',
        'repl_coordinator_interface',
        'wait_for_majority_service',
    ],
)

env.Library(
    target='tenant_oplog_processing',
    source=[
        'tenant_oplog_batcher.cpp',
        'tenant_oplog_applier.cpp'
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
        'abstract_async_component',
        'cloner_utils',
        'oplog',
        'oplog_application',
        'oplog_application_interface',
    ],
)
