# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Library(
    target='balancer_stats_registry',
    source=[
        'balancer_stats_registry.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/repl/replica_set_aware_service',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/s/grid',
    ],
)

env.Library(
    target='sharding_catalog',
    source=[
        'shard_authoritative_catalog.idl',
        'sharding_index_catalog_ddl_util.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/catalog/collection_crud',
        '$BUILD_DIR/mongo/db/concurrency/exception_util',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/ops/write_ops',
        '$BUILD_DIR/mongo/db/query/query_stats/query_stats',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/db/shard_role_api',
        '$BUILD_DIR/mongo/s/common_s',
    ],
)

env.Library(
    target='query_analysis_writer',
    source=[
        'query_analysis_writer.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/ops/write_ops_parsers',
        '$BUILD_DIR/mongo/db/repl/replica_set_aware_service',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/s/analyze_shard_key_common',
        '$BUILD_DIR/mongo/s/analyze_shard_key_util',
    ],
)

env.Library(
    target='sharding_runtime_d',
    source=[
        'active_migrations_registry.cpp',
        'analyze_shard_key_read_write_distribution.cpp',
        'auto_split_vector.cpp',
        'chunk_move_write_concern_options.cpp',
        'chunk_operation_precondition_checks.cpp',
        'collection_critical_section_document.idl',
        'collection_sharding_runtime.cpp',
        'collection_sharding_state_factory_shard.cpp',
        'commit_chunk_migration.idl',
        'config_server_op_observer.cpp',
        'document_source_analyze_shard_key_read_write_distribution.cpp',
        'document_source_analyze_shard_key_read_write_distribution.idl',
        'global_index/common_types.idl',
        'global_index/global_index_cloner.idl',
        'global_index/global_index_cloner_fetcher.cpp',
        'global_index/global_index_cloner_fetcher_factory.cpp',
        'global_index/global_index_cloning_external_state.cpp',
        'global_index/global_index_cloning_service.cpp',
        'global_index/global_index_cumulative_metrics.cpp',
        'global_index/global_index_cumulative_metrics_field_name_provider.cpp',
        'global_index/global_index_inserter.cpp',
        'global_index/global_index_metrics.cpp',
        'global_index/global_index_metrics_field_name_provider.cpp',
        'global_index/global_index_server_parameters.idl',
        'global_index/global_index_util.cpp',
        'global_index_crud_commands.idl',
        'metadata_consistency_util.cpp',
        'metadata_manager.cpp',
        'metrics/phase_duration.cpp',
        'metrics/sharding_data_transform_cumulative_metrics.cpp',
        'metrics/sharding_data_transform_instance_metrics.cpp',
        'metrics/sharding_data_transform_metrics.cpp',
        'metrics/sharding_data_transform_metrics_observer.cpp',
        'metrics/field_names/sharding_data_transform_cumulative_metrics_field_name_provider.cpp',
        'metrics/field_names/sharding_data_transform_instance_metrics_field_name_provider.cpp',
        'migration_batch_fetcher.cpp',
        'migration_batch_inserter.cpp',
        'migration_chunk_cloner_source.cpp',
        'migration_coordinator.cpp',
        'migration_coordinator_document.idl',
        'migration_destination_manager.cpp',
        'migration_recipient_recovery_document.idl',
        'migration_session_id.cpp',
        'migration_source_manager.cpp',
        'migration_util.cpp',
        'move_primary_source_manager.cpp',
        'move_timing_helper.cpp',
        'namespace_metadata_change_notifications.cpp',
        'op_observer_sharding_impl.cpp',
        'periodic_sharded_index_consistency_checker.cpp',
        'query_analysis_coordinator.cpp',
        'query_analysis_op_observer.cpp',
        'range_deleter_service.cpp',
        'range_deleter_service_op_observer.cpp',
        'range_deletion_task.idl',
        'range_deletion_util.cpp',
        'read_only_catalog_cache_loader.cpp',
        'resharding/coordinator_document.idl',
        'resharding/document_source_resharding_add_resume_id.cpp',
        'resharding/document_source_resharding_iterate_transaction.cpp',
        'resharding/document_source_resharding_ownership_match.cpp',
        'resharding/donor_document.idl',
        'resharding/donor_oplog_id.idl',
        'resharding/recipient_document.idl',
        'resharding/resharding_change_event_o2_field.idl',
        'resharding/resharding_collection_cloner.cpp',
        'resharding/resharding_coordinator_commit_monitor.cpp',
        'resharding/resharding_coordinator_observer.cpp',
        'resharding/resharding_coordinator_service.cpp',
        'resharding/resharding_cumulative_metrics.cpp',
        'resharding/resharding_data_copy_util.cpp',
        'resharding/resharding_data_replication.cpp',
        'resharding/resharding_donor_oplog_iterator.cpp',
        'resharding/resharding_donor_recipient_common.cpp',
        'resharding/resharding_donor_service.cpp',
        'resharding/resharding_future_util.cpp',
        'resharding/resharding_manual_cleanup.cpp',
        'resharding/resharding_metrics.cpp',
        'resharding/resharding_metrics_helpers.cpp',
        'resharding/resharding_op_observer.cpp',
        'resharding/resharding_oplog_application.cpp',
        'resharding/resharding_oplog_applier.cpp',
        'resharding/resharding_oplog_applier_metrics.cpp',
        'resharding/resharding_oplog_applier_progress.idl',
        'resharding/resharding_oplog_batch_applier.cpp',
        'resharding/resharding_oplog_batch_preparer.cpp',
        'resharding/resharding_oplog_fetcher.cpp',
        'resharding/resharding_oplog_session_application.cpp',
        'resharding/resharding_recipient_service.cpp',
        'resharding/resharding_recipient_service_external_state.cpp',
        'resharding/resharding_server_parameters.idl',
        'resharding/resharding_txn_cloner.cpp',
        'resharding/resharding_txn_cloner_progress.idl',
        'resharding/resharding_util.cpp',
        'scoped_operation_completion_sharding_actions.cpp',
        'session_catalog_migration.cpp',
        'session_catalog_migration_destination.cpp',
        'session_catalog_migration_source.cpp',
        'shard_filtering_metadata_refresh.cpp',
        'shard_identity_rollback_notifier.cpp',
        'shard_key_util.cpp',
        'shard_local.cpp',
        'shard_metadata_util.cpp',
        'shard_server_catalog_cache_loader.cpp',
        'shard_server_op_observer.cpp',
        'sharding_initialization_mongod.cpp',
        'sharding_recovery_service.cpp',
        'sharding_runtime_d_params.idl',
        'sharding_state_recovery.cpp',
        'split_chunk.cpp',
        'split_vector.cpp',
        'start_chunk_clone_request.cpp',
        'type_shard_collection.cpp',
        'type_shard_collection.idl',
        'type_shard_database.cpp',
        'type_shard_database.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/remote_command_targeter',
        '$BUILD_DIR/mongo/db/catalog/index_key_validate',
        '$BUILD_DIR/mongo/db/catalog/multi_index_block',
        '$BUILD_DIR/mongo/db/client_metadata_propagation_egress_hook',
        '$BUILD_DIR/mongo/db/cloner',
        '$BUILD_DIR/mongo/db/commands/mongod_fcv',
        '$BUILD_DIR/mongo/db/concurrency/exception_util',
        '$BUILD_DIR/mongo/db/dbhelpers',
        '$BUILD_DIR/mongo/db/metadata_consistency_types_idl',
        '$BUILD_DIR/mongo/db/op_observer/op_observer_impl',
        '$BUILD_DIR/mongo/db/op_observer/op_observer_util',
        '$BUILD_DIR/mongo/db/ops/write_ops_exec',
        '$BUILD_DIR/mongo/db/pipeline/aggregation_request_helper',
        '$BUILD_DIR/mongo/db/repl/abstract_async_component',
        '$BUILD_DIR/mongo/db/repl/change_stream_oplog_notification',
        '$BUILD_DIR/mongo/db/repl/oplog',
        '$BUILD_DIR/mongo/db/rw_concern_d',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/db/transaction/transaction',
        '$BUILD_DIR/mongo/db/vector_clock_mongod',
        '$BUILD_DIR/mongo/s/analyze_shard_key_util',
        '$BUILD_DIR/mongo/s/query/cluster_aggregate',
        '$BUILD_DIR/mongo/s/sharding_api',
        '$BUILD_DIR/mongo/s/sharding_initialization',
        'forwardable_operation_metadata',
        'sharding_catalog_manager',
        'transaction_coordinator',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/client/clientdriver_minimal',
        '$BUILD_DIR/mongo/crypto/encrypted_field_config',
        '$BUILD_DIR/mongo/crypto/fle_crypto',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/collection_crud',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/internal_transactions_feature_flag',
        '$BUILD_DIR/mongo/db/keys_collection_client_direct',
        '$BUILD_DIR/mongo/db/ops/write_ops',
        '$BUILD_DIR/mongo/db/repl/image_collection_entry',
        '$BUILD_DIR/mongo/db/repl/primary_only_service',
        '$BUILD_DIR/mongo/db/repl/replica_set_aware_service',
        '$BUILD_DIR/mongo/db/repl/wait_for_majority_service',
        '$BUILD_DIR/mongo/db/rs_local_client',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/session/session_catalog',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
        '$BUILD_DIR/mongo/db/storage/remove_saver',
        '$BUILD_DIR/mongo/db/timeseries/bucket_catalog/bucket_catalog',
        '$BUILD_DIR/mongo/db/transaction/transaction_operations',
        '$BUILD_DIR/mongo/executor/inline_executor',
        '$BUILD_DIR/mongo/s/common_s',
        '$BUILD_DIR/mongo/util/future_util',
        'balancer_stats_registry',
        'query_analysis_writer',
        'sharding_catalog',
        'sharding_logging',
    ],
)

