aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-11-07 10:28:20 +0200
committerGitHub <noreply@github.com>2018-11-07 10:28:20 +0200
commit996f07c546d6e82b0648a1d9f81d7474b1bec76e (patch)
treee9f6f8f58f605741ad578d01ab0d8708f75c235c /mesonbuild/environment.py
parente921e38301a54b111c7606aa30d718c856140e47 (diff)
parenta173dbf7724b71771fac51e2fcf316b5bfa59848 (diff)
downloadmeson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.zip
meson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.tar.gz
meson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.tar.bz2
Merge pull request #4356 from xclaesse/wipe
Add --wipe command line option
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index a002aa1..8891b5c 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -17,7 +17,7 @@ import configparser, os, platform, re, sys, shlex, shutil, subprocess
from . import coredata
from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker
from . import mesonlib
-from .mesonlib import EnvironmentException, PerMachine, Popen_safe
+from .mesonlib import MesonException, EnvironmentException, PerMachine, Popen_safe
from . import mlog
from . import compilers
@@ -317,13 +317,17 @@ class Environment:
self.coredata = coredata.load(self.get_build_dir())
self.first_invocation = False
except FileNotFoundError:
- # WARNING: Don't use any values from coredata in __init__. It gets
- # re-initialized with project options by the interpreter during
- # build file parsing.
- self.coredata = coredata.CoreData(options)
- # Used by the regenchecker script, which runs meson
- self.coredata.meson_command = mesonlib.meson_command
- self.first_invocation = True
+ self.create_new_coredata(options)
+ except MesonException as e:
+ # If we stored previous command line options, we can recover from
+ # a broken/outdated coredata.
+ if os.path.isfile(coredata.get_cmd_line_file(self.build_dir)):
+ mlog.warning('Regenerating configuration from scratch.')
+ mlog.log('Reason:', mlog.red(str(e)))
+ coredata.read_cmd_line_file(self.build_dir, options)
+ self.create_new_coredata(options)
+ else:
+ raise e
self.exe_wrapper = None
self.machines = MachineInfos()
@@ -389,6 +393,15 @@ class Environment:
else:
self.native_strip_bin = ['strip']
+ def create_new_coredata(self, options):
+ # WARNING: Don't use any values from coredata in __init__. It gets
+ # re-initialized with project options by the interpreter during
+ # build file parsing.
+ self.coredata = coredata.CoreData(options)
+ # Used by the regenchecker script, which runs meson
+ self.coredata.meson_command = mesonlib.meson_command
+ self.first_invocation = True
+
def is_cross_build(self):
return self.cross_info is not None