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

Side by Side Diff: pylib/gyp/__init__.py

Issue 10909158: Add support for building targets directly from gyp. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import copy 7 import copy
8 import gyp.input 8 import gyp.input
9 import optparse 9 import optparse
10 import os.path 10 import os.path
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 env_name='GYP_GENERATOR_OUTPUT', 307 env_name='GYP_GENERATOR_OUTPUT',
308 help='puts generated build files under DIR') 308 help='puts generated build files under DIR')
309 parser.add_option('--ignore-environment', dest='use_environment', 309 parser.add_option('--ignore-environment', dest='use_environment',
310 action='store_false', default=True, regenerate=False, 310 action='store_false', default=True, regenerate=False,
311 help='do not read options from environment variables') 311 help='do not read options from environment variables')
312 parser.add_option('--check', dest='check', action='store_true', 312 parser.add_option('--check', dest='check', action='store_true',
313 help='check format of gyp files') 313 help='check format of gyp files')
314 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', 314 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store',
315 default=None, metavar='DIR', type='path', 315 default=None, metavar='DIR', type='path',
316 help='directory to use as the root of the source tree') 316 help='directory to use as the root of the source tree')
317 parser.add_option('--build', dest='configs', action='append',
318 help='configuration for build after project generation')
317 # --no-circular-check disables the check for circular relationships between 319 # --no-circular-check disables the check for circular relationships between
318 # .gyp files. These relationships should not exist, but they've only been 320 # .gyp files. These relationships should not exist, but they've only been
319 # observed to be harmful with the Xcode generator. Chromium's .gyp files 321 # observed to be harmful with the Xcode generator. Chromium's .gyp files
320 # currently have some circular relationships on non-Mac platforms, so this 322 # currently have some circular relationships on non-Mac platforms, so this
321 # option allows the strict behavior to be used on Macs and the lenient 323 # option allows the strict behavior to be used on Macs and the lenient
322 # behavior to be used elsewhere. 324 # behavior to be used elsewhere.
323 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. 325 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed.
324 parser.add_option('--no-circular-check', dest='circular_check', 326 parser.add_option('--no-circular-check', dest='circular_check',
325 action='store_false', default=True, regenerate=False, 327 action='store_false', default=True, regenerate=False,
326 help="don't check for circular relationships between files") 328 help="don't check for circular relationships between files")
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 491
490 # TODO(mark): Pass |data| for now because the generator needs a list of 492 # TODO(mark): Pass |data| for now because the generator needs a list of
491 # build files that came in. In the future, maybe it should just accept 493 # build files that came in. In the future, maybe it should just accept
492 # a list, and not the whole data dict. 494 # a list, and not the whole data dict.
493 # NOTE: flat_list is the flattened dependency graph specifying the order 495 # NOTE: flat_list is the flattened dependency graph specifying the order
494 # that targets may be built. Build systems that operate serially or that 496 # that targets may be built. Build systems that operate serially or that
495 # need to have dependencies defined before dependents reference them should 497 # need to have dependencies defined before dependents reference them should
496 # generate targets in the order specified in flat_list. 498 # generate targets in the order specified in flat_list.
497 generator.GenerateOutput(flat_list, targets, data, params) 499 generator.GenerateOutput(flat_list, targets, data, params)
498 500
501 if options.configs:
502 valid_configs = targets[flat_list[0]]['configurations'].keys()
503 for conf in options.configs:
504 if conf not in valid_configs:
505 raise GypError("Invalid config specified via --build: %s" % conf)
bradn 2012/09/18 00:22:39 single quotes
Sam Clegg 2012/09/18 00:47:17 Done.
506 generator.PerformBuild(data, options.configs, params)
507
499 # Done 508 # Done
500 return 0 509 return 0
501 510
502 511
503 def main(args): 512 def main(args):
504 try: 513 try:
505 return gyp_main(args) 514 return gyp_main(args)
506 except GypError, e: 515 except GypError, e:
507 sys.stderr.write("gyp: %s\n" % e) 516 sys.stderr.write("gyp: %s\n" % e)
508 return 1 517 return 1
509 518
510 if __name__ == '__main__': 519 if __name__ == '__main__':
511 sys.exit(main(sys.argv[1:])) 520 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698