env.Library(
    target='user_writes_recoverable_critical_section',
    source=[
        'user_writes_critical_section_document.idl',
        'user_writes_recoverable_critical_section_service.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/repl/replica_set_aware_service',
        '$BUILD_DIR/mongo/db/rw_concern_d',
        '$BUILD_DIR/mongo/db/shard_role_api',
    ],
)

env.Library(
    target='transaction_coordinator',
    source=[
        'server_transaction_coordinators_metrics.cpp',
        'single_transaction_coordinator_stats.cpp',
        'transaction_coordinator_catalog.cpp',
        'transaction_coordinator_curop_mongod.cpp',
        'transaction_coordinator_document.idl',
        'transaction_coordinator_factory_mongod.cpp',
        'transaction_coordinator_futures_util.cpp',
        'transaction_coordinator_metrics_observer.cpp',
        'transaction_coordinator_params.idl',
        'transaction_coordinator_service.cpp',
        'transaction_coordinator_structures.cpp',
        'transaction_coordinator_util.cpp',
        'transaction_coordinator_worker_curop_repository_mongod.cpp',
        'transaction_coordinator.cpp',
        'transaction_coordinators_stats.idl',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/commands/server_status_core',
        '$BUILD_DIR/mongo/db/commands/txn_cmd_request',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/internal_transactions_feature_flag',
        '$BUILD_DIR/mongo/db/not_primary_error_tracker',
        '$BUILD_DIR/mongo/db/repl/wait_for_majority_service',
        '$BUILD_DIR/mongo/db/rw_concern_d',
        '$BUILD_DIR/mongo/db/shard_role_api',
        '$BUILD_DIR/mongo/db/transaction/transaction',
        '$BUILD_DIR/mongo/db/vector_clock_mongod',
        '$BUILD_DIR/mongo/executor/task_executor_pool',
        '$BUILD_DIR/mongo/s/grid',
    ],
)

