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