summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/SConscript
blob: 72a1ab942b4e1271e3e6b8e9671952adb7ed99c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
# -*- mode: python -*-

Import('env')
Import("get_option")

env = env.Clone()

env.SConscript(
    dirs=[
        'process_interface',
    ],
    exports=[
        'env',
    ],
)

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

env.Library(
    target='change_stream_preimage',
    source=[
        'change_stream_preimage.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/server_base',
    ],
)

env.Library(
    target='aggregation',
    source=[
        'aggregation.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query_expressions',
        'aggregation_request_helper',
        'pipeline',
    ],
)

env.Library(
    target='field_path',
    source=[
        'field_path.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/query/query_knobs',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/server_options',
    ],
)

env.Library(
    target='aggregation_request_helper', source=[
        'aggregation_request_helper.cpp',
        'aggregate_command.idl',
        'external_data_source_option.idl',
    ], LIBDEPS=[
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/query/command_request_response',
        '$BUILD_DIR/mongo/db/query/common_query_enums_and_helpers',
        '$BUILD_DIR/mongo/db/query/query_request',
        '$BUILD_DIR/mongo/db/repl/read_concern_args',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/db/write_concern_options',
        'document_sources_idl',
    ])

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

env.Library(
    target='dependencies',
    source=[
        'dependencies.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        'field_path',
    ],
)

