aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-05-22 16:11:25 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-05-29 14:07:43 -0400
commit29ad6dd90c07d4cd762f3eeaf9f61324f7311baf (patch)
tree606a1ccac62061ed29ef2c319007a4a47efe1d4c /mesonbuild
parentb6833c1cc18de77aa1f91c1666c030ee4de077c8 (diff)
downloadmeson-29ad6dd90c07d4cd762f3eeaf9f61324f7311baf.zip
meson-29ad6dd90c07d4cd762f3eeaf9f61324f7311baf.tar.gz
meson-29ad6dd90c07d4cd762f3eeaf9f61324f7311baf.tar.bz2
avoid endless reconfigure loops when a build directory is copied around
ninja's configured command for regenerating a build directory on any action that *requires* reconfiguring, specifies the source and build directories as they were known during initial project generation. This means that if the build directory is no longer the *same* build directory, we will regenerate... the original location, rather than the location we want. After that, ninja notices that build.ninja is still out of date, so it goes and reconfigures again. And again. And again. This is probably broken intentions, but endless reconfigure loops are a kind of evil beyond all evils. There are no valid options here whatsoever other than: - doing what the user actually meant - spawning a clear error message describing why meson refuses to work, then exiting with a fatal error But it turns out that it's actually pretty easy to do what the user actually meant, and reconfigure the current build directory instead of the original one. This permanently breaks the link between the two. Fixes #6131
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 4cb680b..19da249 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1293,7 +1293,9 @@ class NinjaBackend(backends.Backend):
['--internal',
'regenerate',
self.environment.get_source_dir(),
- self.environment.get_build_dir()]
+ # Ninja always runs from the build_dir. This includes cases where the user moved the
+ # build directory and invalidated most references. Make sure it still regenerates.
+ '.']
self.add_rule(NinjaRule('REGENERATE_BUILD',
c, [],
'Regenerating build files.',