env.Library(
    target='forwardable_operation_metadata',
    source=[
        'forwardable_operation_metadata.cpp',
        'forwardable_operation_metadata.idl',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/write_block_bypass',
        '$BUILD_DIR/mongo/rpc/metadata_impersonated_user',
    ],
)

env.Library(
    target='sharding_catalog_manager',
    source=[
        'add_shard_cmd.idl',
        'add_shard_util.cpp',
        'balancer/auto_merger_policy.cpp',
        'balancer/balance_stats.cpp',
        'balancer/balancer_chunk_selection_policy_impl.cpp',
        'balancer/balancer_chunk_selection_policy.cpp',
        'balancer/balancer_commands_scheduler_impl.cpp',
        'balancer/balancer_defragmentation_policy_impl.cpp',
        'balancer/balancer_policy.cpp',
        'balancer/balancer.cpp',
        'balancer/cluster_statistics_impl.cpp',
        'balancer/cluster_statistics.cpp',
        'config/initial_split_policy.cpp',
        'config/placement_history_cleaner.cpp',
        'config/sharding_catalog_manager_chunk_operations.cpp',
        'config/sharding_catalog_manager_collection_operations.cpp',
        'config/sharding_catalog_manager_database_operations.cpp',
        'config/sharding_catalog_manager_shard_operations.cpp',
        'config/sharding_catalog_manager_zone_operations.cpp',
        'config/sharding_catalog_manager.cpp',
        'config/index_on_config.cpp',
        'ddl_lock_manager.cpp',
        'participant_block.idl',
        'remove_tags.idl',
        'sharded_index_catalog_commands.idl',
        'sharding_cluster_parameters.idl',
        'sharding_config_server_parameters.idl',
        'sharding_ddl_util.cpp',
        'sharding_index_catalog_util.cpp',
        'sharding_util.cpp',
        'split_chunk_request_type.cpp',
        'type_shard_identity.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/bson/util/bson_extract',
        '$BUILD_DIR/mongo/client/fetcher',
        '$BUILD_DIR/mongo/db/audit',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/cluster_transaction_api',
        '$BUILD_DIR/mongo/db/commands/cluster_server_parameter_commands_invocation',
        '$BUILD_DIR/mongo/db/commands/mongod_fcv',
        '$BUILD_DIR/mongo/db/commands/notify_sharding_event_idl',
        '$BUILD_DIR/mongo/db/commands/set_feature_compatibility_version_idl',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/concurrency/exception_util',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/internal_transactions_feature_flag',
        '$BUILD_DIR/mongo/db/keys_collection_util',
        '$BUILD_DIR/mongo/db/pipeline/process_interface/shardsvr_process_interface',
        '$BUILD_DIR/mongo/db/pipeline/sharded_agg_helpers',
        '$BUILD_DIR/mongo/db/repl/hello_command',
        '$BUILD_DIR/mongo/db/repl/read_concern_args',
        '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
        '$BUILD_DIR/mongo/db/repl/replica_set_aware_service',
        '$BUILD_DIR/mongo/db/repl/tenant_migration_access_blocker',
        '$BUILD_DIR/mongo/db/rw_concern_d',
        '$BUILD_DIR/mongo/db/server_feature_flags',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/db/snapshot_window_options',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/db/transaction/transaction',
        '$BUILD_DIR/mongo/db/transaction/transaction_api',
        '$BUILD_DIR/mongo/db/vector_clock_mongod',
        '$BUILD_DIR/mongo/executor/inline_executor',
        '$BUILD_DIR/mongo/executor/network_interface',
        '$BUILD_DIR/mongo/idl/cluster_server_parameter_common',
        '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
        '$BUILD_DIR/mongo/s/client/sharding_client',
        '$BUILD_DIR/mongo/s/common_s',
        '$BUILD_DIR/mongo/s/coreshard',
        '$BUILD_DIR/mongo/s/query/cluster_aggregate',
        '$BUILD_DIR/mongo/util/log_and_backoff',
        '$BUILD_DIR/mongo/util/pcre_wrapper',
        'forwardable_operation_metadata',
        'sharding_logging',
        'user_writes_recoverable_critical_section',
    ],
)