env.Library(
    target='accumulator',
    source=[
        'accumulation_statement.cpp',
        'accumulator_add_to_set.cpp',
        'accumulator_avg.cpp',
        'accumulator_covariance.cpp',
        'accumulator_exp_moving_avg.cpp',
        'accumulator_first.cpp',
        'accumulator_integral.cpp',
        'accumulator_js_reduce.cpp',
        'accumulator_last.cpp',
        'accumulator_locf.cpp',
        'accumulator_merge_objects.cpp',
        'accumulator_min_max.cpp',
        'accumulator_multi.cpp',
        'accumulator_percentile.cpp',
        'accumulator_percentile.idl',
        'accumulator_push.cpp',
        'accumulator_rank.cpp',
        'accumulator_std_dev.cpp',
        'accumulator_sum.cpp',
        'map_reduce_options.idl',
        'percentile_algo_discrete.cpp',
        'percentile_algo_tdigest.cpp',
        'percentile_algo_tdigest_distributed.cpp',
        'window_function/window_bounds.cpp',
        'window_function/window_function_covariance.cpp',
        'window_function/window_function_count.cpp',
        'window_function/window_function_expression.cpp',
        'window_function/window_function_integral.cpp',
        'window_function/window_function_shift.cpp',
        'window_function/window_function_sum.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/query/query_knobs',
        '$BUILD_DIR/mongo/db/query/stats/query_stats',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/scripting/scripting_common',
        '$BUILD_DIR/mongo/util/summation',
        'field_path',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/exec/sort_executor',
        '$BUILD_DIR/mongo/db/index/index_access_method',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.Library(
    target='granularity_rounder',
    source=[
        'granularity_rounder.cpp',
        'granularity_rounder_powers_of_two.cpp',
        'granularity_rounder_preferred_numbers.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/query_expressions',
        'field_path',
    ],
)

env.Library(
    target='document_source_mock',
    source=[
        'document_source_mock.cpp',
        'process_interface/stub_lookup_single_document_process_interface.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        'pipeline',
    ],
)

env.Library(
    target='sharded_agg_helpers',
    source=[
        'sharded_agg_helpers.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/s/async_requests_sender',
        '$BUILD_DIR/mongo/s/query/cluster_query',
        'aggregation',
    ],
)

env.Library(
    target='lite_parsed_document_source',
    source=[
        'lite_parsed_document_source.cpp',
        'lite_parsed_pipeline.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query/common_query_enums_and_helpers',
        '$BUILD_DIR/mongo/db/stats/counters',
        'aggregation_request_helper',
    ],
)

env.Library(
    target="document_path_support",
    source=[
        'document_path_support.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
    ],
)

env.Library(
    target="change_stream_error_extra_info",
    source=[
        'change_stream_topology_change_info.cpp',
        'change_stream_invalidation_info.cpp',
        'change_stream_start_after_invalidate_info.cpp',
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/base",
    ],
)

env.Library(
    target="abt_utils",
    source=[
        "abt/utils.cpp",
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/db/exec/document_value/document_value",
        "$BUILD_DIR/mongo/db/query/optimizer/optimizer_base",
        "field_path",
    ],
)

env.Library(
    target='pipeline_visitor',
    source=[
        'visitors/document_source_walker.cpp',
        'visitors/transformer_interface_walker.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        'pipeline',
    ],
)

env.Library(
    target='abt_translation',
    source=[
        'abt/canonical_query_translation.cpp',
        'abt/document_source_visitor.cpp',
        'abt/agg_expression_visitor.cpp',
        'abt/collation_translation.cpp',
        'abt/expr_algebrizer_context.cpp',
        'abt/field_map_builder.cpp',
        'abt/match_expression_visitor.cpp',
        'abt/transformer_visitor.cpp',
    ],
    LIBDEPS_PRIVATE=[
        'change_stream_pipeline',
        'document_source_internal_apply_oplog_update',
        'pipeline',
        'pipeline_visitor',
    ],
)

pipelineEnv = env.Clone()
pipelineEnv.InjectThirdParty(libraries=['snappy'])
pipelineEnv.Library(
    target='pipeline',
    source=[
        'accumulator_internal_construct_stats.cpp',
        # TODO SERVER-73152 move into new query_shape target
        'aggregate_request_shapifier.cpp',
        'document_source.cpp',
        'document_source_add_fields.cpp',
        'document_source_bucket.cpp',
        'document_source_bucket_auto.cpp',
        'document_source_coll_stats.cpp',
        'document_source_count.cpp',
        'document_source_current_op.cpp',
        'document_source_densify.cpp',
        'document_source_documents.cpp',
        'document_source_exchange.cpp',
        'document_source_facet.cpp',
        'document_source_fill.cpp',
        'document_source_find_and_modify_image_lookup.cpp',
        'document_source_geo_near.cpp',
        'document_source_graph_lookup.cpp',
        'document_source_group.cpp',
        'document_source_group_base.cpp',
        'document_source_index_stats.cpp',
        'document_source_internal_all_collection_stats.cpp',
        'document_source_internal_compute_geo_near_distance.cpp',
        'document_source_internal_convert_bucket_index_stats.cpp',
        'document_source_internal_inhibit_optimization.cpp',
        'document_source_internal_shard_filter.cpp',
        'document_source_internal_shardserver_info.cpp',
        'document_source_internal_split_pipeline.cpp',
        'document_source_internal_unpack_bucket.cpp',
        'document_source_limit.cpp',
        'document_source_list_cached_and_active_users.cpp',
        'document_source_list_catalog.cpp',
        'document_source_list_local_sessions.cpp',
        'document_source_list_sampled_queries.cpp',
        'document_source_list_sessions.cpp',
        'document_source_lookup.cpp',
        'document_source_match.cpp',
        'document_source_merge.cpp',
        'document_source_operation_metrics.cpp',
        'document_source_out.cpp',
        'document_source_plan_cache_stats.cpp',
        'document_source_project.cpp',
        'document_source_queue.cpp',
        'document_source_redact.cpp',
        'document_source_replace_root.cpp',
        'document_source_sample.cpp',
        'document_source_sample_from_random_cursor.cpp',
        'document_source_sequential_document_cache.cpp',
        'document_source_set_variable_from_subpipeline.cpp',
        'document_source_set_window_fields.cpp',
        'document_source_sharded_data_distribution.cpp',
        'document_source_single_document_transformation.cpp',
        'document_source_skip.cpp',
        'document_source_sort.cpp',
        'document_source_sort_by_count.cpp',
        'document_source_streaming_group.cpp',
        'document_source_tee_consumer.cpp',
        'document_source_telemetry.cpp',
        'document_source_union_with.cpp',
        'document_source_unwind.cpp',
        'group_from_first_document_transformation.cpp',
        'pipeline.cpp',
        'search_helper.cpp',
        'semantic_analysis.cpp',
        'sequential_document_cache.cpp',
        'skip_and_limit.cpp',
        'sort_reorder_helpers.cpp',
        'tee_buffer.cpp',
        'window_function/partition_iterator.cpp',
        'window_function/spillable_cache.cpp',
        'window_function/window_function_exec.cpp',
        'window_function/window_function_exec_derivative.cpp',
        'window_function/window_function_exec_linear_fill.cpp',
        'window_function/window_function_exec_removable_document.cpp',
        'window_function/window_function_exec_removable_range.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/clientdriver_minimal',
        '$BUILD_DIR/mongo/db/auth/auth',
        '$BUILD_DIR/mongo/db/bson/dotted_path_support',
        '$BUILD_DIR/mongo/db/curop_failpoint_helpers',
        '$BUILD_DIR/mongo/db/exec/bucket_unpacker',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/exec/projection_executor',
        '$BUILD_DIR/mongo/db/exec/scoped_timer',
        '$BUILD_DIR/mongo/db/exec/sort_executor',
        '$BUILD_DIR/mongo/db/generic_cursor',
        '$BUILD_DIR/mongo/db/index/index_access_method',
        '$BUILD_DIR/mongo/db/pipeline/change_stream_error_extra_info',
        '$BUILD_DIR/mongo/db/pipeline/lite_parsed_document_source',
        '$BUILD_DIR/mongo/db/query/collation/collator_factory_interface',
        '$BUILD_DIR/mongo/db/query/collation/collator_interface',
        '$BUILD_DIR/mongo/db/query/cursor_response_idl',
        '$BUILD_DIR/mongo/db/query/datetime/date_time_support',
        '$BUILD_DIR/mongo/db/query/op_metrics',
        '$BUILD_DIR/mongo/db/query/query_knobs',
        '$BUILD_DIR/mongo/db/query/sort_pattern',
        '$BUILD_DIR/mongo/db/query/stats/stats_gen',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/db/repl/apply_ops_command_info',
        '$BUILD_DIR/mongo/db/repl/oplog_entry',
        '$BUILD_DIR/mongo/db/repl/read_concern_args',
        '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
        '$BUILD_DIR/mongo/db/repl/speculative_majority_read_info',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/session/logical_session_cache',
        '$BUILD_DIR/mongo/db/session/logical_session_id_helpers',
        '$BUILD_DIR/mongo/db/session/sessions_collection',
        '$BUILD_DIR/mongo/db/stats/resource_consumption_metrics',
        '$BUILD_DIR/mongo/db/storage/encryption_hooks',
        '$BUILD_DIR/mongo/db/storage/index_entry_comparison',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/db/timeseries/catalog_helper',
        '$BUILD_DIR/mongo/db/update/update_document_diff',
        '$BUILD_DIR/mongo/db/views/resolved_view',
        '$BUILD_DIR/mongo/s/is_mongos',
        '$BUILD_DIR/third_party/shim_snappy',
        'abt_utils',
        'accumulator',
        'change_stream_helpers',
        'dependencies',
        'document_path_support',
        'document_sources_idl',
        'granularity_rounder',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_catalog',
        '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/fts/base_fts',
        '$BUILD_DIR/mongo/db/mongohasher',
        '$BUILD_DIR/mongo/db/query/optimizer/optimizer',
        '$BUILD_DIR/mongo/db/query/projection_ast',
        '$BUILD_DIR/mongo/db/repl/image_collection_entry',
        '$BUILD_DIR/mongo/db/sorter/sorter_idl',
        '$BUILD_DIR/mongo/db/sorter/sorter_stats',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_conversion_util',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/rpc/command_status',
        '$BUILD_DIR/mongo/s/analyze_shard_key_util',
    ],
)

env.Library(
    target="document_source_internal_apply_oplog_update",
    source=[
        'document_source_internal_apply_oplog_update.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/multitenancy',
        '$BUILD_DIR/mongo/db/ops/write_ops_parsers',
        '$BUILD_DIR/mongo/db/pipeline/pipeline',
        '$BUILD_DIR/mongo/db/pipeline/sharded_agg_helpers',
        '$BUILD_DIR/mongo/db/update/update_driver',
        '$BUILD_DIR/mongo/s/query/router_exec_stage',
    ],
)

env.Library(
    target="change_stream_pipeline",
    source=[
        'change_stream_document_diff_parser.cpp',
        'change_stream_event_transform.cpp',
        'change_stream_filter_helpers.cpp',
        'change_stream_helpers_legacy.cpp',
        'change_stream_rewrite_helpers.cpp',
        'change_stream_split_event_helpers.cpp',
        'document_source_change_stream.cpp',
        'document_source_change_stream_add_post_image.cpp',
        'document_source_change_stream_check_invalidate.cpp',
        'document_source_change_stream_check_resumability.cpp',
        'document_source_change_stream_check_topology_change.cpp',
        'document_source_change_stream_ensure_resume_token_present.cpp',
        'document_source_change_stream_handle_topology_change.cpp',
        'document_source_change_stream_add_pre_image.cpp',
        'document_source_change_stream_oplog_match.cpp',
        'document_source_change_stream_split_large_event.cpp',
        'document_source_change_stream_transform.cpp',
        'document_source_change_stream_unwind_transaction.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/change_stream_serverless_helpers',
        '$BUILD_DIR/mongo/db/multitenancy',
        '$BUILD_DIR/mongo/db/ops/write_ops_parsers',
        '$BUILD_DIR/mongo/db/pipeline/pipeline',
        '$BUILD_DIR/mongo/db/pipeline/sharded_agg_helpers',
        '$BUILD_DIR/mongo/db/server_feature_flags',
        '$BUILD_DIR/mongo/db/update/update_driver',
        '$BUILD_DIR/mongo/s/query/router_exec_stage',
        'change_stream_helpers',
        'change_stream_preimage',
    ],
)

env.Library(
    target='runtime_constants_idl',
    source=[
        'legacy_runtime_constants.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.Library(
    target='document_sources_idl',
    source=[
        'document_source_change_stream.idl',
        'document_source_coll_stats.idl',
        'document_source_densify.idl',
        'document_source_fill.idl',
        'document_source_internal_all_collection_stats.idl',
        'document_source_internal_apply_oplog_update.idl',
        'document_source_list_sampled_queries.idl',
        'document_source_list_sessions.idl',
        'document_source_merge.idl',
        'document_source_merge_modes.idl',
        'document_source_merge_spec.cpp',
        'document_source_out.idl',
        'document_source_parsing_validators.cpp',
        'document_source_replace_root.idl',
        'document_source_set_window_fields.idl',
        'document_source_union_with.idl',
        'document_source_set_variable_from_subpipeline.idl',
        'exchange_spec.idl',
        'resume_token.cpp',
        'storage_stats_spec.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/serialization_options',
        '$BUILD_DIR/mongo/db/storage/key_string',
        '$BUILD_DIR/mongo/db/timeseries/timeseries_options',
        '$BUILD_DIR/mongo/idl/idl_parser',
        '$BUILD_DIR/mongo/s/common_s',
        'runtime_constants_idl',
        'value_idl',
    ],
)

env.Library(
    target='value_idl',
    source=[
        'value.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.Library(
    target='change_stream_expired_pre_image_remover',
    source=[
        'change_stream_expired_pre_image_remover.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/change_stream_pre_images_collection_manager',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/util/periodic_runner',
    ],
)

env.Library(
    target="change_stream_helpers",
    source=[
        "change_stream_helpers.cpp",
    ],
    LIBDEPS=[
        "document_sources_idl",
    ],
    LIBDEPS_PRIVATE=[],
)

env.Library(
    target="change_stream_test_helpers",
    source=[
        "change_stream_test_helpers.cpp",
    ],
    LIBDEPS=[
        "change_stream_pipeline",
    ],
    LIBDEPS_PRIVATE=[],
)

env.Benchmark(
    target='abt_translation_bm',
    source=[
        'abt/abt_fallback_mechanism_cq_bm.cpp',
        'abt/abt_fallback_mechanism_pipeline_bm.cpp',
        'abt/abt_translate_bm_fixture.cpp',
        'abt/abt_translate_cq_bm.cpp',
        'abt/abt_translate_pipeline_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/pipeline/abt_translation',
        '$BUILD_DIR/mongo/db/pipeline/pipeline',
        '$BUILD_DIR/mongo/db/query/canonical_query',
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        '$BUILD_DIR/mongo/db/query_exec',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/unittest/unittest',
        '$BUILD_DIR/mongo/util/processinfo',
    ],
)

env.CppUnitTest(
    target='db_pipeline_test',
    source=[
        'abt/abt_optimization_test.cpp',
        'abt/abt_translation_test.cpp',
        'accumulator_js_test.cpp' if get_option('js-engine') != 'none' else [],
        'accumulator_test.cpp',
        'aggregation_request_test.cpp',
        'change_stream_document_diff_parser_test.cpp',
        'change_stream_event_transform_test.cpp',
        'change_stream_expired_pre_image_remover_test.cpp',
        'change_stream_rewrites_test.cpp',
        'change_stream_split_event_helpers_test.cpp',
        'dependencies_test.cpp',
        'dispatch_shard_pipeline_test.cpp',
        'document_path_support_test.cpp',
        'document_source_add_fields_test.cpp',
        'document_source_bucket_auto_test.cpp',
        'document_source_bucket_test.cpp',
        'document_source_change_stream_add_post_image_test.cpp',
        'document_source_change_stream_test.cpp',
        'document_source_check_resume_token_test.cpp',
        'document_source_coll_stats_test.cpp',
        'document_source_count_test.cpp',
        'document_source_current_op_test.cpp',
        'document_source_densify_test.cpp',
        'document_source_documents_test.cpp',
        'document_source_exchange_test.cpp',
        'document_source_facet_test.cpp',
        'document_source_find_and_modify_image_lookup_test.cpp',
        'document_source_geo_near_test.cpp',
        'document_source_graph_lookup_test.cpp',
        'document_source_group_test.cpp',
        'document_source_internal_apply_oplog_update_test.cpp',
        'document_source_internal_shard_filter_test.cpp',
        'document_source_internal_split_pipeline_test.cpp',
        'document_source_limit_test.cpp',
        'document_source_lookup_test.cpp',
        'document_source_match_test.cpp',
        'document_source_merge_cursors_test.cpp',
        'document_source_merge_test.cpp',
        'document_source_mock_test.cpp',
        'document_source_out_test.cpp',
        'document_source_plan_cache_stats_test.cpp',
        'document_source_project_test.cpp',
        'document_source_queue_test.cpp',
        'document_source_redact_test.cpp',
        'document_source_replace_root_test.cpp',
        'document_source_sample_test.cpp',
        'document_source_sequential_document_cache_test.cpp',
        'document_source_set_variable_from_subpipeline_test.cpp',
        'document_source_set_window_fields_test.cpp',
        'document_source_skip_test.cpp',
        'document_source_sort_by_count_test.cpp',
        'document_source_sort_test.cpp',
        'document_source_telemetry_test.cpp',
        'document_source_union_with_test.cpp',
        'document_source_internal_compute_geo_near_distance_test.cpp',
        'document_source_internal_convert_bucket_index_stats_test.cpp',
        'document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp',
        'document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp',
        'document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp',
        'document_source_internal_unpack_bucket_test/group_reorder_test.cpp',
        'document_source_internal_unpack_bucket_test/internalize_project_test.cpp',
        'document_source_internal_unpack_bucket_test/optimize_pipeline_test.cpp',
        'document_source_internal_unpack_bucket_test/optimize_lastpoint_test.cpp',
        'document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp',
        'document_source_internal_unpack_bucket_test/sample_reorder_test.cpp',
        'document_source_internal_unpack_bucket_test/sort_reorder_test.cpp',
        'document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp',
        'document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp',
        'document_source_unwind_test.cpp',
        'expression_and_test.cpp',
        'expression_compare_test.cpp',
        'expression_context_test.cpp',
        'expression_convert_test.cpp',
        'expression_date_test.cpp',
        'expression_field_path_test.cpp',
        'expression_find_internal_test.cpp',
        'expression_function_test.cpp',
        'expression_javascript_test.cpp' if get_option('js-engine') != 'none' else [],
        'expression_let_test.cpp',
        'expression_nary_test.cpp',
        'expression_object_test.cpp',
        'expression_or_test.cpp',
        'expression_replace_test.cpp',
        'expression_test.cpp',
        'expression_test_api_version_test.cpp',
        'expression_trigonometric_test.cpp',
        'expression_trim_test.cpp',
        'expression_walker_test.cpp',
        'field_path_test.cpp',
        'granularity_rounder_powers_of_two_test.cpp',
        'granularity_rounder_preferred_numbers_test.cpp',
        'lookup_set_cache_test.cpp',
        'memory_usage_tracker_test.cpp',
        'monotonic_expression_test.cpp',
        'partition_key_comparator_test.cpp',
        'pipeline_metadata_tree_test.cpp',
        'pipeline_test.cpp',
        'resume_token_test.cpp',
        'sampling_based_initial_split_policy_test.cpp',
        'semantic_analysis_test.cpp',
        'sequential_document_cache_test.cpp',
        'sharded_union_test.cpp',
        'skip_and_limit_test.cpp',
        'tee_buffer_test.cpp',
        'visitors/document_source_walker_test.cpp',
        'window_function/partition_iterator_test.cpp',
        'window_function/spillable_cache_test.cpp',
        'window_function/window_function_add_to_set_test.cpp',
        'window_function/window_function_covariance_test.cpp',
        'window_function/window_function_exec_derivative_test.cpp',
        'window_function/window_function_exec_non_removable_test.cpp',
        'window_function/window_function_exec_removable_test.cpp',
        'window_function/window_function_integral_test.cpp',
        'window_function/window_function_min_max_test.cpp',
        'window_function/window_function_n_test.cpp',
        'window_function/window_function_push_test.cpp',
        'window_function/window_function_std_dev_test.cpp',
        'window_function/window_function_exec_first_last_test.cpp',
        'window_function/window_function_avg_test.cpp',
        'window_function/window_function_sum_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/auth/authmocks',
        '$BUILD_DIR/mongo/db/change_stream_options',
        '$BUILD_DIR/mongo/db/change_stream_options_manager',
        '$BUILD_DIR/mongo/db/change_stream_pre_image_util',
        '$BUILD_DIR/mongo/db/change_stream_pre_images_collection_manager',
        '$BUILD_DIR/mongo/db/change_streams_cluster_parameter',
        '$BUILD_DIR/mongo/db/cst/cst',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value_test_util',
        '$BUILD_DIR/mongo/db/mongohasher',
        '$BUILD_DIR/mongo/db/op_observer/op_observer_impl',
        '$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl',
        '$BUILD_DIR/mongo/db/pipeline/change_stream_expired_pre_image_remover',
        '$BUILD_DIR/mongo/db/query/collation/collator_interface_mock',
        '$BUILD_DIR/mongo/db/query/optimizer/optimizer',
        '$BUILD_DIR/mongo/db/query/optimizer/unit_test_pipeline_utils',
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/db/repl/image_collection_entry',
        '$BUILD_DIR/mongo/db/repl/oplog_entry',
        '$BUILD_DIR/mongo/db/repl/replmocks',
        '$BUILD_DIR/mongo/db/repl/storage_interface_impl',
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/db/service_context_test_fixture',
        '$BUILD_DIR/mongo/db/storage/devnull/storage_devnull_core',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
        '$BUILD_DIR/mongo/s/is_mongos',
        '$BUILD_DIR/mongo/s/query/router_exec_stage',
        '$BUILD_DIR/mongo/s/sharding_router_test_fixture',
        '$BUILD_DIR/mongo/util/clock_source_mock',
        'abt_translation',
        'accumulator',
        'aggregation_request_helper',
        'change_stream_pipeline',
        'change_stream_preimage',
        'change_stream_test_helpers',
        'document_source_internal_apply_oplog_update',
        'document_source_mock',
        'document_sources_idl',
        'field_path',
        'granularity_rounder',
        'pipeline',
        'pipeline_visitor',
        'process_interface/mongod_process_interfaces',
        'process_interface/mongos_process_interface',
        'process_interface/shardsvr_process_interface',
        'sharded_agg_helpers',
    ],
)

env.CppUnitTest(
    target='db_percentile_algo_test',
    source=[
        'percentile_algo_discrete_test.cpp',
        'percentile_algo_tdigest_test.cpp',
        'percentile_algo_tdigest_distributed_test.cpp',
    ],
    LIBDEPS=[
        'accumulator',
    ],
)

env.Benchmark(
    target='percentile_algo_bm',
    source=[
        'percentile_algo_bm_fixture.cpp',
    ],
    LIBDEPS=[
        'accumulator',
    ],
)

env.Benchmark(
    target='window_function_percentile_bm',
    source=['window_function/window_function_percentile_bm_fixture.cpp'],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        'accumulator',
    ],
)

bmEnv = env.Clone()
bmEnv.InjectThirdParty(libraries=["benchmark"])

bmEnv.Library(
    target='expression_bm_fixture',
    source=[
        'expression_bm_fixture.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/exec/document_value/document_value',
        '$BUILD_DIR/third_party/shim_benchmark',
    ],
)

env.Benchmark(
    target='expression_bm',
    source=[
        'expression_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        '$BUILD_DIR/mongo/db/query_expressions',
        '$BUILD_DIR/mongo/db/service_context_test_fixture',
        'accumulator',
        'expression_bm_fixture',
    ],
)