Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: mojo/tools/mopy/paths.py

Issue 775343003: Makes mojob create a different directory when --asan is specified (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: use and merge 2 trunk Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/tools/mojob.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from .config import Config 7 from .config import Config
8 8
9 class Paths(object): 9 class Paths(object):
10 """Provides commonly used paths""" 10 """Provides commonly used paths"""
11 11
12 def __init__(self, config=None, build_dir=None): 12 def __init__(self, config=None, build_dir=None):
13 """Specify either a config or a build_dir to generate paths to binary 13 """Specify either a config or a build_dir to generate paths to binary
14 artifacts.""" 14 artifacts."""
15 self.src_root = os.path.abspath(os.path.join(__file__, 15 self.src_root = os.path.abspath(os.path.join(__file__,
16 os.pardir, os.pardir, os.pardir, os.pardir)) 16 os.pardir, os.pardir, os.pardir, os.pardir))
17 self.mojo_dir = os.path.join(self.src_root, "mojo") 17 self.mojo_dir = os.path.join(self.src_root, "mojo")
18 18
19 if config: 19 if config:
20 assert build_dir is None 20 assert build_dir is None
21 subdir = "" 21 subdir = ""
22 if config.target_os == Config.OS_ANDROID: 22 if config.target_os == Config.OS_ANDROID:
23 subdir += "android_" 23 subdir += "android_"
24 elif config.target_os == Config.OS_CHROMEOS: 24 elif config.target_os == Config.OS_CHROMEOS:
25 subdir += "chromeos_" 25 subdir += "chromeos_"
26 subdir += "Debug" if config.is_debug else "Release" 26 subdir += "Debug" if config.is_debug else "Release"
27 if config.sanitizer == Config.SANITIZER_ASAN:
28 subdir += "_asan"
27 self.build_dir = os.path.join(self.src_root, "out", subdir) 29 self.build_dir = os.path.join(self.src_root, "out", subdir)
28 elif build_dir is not None: 30 elif build_dir is not None:
29 self.build_dir = os.path.abspath(build_dir) 31 self.build_dir = os.path.abspath(build_dir)
30 else: 32 else:
31 self.build_dir = None 33 self.build_dir = None
32 34
33 if self.build_dir is not None: 35 if self.build_dir is not None:
34 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell") 36 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell")
35 # TODO(vtl): Use the host OS here, since |config| may not be available. 37 # TODO(vtl): Use the host OS here, since |config| may not be available.
36 # In any case, if the target is Windows, but the host isn't, using 38 # In any case, if the target is Windows, but the host isn't, using
37 # |os.path| isn't correct.... 39 # |os.path| isn't correct....
38 if Config.GetHostOS() == Config.OS_WINDOWS: 40 if Config.GetHostOS() == Config.OS_WINDOWS:
39 self.mojo_shell_path += ".exe" 41 self.mojo_shell_path += ".exe"
40 else: 42 else:
41 self.mojo_shell_path = None 43 self.mojo_shell_path = None
42 44
43 def RelPath(self, path): 45 def RelPath(self, path):
44 """Returns the given path, relative to the current directory.""" 46 """Returns the given path, relative to the current directory."""
45 return os.path.relpath(path) 47 return os.path.relpath(path)
46 48
47 def SrcRelPath(self, path): 49 def SrcRelPath(self, path):
48 """Returns the given path, relative to self.src_root.""" 50 """Returns the given path, relative to self.src_root."""
49 return os.path.relpath(path, self.src_root) 51 return os.path.relpath(path, self.src_root)
OLDNEW
« no previous file with comments | « mojo/tools/mojob.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698