env.Library(
    target='sharding_commands_d',
    source=[
        'add_shard_cmd.cpp',
        'analyze_shard_key_cmd.cpp',
        'analyze_shard_key_cmd_util.cpp',
        'auto_split_vector_command.cpp',
        'check_sharding_index_command.cpp',
        'cleanup_orphaned_cmd.cpp',
        'clone_catalog_data_command.cpp',
        'cluster_abort_transaction_cmd_d.cpp',
        'cluster_commit_transaction_cmd_d.cpp',
        'cluster_count_cmd_d.cpp',
        'cluster_find_cmd_d.cpp',
        'cluster_getmore_cmd_d.cpp',
        'cluster_pipeline_cmd_d.cpp',
        'cluster_write_cmd_d.cpp',
        'collmod_coordinator_document.idl',
        'collmod_coordinator.cpp',
        'compact_structured_encryption_data_coordinator.cpp',
        'compact_structured_encryption_data_coordinator.idl',
        'configure_query_analyzer_cmd.cpp',
        'config/configsvr_abort_reshard_collection_command.cpp',
        'config/configsvr_add_shard_command.cpp',
        'config/configsvr_add_shard_to_zone_command.cpp',
        'config/configsvr_balancer_collection_status_command.cpp',
        'config/configsvr_check_cluster_metadata_consistency_command.cpp',
        'config/configsvr_check_metadata_consistency_command.cpp',
        'config/configsvr_cleanup_reshard_collection_command.cpp',
        'config/configsvr_clear_jumbo_flag_command.cpp',
        'config/configsvr_collmod_command.cpp',
        'config/configsvr_commit_chunk_migration_command.cpp',
        'config/configsvr_commit_index_command.cpp',
        'config/configsvr_commit_move_primary_command.cpp',
        'config/configsvr_commit_reshard_collection_command.cpp',
        'config/configsvr_configure_collection_balancing.cpp',
        'config/configsvr_control_balancer_command.cpp',
        'config/configsvr_coordinator_service.cpp',
        'config/configsvr_coordinator.cpp',
        'config/configsvr_coordinator.idl',
        'config/configsvr_drop_index_catalog_command.cpp',
        'config/configsvr_create_database_command.cpp',
        'config/configsvr_ensure_chunk_version_is_greater_than_command.cpp',
        'config/configsvr_get_historical_placement_info.cpp',
        'config/configsvr_merge_all_chunks_on_shard_command.cpp',
        'config/configsvr_merge_chunks_command.cpp',
        'config/configsvr_move_range_command.cpp',
        'config/configsvr_refine_collection_shard_key_command.cpp',
        'config/configsvr_remove_chunks_command.cpp',
        'config/configsvr_remove_shard_command.cpp',
        'config/configsvr_remove_shard_from_zone_command.cpp',
        'config/configsvr_remove_tags_command.cpp',
        'config/configsvr_rename_collection_metadata_command.cpp',
        'config/configsvr_repair_sharded_collection_chunks_history_command.cpp',
        'config/configsvr_reset_placement_history_command.cpp',
        'config/configsvr_reshard_collection_cmd.cpp',
        'config/configsvr_run_restore_command.cpp',
        'config/configsvr_set_allow_migrations_command.cpp',
        'config/configsvr_set_cluster_parameter_command.cpp',
        'config/configsvr_set_user_write_block_mode_command.cpp',
        'config/configsvr_split_chunk_command.cpp',
        'config/configsvr_transition_from_dedicated_config_server_command.cpp',
        'config/configsvr_transition_to_dedicated_config_server_command.cpp',
        'config/configsvr_update_zone_key_range_command.cpp',
        'config/set_cluster_parameter_coordinator_document.idl',
        'config/set_cluster_parameter_coordinator.cpp',
        'config/set_user_write_block_mode_coordinator_document.idl',
        'config/set_user_write_block_mode_coordinator.cpp',
        'create_collection_coordinator_document.idl',
        'create_collection_coordinator.cpp',
        'drop_collection_coordinator_document.idl',
        'drop_collection_coordinator.cpp',
        'drop_database_coordinator_document.idl',
        'drop_database_coordinator.cpp',
        'flush_database_cache_updates_command.cpp',
        'flush_resharding_state_change_command.cpp',
        'flush_routing_table_cache_updates_command.cpp',
        'get_database_version_command.cpp',
        'get_shard_version_command.cpp',
        'migration_chunk_cloner_source_legacy_commands.cpp',
        'migration_destination_manager_commands.cpp',
        'move_primary_coordinator_document.idl',
        'move_primary_coordinator.cpp',
        'move_primary_coordinator_no_resilient.cpp',
        'refine_collection_shard_key_coordinator_document.idl',
        'refine_collection_shard_key_coordinator.cpp',
        'refresh_query_analyzer_configuration_cmd.cpp',
        'remove_chunks.idl',
        'rename_collection_coordinator.cpp',
        'rename_collection_participant_service.cpp',
        'reshard_collection_coordinator_document.idl',
        'reshard_collection_coordinator.cpp',
        'resharding_test_commands.cpp',
        'resharding_test_commands.idl',
        'set_allow_migrations_coordinator_document.idl',
        'set_allow_migrations_coordinator.cpp',
        'sharded_collmod.idl',
        'sharded_index_consistency_server_status.cpp',
        'sharded_rename_collection.idl',
        'sharding_ddl_coordinator_service.cpp',
        'sharding_ddl_coordinator.cpp',
        'sharding_ddl_coordinator.idl',
        'sharding_server_status.cpp',
        'sharding_state_command.cpp',
        'shardsvr_abort_reshard_collection_command.cpp',
        'shardsvr_check_metadata_consistency_command.cpp',
        'shardsvr_check_metadata_consistency_participant_command.cpp',
        'shardsvr_cleanup_reshard_collection_command.cpp',
        'shardsvr_collmod_command.cpp',
        'shardsvr_collmod_participant_command.cpp',
        'shardsvr_index_catalog_test_commands.cpp',
        'shardsvr_commit_index_participant_command.cpp',
        'shardsvr_commit_reshard_collection_command.cpp',
        'shardsvr_compact_structured_encryption_data_command.cpp',
        'shardsvr_create_collection_command.cpp',
        'shardsvr_create_collection_participant_command.cpp',
        'shardsvr_create_global_index_command.cpp',
        'shardsvr_drop_global_index_command.cpp',
        'shardsvr_drop_collection_command.cpp',
        'shardsvr_drop_collection_if_uuid_not_matching_command.cpp',
        'shardsvr_drop_collection_participant_command.cpp',
        'shardsvr_drop_database_command.cpp',
        'shardsvr_drop_database_participant_command.cpp',
        'shardsvr_drop_indexes_command.cpp',
        'shardsvr_drop_index_catalog_entry_participant_command.cpp',
        'shardsvr_get_stats_for_balancing_command.cpp',
        'shardsvr_insert_global_index_key_command.cpp',
        'shardsvr_delete_global_index_key_command.cpp',
        'shardsvr_write_global_index_keys_command.cpp',
        'shardsvr_join_migrations_command.cpp',
        'shardsvr_merge_all_chunks_on_shard_command.cpp',
        'shardsvr_merge_chunks_command.cpp',
        'shardsvr_move_primary_command.cpp',
        'shardsvr_move_primary_enter_critical_section_command.cpp',
        'shardsvr_move_primary_exit_critical_section_command.cpp',
        'shardsvr_move_range_command.cpp',
        'shardsvr_participant_block_command.cpp',
        'shardsvr_refine_collection_shard_key_command.cpp',
        'shardsvr_notify_sharding_event_command.cpp',
        'shardsvr_rename_collection_command.cpp',
        'shardsvr_rename_collection_participant_command.cpp',
        'shardsvr_rename_index_metadata_command.cpp',
        'shardsvr_reshard_collection_command.cpp',
        'shardsvr_resharding_operation_time_command.cpp',
        'shardsvr_set_allow_migrations_command.cpp',
        'shardsvr_set_cluster_parameter_command.cpp',
        'shardsvr_set_user_write_block_mode_command.cpp',
        'shardsvr_split_chunk_command.cpp',
        'shardsvr_validate_shard_key_candidate.cpp',
        'split_vector_command.cpp',
        'txn_two_phase_commit_cmds.cpp',
        'wait_for_ongoing_chunk_splits_command.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/bson/dotted_path_support',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/collection_uuid_mismatch_info',
        '$BUILD_DIR/mongo/db/cloner',
        '$BUILD_DIR/mongo/db/cluster_transaction_api',
        '$BUILD_DIR/mongo/db/commands/cluster_server_parameter_commands_invocation',
        '$BUILD_DIR/mongo/db/commands/core',
        '$BUILD_DIR/mongo/db/commands/create_command',
        '$BUILD_DIR/mongo/db/commands/list_collections_filter',
        '$BUILD_DIR/mongo/db/commands/mongod_fcv',
        '$BUILD_DIR/mongo/db/commands/notify_sharding_event_idl',
        '$BUILD_DIR/mongo/db/commands/rename_collection_idl',
        '$BUILD_DIR/mongo/db/commands/server_status_core',
        '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
        '$BUILD_DIR/mongo/db/commands/txn_cmd_request',
        '$BUILD_DIR/mongo/db/fle_crud',
        '$BUILD_DIR/mongo/db/global_index',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
        '$BUILD_DIR/mongo/db/internal_transactions_feature_flag',
        '$BUILD_DIR/mongo/db/multitenancy',
        '$BUILD_DIR/mongo/db/pipeline/process_interface/shardsvr_process_interface',
        '$BUILD_DIR/mongo/db/repl/change_stream_oplog_notification',
        '$BUILD_DIR/mongo/db/repl/primary_only_service',
        '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
        '$BUILD_DIR/mongo/db/repl/replica_set_messages',
        '$BUILD_DIR/mongo/db/repl/wait_for_majority_service',
        '$BUILD_DIR/mongo/db/server_feature_flags',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
        '$BUILD_DIR/mongo/db/timeseries/catalog_helper',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_collmod',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_conversion_util',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/db/transaction/transaction_api',
        '$BUILD_DIR/mongo/executor/inline_executor',
        '$BUILD_DIR/mongo/idl/cluster_server_parameter',
        '$BUILD_DIR/mongo/s/commands/cluster_commands_common',
        '$BUILD_DIR/mongo/s/commands/sharded_cluster_sharding_commands',
        '$BUILD_DIR/mongo/s/common_s',
        '$BUILD_DIR/mongo/s/sharding_initialization',
        '$BUILD_DIR/mongo/s/sharding_router_api',
        '$BUILD_DIR/mongo/s/startup_initialization',
        'balancer_stats_registry',
        'forwardable_operation_metadata',
        'sharding_catalog',
        'sharding_logging',
        'sharding_runtime_d',
        'user_writes_recoverable_critical_section',
    ],
)

