summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2021-10-12 09:03:33 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-12 17:04:07 +0000
commit9b9183727da0b8f1bbe2e03146d167d5d65e4ea7 (patch)
tree3193a3733adcc4c1343b59aa312ee120cd9ae506 /site_scons
parent4be784820744dd523c922c6c7172a22e0f52d4f7 (diff)
downloadmongo-9b9183727da0b8f1bbe2e03146d167d5d65e4ea7.tar.gz
Revert "SERVER-55259 Ensure build.ninja is always in a clean state"
This reverts commit 13f0ae71f634409f2e219616ac489b45057d56bb.
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/ninja.py35
1 files changed, 7 insertions, 28 deletions
diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py
index 25856de59f7..b9b2c3d2d47 100644
--- a/site_scons/site_tools/ninja.py
+++ b/site_scons/site_tools/ninja.py
@@ -28,7 +28,6 @@ import importlib
import io
import shutil
import shlex
-import tempfile
import textwrap
from glob import glob
@@ -516,11 +515,6 @@ class NinjaState:
),
"description": "Symlink $in -> $out",
},
- "NOOP": {
- "command": "echo 0 > {}".format("NUL" if sys.platform == 'win32' else "/dev/null"),
- "description": "Checking $out",
- "pool": "local_pool",
- },
"INSTALL": {
"command": "$COPY $in $out",
"description": "Install $out",
@@ -565,9 +559,9 @@ class NinjaState:
},
"REGENERATE": {
"command": "$SCONS_INVOCATION_W_TARGETS",
- "description": "Regenerating $self",
- "depfile": os.path.join(get_path(env['NINJA_BUILDDIR']), '$out.depfile'),
+ "description": "Regenerating $out",
"generator": 1,
+ "depfile": os.path.join(get_path(env['NINJA_BUILDDIR']), '$out.depfile'),
# Console pool restricts to 1 job running at a time,
# it additionally has some special handling about
# passing stdin, stdout, etc to process in this pool
@@ -812,28 +806,15 @@ class NinjaState:
# list of build generation about. However, because the generate rule
# is hardcoded here, we need to do this generate_depfile call manually.
ninja_file_path = self.env.File(ninja_file).path
- ninja_in_file_path = os.path.join(get_path(self.env['NINJA_BUILDDIR']), os.path.basename(ninja_file)) + ".in"
generate_depfile(
self.env,
- ninja_in_file_path,
- self.env['NINJA_REGENERATE_DEPS'],
- )
-
- ninja.build(
- ninja_in_file_path,
- rule="REGENERATE",
- variables={
- "self": ninja_file_path,
- },
+ ninja_file_path,
+ self.env['NINJA_REGENERATE_DEPS']
)
- # This sets up a dependency edge between build.ninja.in and build.ninja
- # without actually taking any action to transform one into the other
- # because we write both files ourselves later.
ninja.build(
ninja_file_path,
- rule="NOOP",
- inputs=[ninja_in_file_path],
+ rule="REGENERATE",
implicit=[__file__],
)
@@ -870,10 +851,8 @@ class NinjaState:
if scons_default_targets:
ninja.default(" ".join(scons_default_targets))
- with tempfile.NamedTemporaryFile(delete=False, mode='w') as temp_ninja_file:
- temp_ninja_file.write(content.getvalue())
- shutil.move(temp_ninja_file.name, ninja_in_file_path)
- shutil.copy2(ninja_in_file_path, ninja_file)
+ with open(ninja_file, "w") as build_ninja:
+ build_ninja.write(content.getvalue())
self.__generated = True