# -*- mode: python; -*- Import( [ "env", "get_option", "has_option", "jsEngine", "version_parts", "version_extra", ] ) env = env.Clone() def shouldBuildGRPC(myEnv): return myEnv.TargetOSIs("linux") and myEnv["ENABLE_GRPC_BUILD"] if shouldBuildGRPC(env): env.InjectThirdParty(libraries=["grpc"]) env.Library( target="shell_utils", source=[ "mongo-server.cpp", "named_pipe_test_helper.cpp", "shell_options.cpp", "shell_utils.cpp", "shell_utils_extended.cpp", "shell_utils_launcher.cpp", ], LIBDEPS=[ "$BUILD_DIR/mongo/base/environment_buffer", "$BUILD_DIR/mongo/client/clientdriver_network", "$BUILD_DIR/mongo/db/mongohasher", "$BUILD_DIR/mongo/db/traffic_reader", "$BUILD_DIR/mongo/scripting/scripting", "$BUILD_DIR/mongo/transport/message_compressor", "$BUILD_DIR/mongo/unittest/golden_test_base", "$BUILD_DIR/mongo/util/password", "benchrun", "shell_options_storage", ], LIBDEPS_PRIVATE=[ "$BUILD_DIR/mongo/bson/util/bson_column", "$BUILD_DIR/mongo/db/auth/security_token_auth", "$BUILD_DIR/mongo/db/query/collation/collator_icu", "$BUILD_DIR/mongo/db/storage/record_store_base", "$BUILD_DIR/mongo/util/icu", "program_runner", ], ) if get_option("ssl") == "on": kmsEnv = env.Clone() env.Library( target="kms_shell", source=[ "kms_shell.cpp", ], LIBDEPS_PRIVATE=[ "kms", "shell_utils", ], ) if get_option("js-engine") != "none": scriptingEnv = env.Clone() scriptingEnv.Append( CXXFLAGS=[ "/Zc:preprocessor", "/wd5104", "/wd5105", ] if scriptingEnv.TargetOSIs("windows") else [ # TODO(SERVER-59992): Remove -Wno-class-memacces where possible. "-Wno-unknown-warning-option", "-Wno-class-memaccess", # TODO(SERVER-77205): Review and Possibly Remove '-Wno-deprecated' After Mozjs Update "-Wno-deprecated", ], ) scriptingEnv.InjectMozJS() scriptingEnv.Library( target="encrypted_dbclient", source=[ "encrypted_dbclient_base.cpp", ], LIBDEPS_PRIVATE=[ "$BUILD_DIR/mongo/client/clientdriver_minimal", "$BUILD_DIR/mongo/crypto/aead_encryption", "$BUILD_DIR/mongo/crypto/encrypted_field_config", "$BUILD_DIR/mongo/crypto/fle_crypto", "$BUILD_DIR/mongo/crypto/fle_fields", "$BUILD_DIR/mongo/crypto/symmetric_crypto", "$BUILD_DIR/mongo/db/query_expressions", "$BUILD_DIR/mongo/scripting/scripting", "$BUILD_DIR/mongo/shell/shell_options_register", "$BUILD_DIR/third_party/mozjs/mozjs", "kms", ], ) if not has_option("noshell") and jsEngine: env.Library( target="mongo_initializers", source=[ "shell_options_init.cpp", ], LIBDEPS_PRIVATE=[ # NOTE: If you need to add a static or mongo initializer to mongo startup, # please add that library here, as a private library dependency. "$BUILD_DIR/mongo/client/clientdriver_network", "$BUILD_DIR/mongo/client/connection_string", "$BUILD_DIR/mongo/client/cyrus_sasl_client" if env["MONGO_BUILD_SASL_CLIENT"] else "", "$BUILD_DIR/mongo/db/catalog/index_key_validate", "$BUILD_DIR/mongo/db/modules/enterprise/src/fips/fips_mode_client" if "fle" in env.get("MONGO_ENTERPRISE_FEATURES", []) and get_option("js-engine") != "none" else "", "$BUILD_DIR/mongo/db/modules/enterprise/src/fle/shell/implicit_encrypted_dbclient" if "fle" in env.get("MONGO_ENTERPRISE_FEATURES", []) and get_option("js-engine") != "none" else "", "$BUILD_DIR/mongo/db/mongohasher", "$BUILD_DIR/mongo/db/pipeline/change_stream_error_extra_info", "$BUILD_DIR/mongo/db/query/command_request_response", "$BUILD_DIR/mongo/db/query/query_request", "$BUILD_DIR/mongo/db/server_base", "$BUILD_DIR/mongo/db/service_context_non_d", "$BUILD_DIR/mongo/db/session/logical_session_id_helpers", "$BUILD_DIR/mongo/db/storage/duplicate_key_error_info", "$BUILD_DIR/mongo/db/timeseries/bucket_compression_failure", "$BUILD_DIR/mongo/db/traffic_reader", "$BUILD_DIR/mongo/db/views/resolved_view", "$BUILD_DIR/mongo/executor/async_rpc_error_info", "$BUILD_DIR/mongo/executor/network_interface_factory", "$BUILD_DIR/mongo/executor/network_interface_thread_pool", "$BUILD_DIR/mongo/executor/thread_pool_task_executor", "$BUILD_DIR/mongo/rpc/message", "$BUILD_DIR/mongo/scripting/scripting", "$BUILD_DIR/mongo/transport/message_compressor", "$BUILD_DIR/mongo/transport/message_compressor_options_client", "$BUILD_DIR/mongo/transport/transport_layer_manager", "$BUILD_DIR/mongo/util/net/http_client_impl", "$BUILD_DIR/mongo/util/net/network", "$BUILD_DIR/mongo/util/net/ssl_options_client" if get_option("ssl") == "on" else "", "$BUILD_DIR/mongo/util/options_parser/options_parser_init", "$BUILD_DIR/mongo/util/password", "$BUILD_DIR/mongo/util/processinfo", "$BUILD_DIR/mongo/util/signal_handlers", "$BUILD_DIR/mongo/util/version_impl", "benchrun", "encrypted_dbclient" if get_option("ssl") == "on" else "", "kms_shell" if get_option("ssl") == "on" else "", "mongojs", "shell_options_register", "shell_utils", ], LIBDEPS=[ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE ], ) env.Library( target="mongo_main", source=[ "mongo_main.cpp", ], LIBDEPS_PRIVATE=[ # NOTE: Do not add new libdeps (public or private) here unless # required by the linker to satisfy symbol dependencies from # the files listed above in `sources`. If you need to add a # library to inject a static or mongo initializer to mongo, # please add that library as a private libdep of # mongo_initializers. "$BUILD_DIR/mongo/s/grid", "$BUILD_DIR/mongo/s/write_ops/batch_write_types", "$BUILD_DIR/mongo/transport/transport_layer_manager", "$BUILD_DIR/mongo/util/allocator_thread", "$BUILD_DIR/mongo/util/net/ssl_manager", "$BUILD_DIR/mongo/util/pcre_wrapper", "$BUILD_DIR/mongo/util/periodic_runner_factory", "$BUILD_DIR/mongo/util/signal_handlers", "linenoise", "mongo_initializers", "program_runner", "shell_utils", ], LIBDEPS=[ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE ], ) shellEnv = env.Clone() if env.TargetOSIs("windows"): shellEnv.Append(LIBS=["winmm"]) generatedMongoManifest = shellEnv.Substfile( "mongo.manifest.in", SUBST_DICT=[ ("@mongo_version_major@", version_parts[0]), ("@mongo_version_minor@", version_parts[1]), ("@mongo_version_patch@", version_parts[2]), ("@mongo_version_extra@", version_parts[3]), ("@mongo_version_extra_str@", version_extra), ], ) shellEnv.Alias("generated-sources", generatedMongoManifest) shellEnv.Depends("mongo.res", generatedMongoManifest) mongo_shell = shellEnv.Program( target="mongo", source=[ "mongo.cpp", ] + env.WindowsResourceFile("mongo.rc"), LIBDEPS=[ # NOTE: Do not add new libdeps (public or private) here unless # required by the linker to satisfy symbol dependencies from # the files listed above in `sources`. If you need to add a # library to inject a static or mongo initializer to mongo, # please add that library as a private libdep of # mongo_initializers. "$BUILD_DIR/mongo/db/server_base", "mongo_main", ], AIB_COMPONENT="jstestshell", AIB_COMPONENTS_EXTRA=[ "devcore", "dist-test", "integration-tests", "mongo", "serverless-test", ], ) env.CppUnitTest( target="shell_test", source=[ "kms_test.cpp" if get_option("ssl") == "on" else [], "shell_options_test.cpp", "shell_utils_test.cpp", ], LIBDEPS=[ "$BUILD_DIR/mongo/util/signal_handlers", "kms" if get_option("ssl") == "on" else [], "shell_options_register", "shell_utils", ], )