env.Library(
    target='sessions_collection_config_server',
    source=[
        'sessions_collection_config_server.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/pipeline/sharded_agg_helpers',
        '$BUILD_DIR/mongo/s/sessions_collection_sharded',
        '$BUILD_DIR/mongo/s/sharding_api',
        'sharding_catalog_manager',
    ],
)

env.Library(
    target='sharding_logging',
    source=[
        'sharding_logging.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/shard_role_api',
        '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
    ],
)

env.Library(
    target='sharding_mongod_test_fixture',
    source=[
        'sharding_mongod_test_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/repl/drop_pending_collection_reaper',
        '$BUILD_DIR/mongo/db/repl/replmocks',
        '$BUILD_DIR/mongo/db/repl/storage_interface_impl',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/s/sharding_test_fixture_common',
        'sharding_runtime_d',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
    ],
)

env.Library(
    target='shard_server_test_fixture',
    source=[
        'shard_server_test_fixture.cpp',
    ],
    LIBDEPS=[
        'sharding_mongod_test_fixture',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
    ],
)

env.Library(
    target='config_server_test_fixture',
    source=[
        'config/config_server_test_fixture.cpp',
    ],
    LIBDEPS=[
        'sharding_mongod_test_fixture',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl',
        '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
    ],
)

env.CppUnitTest(
    target='db_s_shard_server_test',
    source=[
        'active_migrations_registry_test.cpp',
        'analyze_shard_key_read_write_distribution_test.cpp',
        'auto_split_vector_test.cpp',
        'balancer/balance_stats_test.cpp',
        'collection_metadata_filtering_test.cpp',
        'collection_metadata_test.cpp',
        'collection_sharding_runtime_test.cpp',
        'database_sharding_state_test.cpp',
        'global_index/global_index_cloner_fetcher_test.cpp',
        'global_index/global_index_cloning_service_test.cpp',
        'global_index/global_index_cumulative_metrics_test.cpp',
        'global_index/global_index_inserter_test.cpp',
        'global_index/global_index_metrics_test.cpp',
        'implicit_collection_creation_test.cpp',
        'metadata_consistency_util_test.cpp',
        'metadata_manager_test.cpp',
        'metrics/phase_duration_test.cpp',
        'metrics/sharding_data_transform_cumulative_metrics_test.cpp',
        'metrics/sharding_data_transform_instance_metrics_test.cpp',
        'metrics/sharding_data_transform_metrics_macros_test.cpp',
        'migration_batch_fetcher_test.cpp',
        'migration_chunk_cloner_source_legacy_test.cpp',
        'migration_destination_manager_test.cpp',
        'migration_session_id_test.cpp',
        'migration_util_test.cpp',
        'namespace_metadata_change_notifications_test.cpp',
        'op_observer_sharding_test.cpp',
        'operation_sharding_state_test.cpp',
        'persistent_task_queue_test.cpp',
        'query_analysis_writer_test.cpp',
        'range_arithmetic_test.cpp',
        'range_deleter_service_op_observer_test.cpp',
        'range_deleter_service_test.cpp',
        'range_deleter_service_test_util.cpp',
        'range_deletion_util_test.cpp',
        'resharding/resharding_agg_test.cpp',
        'resharding/resharding_collection_cloner_test.cpp',
        'resharding/resharding_collection_test.cpp',
        'resharding/resharding_cumulative_metrics_test.cpp',
        'resharding/resharding_data_replication_test.cpp',
        'resharding/resharding_destined_recipient_test.cpp',
        'resharding/resharding_donor_oplog_iterator_test.cpp',
        'resharding/resharding_donor_recipient_common_test.cpp',
        'resharding/resharding_donor_service_test.cpp',
        'resharding/resharding_future_util_test.cpp',
        'resharding/resharding_metrics_test.cpp',
        'resharding/resharding_oplog_applier_metrics_test.cpp',
        'resharding/resharding_oplog_applier_test.cpp',
        'resharding/resharding_oplog_batch_applier_test.cpp',
        'resharding/resharding_oplog_batch_preparer_test.cpp',
        'resharding/resharding_oplog_crud_application_test.cpp',
        'resharding/resharding_oplog_fetcher_test.cpp',
        'resharding/resharding_oplog_session_application_test.cpp',
        'resharding/resharding_recipient_service_external_state_test.cpp',
        'resharding/resharding_recipient_service_test.cpp',
        'resharding/resharding_txn_cloner_test.cpp',
        'session_catalog_migration_destination_test.cpp',
        'session_catalog_migration_source_test.cpp',
        'shard_key_index_util_test.cpp',
        'shard_local_test.cpp',
        'shard_metadata_util_test.cpp',
        'shard_server_catalog_cache_loader_test.cpp',
        'sharding_ddl_coordinator_service_test.cpp',
        'sharding_initialization_mongod_test.cpp',
        'sharding_initialization_op_observer_test.cpp',
        'sharding_logging_test.cpp',
        'sharding_recovery_service_test.cpp',
        'split_chunk_request_test.cpp',
        'split_vector_test.cpp',
        'start_chunk_clone_request_test.cpp',
        'transaction_coordinator_catalog_test.cpp',
        'transaction_coordinator_futures_util_test.cpp',
        'transaction_coordinator_service_test.cpp',
        'transaction_coordinator_structures_test.cpp',
        'transaction_coordinator_test.cpp',
        'transaction_coordinator_test_fixture.cpp',
        'type_shard_collection_test.cpp',
        'type_shard_identity_test.cpp',
        'vector_clock_shard_server_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/remote_command_targeter_mock',
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/catalog/catalog_test_fixture',
        '$BUILD_DIR/mongo/db/commands/create_command',
        '$BUILD_DIR/mongo/db/commands/list_collections_filter',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value_test_util',
        '$BUILD_DIR/mongo/db/keys_collection_client_direct',
        '$BUILD_DIR/mongo/db/op_observer/op_observer',
        '$BUILD_DIR/mongo/db/op_observer/op_observer_util',
        '$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl',
        '$BUILD_DIR/mongo/db/ops/write_ops_exec',
        '$BUILD_DIR/mongo/db/pipeline/document_source_mock',
        '$BUILD_DIR/mongo/db/pipeline/process_interface/shardsvr_process_interface',
        '$BUILD_DIR/mongo/db/query/query_request',
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/db/read_write_concern_defaults_mock',
        '$BUILD_DIR/mongo/db/repl/image_collection_entry',
        '$BUILD_DIR/mongo/db/repl/mock_repl_coord_server_fixture',
        '$BUILD_DIR/mongo/db/repl/oplog_application',
        '$BUILD_DIR/mongo/db/repl/oplog_interface_local',
        '$BUILD_DIR/mongo/db/repl/primary_only_service_test_fixture',
        '$BUILD_DIR/mongo/db/repl/replmocks',
        '$BUILD_DIR/mongo/db/repl/storage_interface_impl',
        '$BUILD_DIR/mongo/db/session/logical_session_cache_impl',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
        '$BUILD_DIR/mongo/s/analyze_shard_key_util',
        '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
        '$BUILD_DIR/mongo/s/sharding_router_test_fixture',
        'query_analysis_writer',
        'shard_server_test_fixture',
        'sharding_catalog',
        'sharding_commands_d',
        'sharding_logging',
        'transaction_coordinator',
    ],
)

