OLD | NEW |
1 # Copyright (c) 2011 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 |
| 11 import string |
11 | 12 |
12 | 13 |
13 # TODO: remove when we delete the last WriteList() call in this module | 14 # TODO: remove when we delete the last WriteList() call in this module |
14 WriteList = SCons.WriteList | 15 WriteList = SCons.WriteList |
15 | 16 |
16 | 17 |
17 generator_default_variables = { | 18 generator_default_variables = { |
18 'EXECUTABLE_PREFIX': '', | 19 'EXECUTABLE_PREFIX': '', |
19 'EXECUTABLE_SUFFIX': '', | 20 'EXECUTABLE_SUFFIX': '', |
20 'STATIC_LIB_PREFIX': '${LIBPREFIX}', | 21 'STATIC_LIB_PREFIX': '${LIBPREFIX}', |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 'message' : message, | 456 'message' : message, |
456 'target_name': target_name, | 457 'target_name': target_name, |
457 }) | 458 }) |
458 if int(action.get('process_outputs_as_sources', 0)): | 459 if int(action.get('process_outputs_as_sources', 0)): |
459 fp.write('input_files.extend(_outputs)\n') | 460 fp.write('input_files.extend(_outputs)\n') |
460 fp.write('prerequisites.extend(_outputs)\n') | 461 fp.write('prerequisites.extend(_outputs)\n') |
461 fp.write('target_files.extend(_outputs)\n') | 462 fp.write('target_files.extend(_outputs)\n') |
462 | 463 |
463 rules = spec.get('rules', []) | 464 rules = spec.get('rules', []) |
464 for rule in rules: | 465 for rule in rules: |
465 name = rule['rule_name'] | 466 name = rule['rule_name'].translate(string.maketrans(' ()-', '____')) |
466 a = ['cd', src_subdir, '&&'] + rule['action'] | 467 a = ['cd', src_subdir, '&&'] + rule['action'] |
467 message = rule.get('message') | 468 message = rule.get('message') |
468 if message: | 469 if message: |
469 message = repr(message) | 470 message = repr(message) |
470 if int(rule.get('process_outputs_as_sources', 0)): | 471 if int(rule.get('process_outputs_as_sources', 0)): |
471 poas_line = '_processed_input_files.extend(_generated)' | 472 poas_line = '_processed_input_files.extend(_generated)' |
472 else: | 473 else: |
473 poas_line = '_processed_input_files.append(infile)' | 474 poas_line = '_processed_input_files.append(infile)' |
474 inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])] | 475 inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])] |
475 outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])] | 476 outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])] |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] | 1036 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] |
1036 target_filename = TargetFilename(target, bf, options.suffix) | 1037 target_filename = TargetFilename(target, bf, options.suffix) |
1037 tpath = gyp.common.RelativePath(target_filename, output_dir) | 1038 tpath = gyp.common.RelativePath(target_filename, output_dir) |
1038 sconscript_files[target] = tpath | 1039 sconscript_files[target] = tpath |
1039 | 1040 |
1040 output_filename = output_path(output_filename) | 1041 output_filename = output_path(output_filename) |
1041 if sconscript_files: | 1042 if sconscript_files: |
1042 GenerateSConscriptWrapper(build_file, data[build_file], basename, | 1043 GenerateSConscriptWrapper(build_file, data[build_file], basename, |
1043 output_filename, sconscript_files, | 1044 output_filename, sconscript_files, |
1044 default_configuration) | 1045 default_configuration) |
OLD | NEW |