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

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

Issue 10382161: Fix bug in ninja generator when there's no default action. (Closed) Base URL: http://git.chromium.org/external/gyp.git@master
Patch Set: fix other generators Created 8 years, 6 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 | « pylib/gyp/generator/ninja.py ('k') | test/rules/gyptest-all.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 import gyp 5 import gyp
6 import gyp.common 6 import gyp.common
7 import gyp.SCons as SCons 7 import gyp.SCons as SCons
8 import os.path 8 import os.path
9 import pprint 9 import pprint
10 import re 10 import re
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 'target_name': target_name, 457 'target_name': target_name,
458 }) 458 })
459 if int(action.get('process_outputs_as_sources', 0)): 459 if int(action.get('process_outputs_as_sources', 0)):
460 fp.write('input_files.extend(_outputs)\n') 460 fp.write('input_files.extend(_outputs)\n')
461 fp.write('prerequisites.extend(_outputs)\n') 461 fp.write('prerequisites.extend(_outputs)\n')
462 fp.write('target_files.extend(_outputs)\n') 462 fp.write('target_files.extend(_outputs)\n')
463 463
464 rules = spec.get('rules', []) 464 rules = spec.get('rules', [])
465 for rule in rules: 465 for rule in rules:
466 name = rule['rule_name'].translate(string.maketrans(' ()-', '____')) 466 name = rule['rule_name'].translate(string.maketrans(' ()-', '____'))
467 a = ['cd', src_subdir, '&&'] + rule['action']
468 message = rule.get('message') 467 message = rule.get('message')
469 if message: 468 if message:
470 message = repr(message) 469 message = repr(message)
471 if int(rule.get('process_outputs_as_sources', 0)): 470 if int(rule.get('process_outputs_as_sources', 0)):
472 poas_line = '_processed_input_files.extend(_generated)' 471 poas_line = '_processed_input_files.extend(_generated)'
473 else: 472 else:
474 poas_line = '_processed_input_files.append(infile)' 473 poas_line = '_processed_input_files.append(infile)'
475 inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])] 474 inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])]
476 outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])] 475 outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])]
476 # Skip a rule with no action and no inputs.
477 if 'action' not in rule and not rule.get('rule_sources', []):
478 continue
479 a = ['cd', src_subdir, '&&'] + rule['action']
477 fp.write(_rule_template % { 480 fp.write(_rule_template % {
478 'inputs' : pprint.pformat(inputs), 481 'inputs' : pprint.pformat(inputs),
479 'outputs' : pprint.pformat(outputs), 482 'outputs' : pprint.pformat(outputs),
480 'action' : pprint.pformat(a), 483 'action' : pprint.pformat(a),
481 'extension' : rule['extension'], 484 'extension' : rule['extension'],
482 'name' : name, 485 'name' : name,
483 'message' : message, 486 'message' : message,
484 'process_outputs_as_sources_line' : poas_line, 487 'process_outputs_as_sources_line' : poas_line,
485 'src_dir' : src_subdir_, 488 'src_dir' : src_subdir_,
486 }) 489 })
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] 1039 bf, target = gyp.common.ParseQualifiedTarget(t)[:2]
1037 target_filename = TargetFilename(target, bf, options.suffix) 1040 target_filename = TargetFilename(target, bf, options.suffix)
1038 tpath = gyp.common.RelativePath(target_filename, output_dir) 1041 tpath = gyp.common.RelativePath(target_filename, output_dir)
1039 sconscript_files[target] = tpath 1042 sconscript_files[target] = tpath
1040 1043
1041 output_filename = output_path(output_filename) 1044 output_filename = output_path(output_filename)
1042 if sconscript_files: 1045 if sconscript_files:
1043 GenerateSConscriptWrapper(build_file, data[build_file], basename, 1046 GenerateSConscriptWrapper(build_file, data[build_file], basename,
1044 output_filename, sconscript_files, 1047 output_filename, sconscript_files,
1045 default_configuration) 1048 default_configuration)
OLDNEW
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/rules/gyptest-all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698