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

Unified Diff: tools/vim/ninja-build.vim

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vim/chromium.ycm_extra_conf.py ('k') | tools/vim/ninja_output.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vim/ninja-build.vim
diff --git a/tools/vim/ninja-build.vim b/tools/vim/ninja-build.vim
index 852c5a99eb0d07676d20b4dbd68292a2bb63dae0..6e14cba227ca2d51ec47cd0c18cc22860349721d 100644
--- a/tools/vim/ninja-build.vim
+++ b/tools/vim/ninja-build.vim
@@ -41,30 +41,17 @@ def path_to_source_root():
return candidate
-def guess_configuration():
- """Default to the configuration with either a newer build.ninja or a newer
- protoc."""
- root = os.path.join(path_to_source_root(), 'out')
- def is_release_15s_newer(test_path):
- try:
- debug_mtime = os.path.getmtime(os.path.join(root, 'Debug', test_path))
- except os.error:
- debug_mtime = 0
- try:
- rel_mtime = os.path.getmtime(os.path.join(root, 'Release', test_path))
- except os.error:
- rel_mtime = 0
- return rel_mtime - debug_mtime >= 15
- configuration = 'Debug'
- if is_release_15s_newer('build.ninja') or is_release_15s_newer('protoc'):
- configuration = 'Release'
- return configuration
+def path_to_build_dir(configuration):
+ """Returns <chrome_root>/<output_dir>/(Release|Debug)."""
+ chrome_root = path_to_source_root()
+ sys.path.append(os.path.join(chrome_root, 'tools', 'vim'))
+ from ninja_output import GetNinjaOutputDirectory
+ return GetNinjaOutputDirectory(chrome_root, configuration)
def compute_ninja_command_for_current_buffer(configuration=None):
"""Returns the shell command to compile the file in the current buffer."""
- if not configuration: configuration = guess_configuration()
- build_dir = os.path.join(path_to_source_root(), 'out', configuration)
+ build_dir = path_to_build_dir(configuration)
# ninja needs filepaths for the ^ syntax to be relative to the
# build directory.
@@ -79,9 +66,8 @@ def compute_ninja_command_for_current_buffer(configuration=None):
def compute_ninja_command_for_targets(targets='', configuration=None):
- if not configuration: configuration = guess_configuration()
- build_dir = os.path.join(path_to_source_root(), 'out', configuration)
- build_cmd = ' '.join(['ninja', '-C', build_dir, targets])
+ build_cmd = ' '.join(['ninja', '-C', path_to_build_dir(configuration),
+ targets])
vim.command('return "%s"' % build_cmd)
endpython
« no previous file with comments | « tools/vim/chromium.ycm_extra_conf.py ('k') | tools/vim/ninja_output.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698