diff options
-rwxr-xr-x | SConstruct | 21 | ||||
-rw-r--r-- | etc/drivers_nightly.yml | 6 | ||||
-rw-r--r-- | site_scons/site_tools/ninja.py | 11 |
3 files changed, 17 insertions, 21 deletions
diff --git a/SConstruct b/SConstruct index fe3e013a98a..47ae06c2ae5 100755 --- a/SConstruct +++ b/SConstruct @@ -4137,11 +4137,20 @@ if get_option('ninja') != 'disabled': return dependencies env['NINJA_REGENERATE_DEPS'] = ninja_generate_deps + + if env.TargetOSIs('windows'): + # The /b option here will make sure that windows updates the mtime + # when copying the file. This allows to not need to use restat for windows + # copy commands. + copy_install_cmd = "cmd.exe /c copy /b $in $out 1>NUL" + else: + copy_install_cmd = "install $in $out" + if env.GetOption('install-action') == 'hardlink': if env.TargetOSIs('windows'): - install_cmd = "cmd.exe /c mklink /h $out $in 1>nul" + install_cmd = f"cmd.exe /c mklink /h $out $in 1>nul || {copy_install_cmd}" else: - install_cmd = "ln $in $out" + install_cmd = f"ln $in $out || {copy_install_cmd}" elif env.GetOption('install-action') == 'symlink': @@ -4173,13 +4182,7 @@ if get_option('ninja') != 'disabled': install_cmd = "ln -s $relpath $out" else: - if env.TargetOSIs('windows'): - # The /b option here will make sure that windows updates the mtime - # when copying the file. This allows to not need to use restat for windows - # copy commands. - install_cmd = "cmd.exe /c copy /b $in $out 1>NUL" - else: - install_cmd = "install $in $out" + install_cmd = copy_install_cmd env.NinjaRule("INSTALL", install_cmd, description="Installed $out", pool="install_pool") diff --git a/etc/drivers_nightly.yml b/etc/drivers_nightly.yml index 60071b5fa5e..c7c97c6d698 100644 --- a/etc/drivers_nightly.yml +++ b/etc/drivers_nightly.yml @@ -515,12 +515,6 @@ tasks: # reduce the disk space impact of installing all of the binaries and # associated debug info. - # The expansion here is a workaround to let us set a different install-action - # for tasks that don't support the one we set here. A better plan would be - # to support install-action for Ninja builds directly. - # TODO: https://jira.mongodb.org/browse/SERVER-48203 - extra_args="--install-mode=hygienic --install-action=${task_install_action|hardlink}" - # By default, limit link jobs to one quarter of our overall -j # concurrency unless locally overridden. We do this because in # static link environments, the memory consumption of each diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py index 975c8f01b36..a80ccab9853 100644 --- a/site_scons/site_tools/ninja.py +++ b/site_scons/site_tools/ninja.py @@ -433,9 +433,9 @@ class SConsToNinjaTranslator: class NinjaState: """Maintains state of Ninja build system as it's translated from SCons.""" - def __init__(self, env, writer_class): + def __init__(self, env, ninja_syntax): self.env = env - self.writer_class = writer_class + self.writer_class = ninja_syntax.Writer self.__generated = False self.translator = SConsToNinjaTranslator(env) self.generated_suffixes = env.get("NINJA_GENERATED_SOURCE_SUFFIXES", []) @@ -452,7 +452,7 @@ class NinjaState: # shell quoting on whatever platform it's run on. Here we use it # to make the SCONS_INVOCATION variable properly quoted for things # like CCFLAGS - escape = env.get("ESCAPE", lambda x: x) + scons_escape = env.get("ESCAPE", lambda x: x) self.variables = { # The /b option here will make sure that windows updates the mtime @@ -470,9 +470,8 @@ class NinjaState: if arg not in COMMAND_LINE_TARGETS ]), ), - ), "SCONS_INVOCATION_W_TARGETS": "{} {}".format( - sys.executable, " ".join([escape(arg) for arg in sys.argv]) + sys.executable, " ".join([scons_escape(arg) for arg in sys.argv]) ), # This must be set to a global default per: # https://ninja-build.org/manual.html @@ -1720,7 +1719,7 @@ def generate(env): ninja_syntax = importlib.import_module(ninja_syntax_mod_name.replace(".py", "")) global NINJA_STATE - NINJA_STATE = NinjaState(env, ninja_syntax.Writer) + NINJA_STATE = NinjaState(env, ninja_syntax) # Here we will force every builder to use an emitter which makes the ninja # file depend on it's target. This forces the ninja file to the bottom of |