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

Side by Side Diff: tools/vim/ninja_output.py

Issue 915963002: [vim] Add ninja-powered CrBuild/CrCompileFile functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months 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 | « tools/vim/ninja-build.vim ('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
(Empty)
1 # Copyright 2015 the V8 project authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 import os
7 import os.path
8
9
10 def GetNinjaOutputDirectory(v8_root, configuration=None):
11 """Returns <v8_root>/<output_dir>/(Release|Debug).
12
13 The configuration chosen is the one most recently generated/built, but can be
14 overriden via the <configuration> parameter. Detects a custom output_dir
15 specified by GYP_GENERATOR_FLAGS."""
16
17 output_dir = 'out'
18 generator_flags = os.getenv('GYP_GENERATOR_FLAGS', '').split(' ')
19 for flag in generator_flags:
20 name_value = flag.split('=', 1)
21 if len(name_value) == 2 and name_value[0] == 'output_dir':
22 output_dir = name_value[1]
23
24 root = os.path.join(v8_root, output_dir)
25 if configuration:
26 return os.path.join(root, configuration)
27
28 debug_path = os.path.join(root, 'Debug')
29 release_path = os.path.join(root, 'Release')
30
31 def is_release_newer(test_path):
32 try:
33 debug_mtime = os.path.getmtime(os.path.join(debug_path, test_path))
34 except os.error:
35 debug_mtime = 0
36 try:
37 rel_mtime = os.path.getmtime(os.path.join(release_path, test_path))
38 except os.error:
39 rel_mtime = 0
40 return rel_mtime >= debug_mtime
41
42 if is_release_newer('.ninja_log') or is_release_newer('.ninja_deps'):
43 return release_path
44 return debug_path
OLDNEW
« no previous file with comments | « tools/vim/ninja-build.vim ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698