diff options
author | Charlie Barto <chbarto@microsoft.com> | 2019-07-05 11:59:15 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-07-05 21:59:15 +0300 |
commit | 1e182b51c63bae7d0354334829de21eb5483ddf3 (patch) | |
tree | 1a78171982b2fbc201a38bd5f518dc7e9f8bbfe7 /mesonbuild | |
parent | dd8f75ad93d7d578648c8290b875013078ffdf86 (diff) | |
download | meson-1e182b51c63bae7d0354334829de21eb5483ddf3.zip meson-1e182b51c63bae7d0354334829de21eb5483ddf3.tar.gz meson-1e182b51c63bae7d0354334829de21eb5483ddf3.tar.bz2 |
Improve performance with windows defender ATP
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/clike.py | 8 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 8 | ||||
-rw-r--r-- | mesonbuild/environment.py | 1 |
3 files changed, 8 insertions, 9 deletions
diff --git a/mesonbuild/compilers/clike.py b/mesonbuild/compilers/clike.py index b9aaecf..cebbffa 100644 --- a/mesonbuild/compilers/clike.py +++ b/mesonbuild/compilers/clike.py @@ -434,8 +434,8 @@ class CLikeCompiler: def _build_wrapper(self, code, env, extra_args, dependencies=None, mode='compile', want_output=False, disable_cache=False): args = self._get_compiler_check_args(env, extra_args, dependencies, mode) if disable_cache or want_output: - return self.compile(code, extra_args=args, mode=mode, want_output=want_output) - return self.cached_compile(code, env.coredata, extra_args=args, mode=mode) + return self.compile(code, extra_args=args, mode=mode, want_output=want_output, temp_dir=env.scratch_dir) + return self.cached_compile(code, env.coredata, extra_args=args, mode=mode, temp_dir=env.scratch_dir) def links(self, code, env, *, extra_args=None, dependencies=None, disable_cache=False): return self.compiles(code, env, extra_args=extra_args, @@ -640,7 +640,7 @@ class CLikeCompiler: mode='preprocess').to_native() func = lambda: self.cached_compile(code.format(**fargs), env.coredata, extra_args=args, mode='preprocess') if disable_cache: - func = lambda: self.compile(code.format(**fargs), extra_args=args, mode='preprocess') + func = lambda: self.compile(code.format(**fargs), extra_args=args, mode='preprocess', temp_dir=env.scratch_dir) with func() as p: cached = p.cached if p.returncode != 0: @@ -861,7 +861,7 @@ class CLikeCompiler: ''' args = self.get_compiler_check_args() n = 'symbols_have_underscore_prefix' - with self.compile(code, extra_args=args, mode='compile', want_output=True) as p: + with self.compile(code, extra_args=args, mode='compile', want_output=True, temp_dir=env.scratch_dir) as p: if p.returncode != 0: m = 'BUG: Unable to compile {!r} check: {}' raise RuntimeError(m.format(n, p.stdo)) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 86c1e33..50225c0 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1152,11 +1152,11 @@ class Compiler: return args @contextlib.contextmanager - def compile(self, code, extra_args=None, *, mode='link', want_output=False): + def compile(self, code, extra_args=None, *, mode='link', want_output=False, temp_dir=None): if extra_args is None: extra_args = [] try: - with tempfile.TemporaryDirectory() as tmpdirname: + with tempfile.TemporaryDirectory(dir=temp_dir) as tmpdirname: if isinstance(code, str): srcname = os.path.join(tmpdirname, 'testfile.' + self.default_suffix) @@ -1201,7 +1201,7 @@ class Compiler: pass @contextlib.contextmanager - def cached_compile(self, code, cdata: coredata.CoreData, *, extra_args=None, mode: str = 'link'): + def cached_compile(self, code, cdata: coredata.CoreData, *, extra_args=None, mode: str = 'link', temp_dir=None): assert(isinstance(cdata, coredata.CoreData)) # Calculate the key @@ -1210,7 +1210,7 @@ class Compiler: # Check if not cached if key not in cdata.compiler_check_cache: - with self.compile(code, extra_args=extra_args, mode=mode, want_output=False) as p: + with self.compile(code, extra_args=extra_args, mode=mode, want_output=False, temp_dir=temp_dir) as p: # Remove all attributes except the following # This way the object can be serialized tokeep = ['args', 'commands', 'input_name', 'output_name', diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0cf511f..948e225 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -376,7 +376,6 @@ class Environment: def __init__(self, source_dir, build_dir, options): self.source_dir = source_dir self.build_dir = build_dir - # Do not try to create build directories when build_dir is none. # This reduced mode is used by the --buildoptions introspector if build_dir is not None: |