env.CppUnitTest(
    target='db_s_config_server_test',
    source=[
        'balancer/auto_merger_policy_test.cpp',
        'balancer/balancer_chunk_selection_policy_test.cpp',
        'balancer/balancer_defragmentation_policy_test.cpp',
        'balancer/balancer_policy_test.cpp',
        'balancer/core_options_stub.cpp',
        'balancer/balancer_commands_scheduler_test.cpp',
        'balancer/migration_test_fixture.cpp',
        'config_server_op_observer_test.cpp',
        'config/configsvr_coordinator_service_test.cpp',
        'config/index_on_config_test.cpp',
        'config/initial_split_policy_test.cpp',
        'config/sharding_catalog_manager_add_shard_test.cpp',
        'config/sharding_catalog_manager_add_shard_to_zone_test.cpp',
        'config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp',
        'config/sharding_catalog_manager_bump_collection_version_and_change_metadata_test.cpp',
        'config/sharding_catalog_manager_clear_jumbo_flag_test.cpp',
        'config/sharding_catalog_manager_commit_chunk_migration_test.cpp',
        'config/sharding_catalog_manager_config_initialization_test.cpp',
        'config/sharding_catalog_manager_database_operations_test.cpp',
        'config/sharding_catalog_manager_ensure_chunk_version_is_greater_than_test.cpp',
        'config/sharding_catalog_manager_merge_chunks_test.cpp',
        'config/sharding_catalog_manager_remove_shard_from_zone_test.cpp',
        'config/sharding_catalog_manager_remove_shard_test.cpp',
        'config/sharding_catalog_manager_shard_collection_test.cpp',
        'config/sharding_catalog_manager_split_chunk_test.cpp',
        'query_analysis_coordinator_test.cpp',
        'resharding/resharding_coordinator_commit_monitor_test.cpp',
        'resharding/resharding_coordinator_observer_test.cpp',
        'resharding/resharding_coordinator_test.cpp',
        'resharding/resharding_coordinator_service_test.cpp',
        'resharding/resharding_util_test.cpp',
        'sharding_catalog_client_aggregations_test.cpp',
        'sharding_ddl_util_test.cpp',
        'sharding_util_refresh_test.cpp',
        'topology_time_ticker_test.cpp',
        'vector_clock_config_server_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/catalog/collection_crud',
        '$BUILD_DIR/mongo/db/commands/cluster_server_parameter_commands_invocation',
        '$BUILD_DIR/mongo/db/commands/set_feature_compatibility_version_idl',
        '$BUILD_DIR/mongo/db/multitenancy',
        '$BUILD_DIR/mongo/db/pipeline/document_source_mock',
        '$BUILD_DIR/mongo/db/read_write_concern_defaults_mock',
        '$BUILD_DIR/mongo/db/repl/primary_only_service',
        '$BUILD_DIR/mongo/db/repl/primary_only_service_test_fixture',
        '$BUILD_DIR/mongo/db/repl/replication_info',
        '$BUILD_DIR/mongo/db/repl/storage_interface_impl',
        '$BUILD_DIR/mongo/db/repl/wait_for_majority_service',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/db/transaction/transaction',
        '$BUILD_DIR/mongo/db/transaction/transaction_api',
        '$BUILD_DIR/mongo/idl/cluster_server_parameter_common',
        '$BUILD_DIR/mongo/util/version_impl',
        'config_server_test_fixture',
        'sharding_commands_d',
    ],
)

env.Benchmark(
    target='chunk_manager_refresh_bm',
    source=[
        'chunk_manager_refresh_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/shard_role_api',
    ],
)

env.Benchmark(
    target='migration_chunk_cloner_source_legacy_bm',
    source=[
        'migration_chunk_cloner_source_legacy_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        'sharding_runtime_d',
    ],
)

env.Benchmark(
    target='sharding_write_router_bm',
    source=[
        'sharding_write_router_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/s/sharding_test_fixture_common',
        'sharding_runtime_d',
    ],
)

env.Benchmark(
    target='placement_history_bm',
    source=[
        'placement_history_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/read_write_concern_defaults_mock',
        '$BUILD_DIR/mongo/db/repl/wait_for_majority_service',
        '$BUILD_DIR/mongo/db/session/session_catalog_mongod',
        '$BUILD_DIR/mongo/db/shard_role_api',
        '$BUILD_DIR/mongo/s/sharding_test_fixture_common',
        'config_server_test_fixture',
        'sharding_catalog_manager',
        'sharding_runtime_d',
    ],
)
