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

Side by Side Diff: pylib/gyp/generator/eclipse.py

Issue 113463003: Use gyp.common.EnsureDirExists() in more places. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/generator/cmake.py ('k') | pylib/gyp/generator/make.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. 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 """GYP backend that generates Eclipse CDT settings files. 5 """GYP backend that generates Eclipse CDT settings files.
6 6
7 This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML 7 This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
8 files that can be imported into an Eclipse CDT project. The XML file contains a 8 files that can be imported into an Eclipse CDT project. The XML file contains a
9 list of include paths and symbols (i.e. defines). 9 list of include paths and symbols (i.e. defines).
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 # e.g. "out/Debug" 263 # e.g. "out/Debug"
264 build_dir = os.path.join(generator_flags.get('output_dir', 'out'), 264 build_dir = os.path.join(generator_flags.get('output_dir', 'out'),
265 config_name) 265 config_name)
266 266
267 toplevel_build = os.path.join(options.toplevel_dir, build_dir) 267 toplevel_build = os.path.join(options.toplevel_dir, build_dir)
268 # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the 268 # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the
269 # SHARED_INTERMEDIATE_DIR. Include both possible locations. 269 # SHARED_INTERMEDIATE_DIR. Include both possible locations.
270 shared_intermediate_dirs = [os.path.join(toplevel_build, 'obj', 'gen'), 270 shared_intermediate_dirs = [os.path.join(toplevel_build, 'obj', 'gen'),
271 os.path.join(toplevel_build, 'gen')] 271 os.path.join(toplevel_build, 'gen')]
272 272
273 if not os.path.exists(toplevel_build): 273 out_name = os.path.join(toplevel_build, 'eclipse-cdt-settings.xml')
274 os.makedirs(toplevel_build) 274 gyp.common.EnsureDirExists(out_name)
275 out = open(os.path.join(toplevel_build, 'eclipse-cdt-settings.xml'), 'w') 275 out = open(out_name, 'w')
276 276
277 out.write('<?xml version="1.0" encoding="UTF-8"?>\n') 277 out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
278 out.write('<cdtprojectproperties>\n') 278 out.write('<cdtprojectproperties>\n')
279 279
280 eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File', 280 eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File',
281 'GNU C++', 'GNU C', 'Assembly'] 281 'GNU C++', 'GNU C', 'Assembly']
282 include_dirs = GetAllIncludeDirectories(target_list, target_dicts, 282 include_dirs = GetAllIncludeDirectories(target_list, target_dicts,
283 shared_intermediate_dirs, config_name, 283 shared_intermediate_dirs, config_name,
284 params) 284 params)
285 WriteIncludePaths(out, eclipse_langs, include_dirs) 285 WriteIncludePaths(out, eclipse_langs, include_dirs)
(...skipping 13 matching lines...) Expand all
299 user_config = params.get('generator_flags', {}).get('config', None) 299 user_config = params.get('generator_flags', {}).get('config', None)
300 if user_config: 300 if user_config:
301 GenerateOutputForConfig(target_list, target_dicts, data, params, 301 GenerateOutputForConfig(target_list, target_dicts, data, params,
302 user_config) 302 user_config)
303 else: 303 else:
304 config_names = target_dicts[target_list[0]]['configurations'].keys() 304 config_names = target_dicts[target_list[0]]['configurations'].keys()
305 for config_name in config_names: 305 for config_name in config_names:
306 GenerateOutputForConfig(target_list, target_dicts, data, params, 306 GenerateOutputForConfig(target_list, target_dicts, data, params,
307 config_name) 307 config_name)
308 308
OLDNEW
« no previous file with comments | « pylib/gyp/generator/cmake.py ('k') | pylib/gyp/generator/make.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698