Skip to content

Commit

Permalink
SERVER-27497 Scope SCons Environment changes narrowly
Browse files Browse the repository at this point in the history
  • Loading branch information
acmorrow committed Jan 3, 2017
1 parent 4a5adbb commit 1346352
Show file tree
Hide file tree
Showing 72 changed files with 215 additions and 32 deletions.
15 changes: 12 additions & 3 deletions SConstruct
Expand Up @@ -2949,9 +2949,9 @@ module_sconscripts = moduleconfig.get_module_sconscripts(mongo_modules)
# Currently, however, the SConscript files do need some predicates for
# conditional decision making that hasn't been moved up to this SConstruct file,
# and they are exported here, as well.
Export("env")
Export("get_option")
Export("has_option use_system_version_of_library")
Export("has_option")
Export("use_system_version_of_library")
Export("serverJs")
Export("usemozjs")
Export('module_sconscripts')
Expand Down Expand Up @@ -2982,7 +2982,16 @@ env.Alias("distsrc-tgz", env.GZip(
env.Alias("distsrc-zip", env.DistSrc("mongodb-src-${MONGO_VERSION}.zip"))
env.Alias("distsrc", "distsrc-tgz")

env.SConscript('src/SConscript', variant_dir='$BUILD_DIR', duplicate=False)
env.SConscript(
dirs=[
'src',
],
duplicate=False,
exports=[
'env',
],
variant_dir='$BUILD_DIR',
)

all = env.Alias('all', ['core', 'tools', 'dbtest', 'unittests', 'integration_tests'])

Expand Down
32 changes: 22 additions & 10 deletions src/SConscript
Expand Up @@ -3,13 +3,25 @@
# This is the principle SConscript file, invoked by the SConstruct. Its job is
# to delegate to any and all per-module SConscript files.

Import('env module_sconscripts')

env.SConscript(
[
# NOTE: We must do third_party first as it adds methods to the environment
# that we need in the mongo sconscript
'third_party/SConscript',
'mongo/SConscript',
] + module_sconscripts
)
Import('env')
Import('module_sconscripts')

# NOTE: We must do third_party first as it adds methods to the environment
# that we need in the mongo sconscript
env = env.Clone()
env.SConscript('third_party/SConscript', exports=['env'])

# Inject boost and pcre from third_party globally for all core mongo code
# and modules. Ideally, pcre wouldn't be here, but enough things require it
# now that it seems hopeless to remove it now.
env = env.Clone()
env.InjectThirdPartyIncludePaths(libraries=[
'boost',
'pcre',
])

# Run the core mongodb SConscript.
env.SConscript('mongo/SConscript', exports=['env'])

# Run SConscripts for any modules in play
env.SConscript(module_sconscripts, exports=['env'])
12 changes: 5 additions & 7 deletions src/mongo/SConscript
Expand Up @@ -14,13 +14,8 @@ Import("get_option")
Import("usemozjs")
Import("use_system_version_of_library")

# Boost we need everywhere. 's2' is spammed in all over the place by
# db/geo unfortunately. pcre is also used many places.
env.InjectThirdPartyIncludePaths(libraries=[
'boost',
'pcre',
's2',
])
env = env.Clone()

env.InjectMongoIncludePaths()

env.SConscript(
Expand All @@ -44,6 +39,9 @@ env.SConscript(
'unittest',
'util',
],
exports=[
'env',
],
)

# NOTE: This library does not really belong here. Its presence here is
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/base/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

generateErrorCodes = env.Command(
target=['error_codes.h', 'error_codes.cpp'],
source=['generate_error_codes.py', 'error_codes.err'],
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/bson/SConscript
Expand Up @@ -2,11 +2,16 @@

Import('env')

env = env.Clone()

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

env.CppUnitTest(
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/bson/mutable/SConscript
Expand Up @@ -2,6 +2,8 @@

Import('env')

env = env.Clone()

env.Library(
target='mutable_bson',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/bson/util/SConscript
Expand Up @@ -2,6 +2,8 @@

Import('env')

env = env.Clone()

env.Library(
target='bson_extract',
source=[
Expand Down
6 changes: 5 additions & 1 deletion src/mongo/client/SConscript
Expand Up @@ -2,6 +2,8 @@

Import('env')

env = env.Clone()

# Contains only the core ConnectionString functionality, *not* the ability to call connect()
# and return a DBClientBase* back. For that you need to link against the 'clientdriver' library.
env.Library(
Expand Down Expand Up @@ -129,8 +131,10 @@ env.Library(
],
)

clientDriverEnv = env.Clone()
clientDriverEnv.InjectThirdPartyIncludePaths('asio')

env.Library(
clientDriverEnv.Library(
target='clientdriver',
source=[
'connection_string_connect.cpp',
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/crypto/SConscript
Expand Up @@ -2,10 +2,15 @@

Import("env")

env = env.Clone()

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

env.Library('crypto_tom',
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/crypto/tom/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library('tomcrypt',
['crypt_argchk.c',
'crypt_find_hash.c',
Expand Down
11 changes: 11 additions & 0 deletions src/mongo/db/SConscript
Expand Up @@ -4,6 +4,14 @@ Import("env")
Import("has_option")
Import("wiredtiger")

env = env.Clone()

# Ideally 's2' would be scoped narrowly but it is spammed in all over the place by
# db/geo unfortunately.
env.InjectThirdPartyIncludePaths(libraries=[
's2',
])

env.SConscript(
dirs=[
'auth',
Expand All @@ -27,6 +35,9 @@ env.SConscript(
'storage',
'views',
],
exports=[
'env',
],
)

#
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/auth/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library('serverauth', ['mongo_authentication_session.cpp'])

generateActionTypes = env.Command(
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/bson/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target="dotted_path_support",
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/catalog/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

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

env.CppUnitTest('collection_options_test', ['collection_options_test.cpp'],
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/commands/SConscript
Expand Up @@ -3,6 +3,8 @@
Import("env")
Import("has_option")

env = env.Clone()

env.Library(
target="test_commands_enabled",
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/concurrency/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='write_conflict_exception',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/exec/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

# WorkingSet target and associated test
env.Library(
target = "working_set",
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/ftdc/SConscript
@@ -1,6 +1,8 @@
# -*- mode: python -*-
Import("env")

env = env.Clone()

ftdcEnv = env.Clone()
ftdcEnv.InjectThirdPartyIncludePaths(libraries=['zlib'])

Expand Down
5 changes: 5 additions & 0 deletions src/mongo/db/fts/SConscript
Expand Up @@ -2,10 +2,15 @@

Import("env")

env = env.Clone()

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

stop_word_languages = [
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/fts/unicode/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Command(
target="codepoints_casefold.cpp",
source=[
Expand Down
4 changes: 3 additions & 1 deletion src/mongo/db/geo/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

# Core geometry shape libraries
env.Library("geometry", [ "hash.cpp",
"shapes.cpp",
Expand Down Expand Up @@ -34,4 +36,4 @@ env.CppUnitTest("r2_region_coverer_test", [ "r2_region_coverer_test.cpp" ],

env.CppUnitTest("big_polygon_test", [ "big_polygon_test.cpp" ],
LIBDEPS = [ "geometry",
"$BUILD_DIR/mongo/db/common" ]) # db/common needed for field parsing
"$BUILD_DIR/mongo/db/common" ]) # db/common needed for field parsing
2 changes: 2 additions & 0 deletions src/mongo/db/index/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='index_descriptor',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/matcher/SConscript
Expand Up @@ -2,6 +2,8 @@

Import('env')

env = env.Clone()

env.Library(
target='path',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/ops/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='update_common',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/pipeline/SConscript
Expand Up @@ -2,6 +2,8 @@

Import('env')

env = env.Clone()

env.Library(
target='aggregation',
source=[
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/db/query/SConscript
Expand Up @@ -2,10 +2,15 @@

Import("env")

env = env.Clone()

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

env.Library(
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/repl/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='bgsync',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/s/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='metadata',
source=[
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/sorter/SConscript
@@ -1,5 +1,7 @@
Import("env")

env = env.Clone()

sorterEnv = env.Clone()
sorterEnv.InjectThirdPartyIncludePaths(libraries=['snappy'])
sorterEnv.CppUnitTest('sorter_test',
Expand Down
2 changes: 2 additions & 0 deletions src/mongo/db/stats/SConscript
Expand Up @@ -2,6 +2,8 @@

Import("env")

env = env.Clone()

env.Library(
target='timer_stats',
source=[
Expand Down

0 comments on commit 1346352

Please sign in to comment.