# -*- mode: python; -*- Import([ 'env', 'get_option', 'has_option', 'jsEngine', 'version_parts', 'version_extra', ]) env = env.Clone() env.Library( target='benchrun', source=[ 'bench.cpp', ], LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/client/clientdriver_minimal', '$BUILD_DIR/mongo/db/session/logical_session_id', '$BUILD_DIR/mongo/scripting/bson_template_evaluator', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/util/pcre_util', '$BUILD_DIR/mongo/util/pcre_wrapper', ], ) generateJSErrorCodes = env.Command( target=['error_codes.js'], source=[ '$BUILD_DIR/mongo/base/generate_error_codes.py', '$BUILD_DIR/mongo/base/error_codes.yml', 'error_codes.tpl.js', ], action=['$PYTHON ${SOURCES[0]} ${SOURCES[1]} ${SOURCES[2]} ${TARGETS[0]}'], ) env.Alias('generated-sources', generateJSErrorCodes) # Files added here need to be added in scripting/engine.cpp and buildscripts/vcxproj.header as well. js_header = env.JSHeader( target="mongojs.cpp", source=[ "assert.js", "bulk_api.js", "check_log.js", "collection.js", "crud_api.js", "db.js", "error_codes.js", "explainable.js", "explain_query.js", "mongo.js", "query.js", "session.js", "types.js", "utils_auth.js", "utils.js", "utils_sh.js", ], ) env.Alias('generated-sources', js_header) # Files added here need to be added in shell/shell_utils.cpp as well. env.JSHeader( target="mongo-server.cpp", source=[ "servers.js", "shardingtest.js", "servers_misc.js", "replsettest.js", "data_consistency_checker.js", "bridge.js", "keyvault.js", "feature_compatibility_version.js", ], ) env.Alias('generated-sources', "mongo-server.cpp") env.Library( target='mongojs', source=[ 'mongojs.cpp', ], LIBDEPS=[ "$BUILD_DIR/mongo/base", ], ) env.Library( target='shell_options_storage', source=[ 'shell_options_storage.cpp', ], LIBDEPS=[ '$BUILD_DIR/mongo/base', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/client/connection_string', '$BUILD_DIR/mongo/util/cmdline_utils/cmdline_utils', ], ) env.Library( target='shell_options_register', source=[ 'shell_options.idl', ], LIBDEPS=[ '$BUILD_DIR/mongo/base', 'shell_options_storage', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/util/options_parser/options_parser', ], ) env.Library( target='program_runner', source=[ 'program_runner.cpp', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/base/environment_buffer', '$BUILD_DIR/mongo/db/service_context', ], ) 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', '$BUILD_DIR/mongo/db/storage/record_store_base', 'program_runner', ], ) env.Library( target='kms_idl', source=[ 'kms.idl', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/db/server_base', ], ) if get_option('ssl') == 'on': kmsEnv = env.Clone() kmsEnv.Library( target="kms", source=[ "kms.cpp", "kms_local.cpp", ], LIBDEPS=[ '$BUILD_DIR/mongo/base/secure_allocator', 'kms_idl', ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/crypto/aead_encryption', '$BUILD_DIR/mongo/db/commands/test_commands_enabled', ], ) 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=[] 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', ], ) env.Library( target="linenoise_utf8", source=[ "linenoise_utf8.cpp", ], ) env.Library( target="linenoise", source=[ "linenoise.cpp", "mk_wcwidth.cpp", ], LIBDEPS=[ '$BUILD_DIR/mongo/base', ], LIBDEPS_PRIVATE=[ "linenoise_utf8", ], ) if not has_option('noshell') and jsEngine: env.Library( target="mongo_initializers", source=[ "mongodbcr.cpp", "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/db/catalog/index_key_validate", "$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/session/logical_session_id_helpers", "$BUILD_DIR/mongo/db/storage/duplicate_key_error_info", "$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/db/concurrency/lock_manager", "$BUILD_DIR/mongo/s/write_ops/batch_write_types", "$BUILD_DIR/mongo/transport/transport_layer", "$BUILD_DIR/mongo/util/net/ssl_manager", "$BUILD_DIR/mongo/util/pcre_wrapper", "$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/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', ], )