OLD | NEW |
1 # Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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 # Autocompletion config for YouCompleteMe in V8. | 5 # Autocompletion config for YouCompleteMe in V8. |
6 # | 6 # |
7 # USAGE: | 7 # USAGE: |
8 # | 8 # |
9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe] | 9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe] |
10 # (Googlers should check out [go/ycm]) | 10 # (Googlers should check out [go/ycm]) |
11 # | 11 # |
12 # 2. Point to this config file in your .vimrc: | 12 # 2. Profit |
13 # let g:ycm_global_ycm_extra_conf = | |
14 # '<v8_root>/tools/vim/v8.ycm_extra_conf.py' | |
15 # | |
16 # 3. Profit | |
17 # | 13 # |
18 # | 14 # |
19 # Usage notes: | 15 # Usage notes: |
20 # | 16 # |
21 # * You must use ninja & clang to build V8. | 17 # * You must use ninja & clang to build V8. |
22 # | 18 # |
23 # * You must have run gyp_v8 and built V8 recently. | 19 # * You must have run gyp_v8 and built V8 recently. |
24 # | 20 # |
25 # | 21 # |
26 # Hacking notes: | 22 # Hacking notes: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 break; | 118 break; |
123 else: | 119 else: |
124 # If this is a standalone -inl.h file with no source, the best we can | 120 # If this is a standalone -inl.h file with no source, the best we can |
125 # do is try to use the default flags. | 121 # do is try to use the default flags. |
126 return v8_flags | 122 return v8_flags |
127 else: | 123 else: |
128 # If this is a standalone .h file with no source, the best we can do is | 124 # If this is a standalone .h file with no source, the best we can do is |
129 # try to use the default flags. | 125 # try to use the default flags. |
130 return v8_flags | 126 return v8_flags |
131 | 127 |
132 sys.path.append(os.path.join(v8_root, 'tools', 'vim')) | 128 sys.path.append(os.path.join(v8_root, 'tools', 'ninja')) |
133 from ninja_output import GetNinjaOutputDirectory | 129 from ninja_output import GetNinjaOutputDirectory |
134 out_dir = os.path.realpath(GetNinjaOutputDirectory(v8_root)) | 130 out_dir = os.path.realpath(GetNinjaOutputDirectory(v8_root)) |
135 | 131 |
136 # Ninja needs the path to the source file relative to the output build | 132 # Ninja needs the path to the source file relative to the output build |
137 # directory. | 133 # directory. |
138 rel_filename = os.path.relpath(os.path.realpath(filename), out_dir) | 134 rel_filename = os.path.relpath(os.path.realpath(filename), out_dir) |
139 | 135 |
140 # Ask ninja how it would build our source file. | 136 # Ask ninja how it would build our source file. |
141 p = subprocess.Popen(['ninja', '-v', '-C', out_dir, '-t', | 137 p = subprocess.Popen(['ninja', '-v', '-C', out_dir, '-t', |
142 'commands', rel_filename + '^'], | 138 'commands', rel_filename + '^'], |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 'flags': (List of Strings) Command line flags. | 184 'flags': (List of Strings) Command line flags. |
189 'do_cache': (Boolean) True if the result should be cached. | 185 'do_cache': (Boolean) True if the result should be cached. |
190 """ | 186 """ |
191 v8_root = FindV8SrcFromFilename(filename) | 187 v8_root = FindV8SrcFromFilename(filename) |
192 v8_flags = GetClangCommandFromNinjaForFilename(v8_root, filename) | 188 v8_flags = GetClangCommandFromNinjaForFilename(v8_root, filename) |
193 final_flags = flags + v8_flags | 189 final_flags = flags + v8_flags |
194 return { | 190 return { |
195 'flags': final_flags, | 191 'flags': final_flags, |
196 'do_cache': True | 192 'do_cache': True |
197 } | 193 } |
OLD | NEW |