| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """gypd output module | 3 """gypd output module |
| 4 | 4 |
| 5 This module produces gyp input as its output. Output files are given the | 5 This module produces gyp input as its output. Output files are given the |
| 6 .gypd extension to avoid overwriting the .gyp files that they are generated | 6 .gypd extension to avoid overwriting the .gyp files that they are generated |
| 7 from. Internal references to .gyp files (such as those found in | 7 from. Internal references to .gyp files (such as those found in |
| 8 "dependencies" sections) are not adjusted to point to .gypd files instead; | 8 "dependencies" sections) are not adjusted to point to .gypd files instead; |
| 9 unlike other paths, which are relative to the .gyp or .gypd file, such paths | 9 unlike other paths, which are relative to the .gyp or .gypd file, such paths |
| 10 are relative to the directory from which gyp was run to create the .gypd file. | 10 are relative to the directory from which gyp was run to create the .gypd file. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 'RULE_INPUT_NAME', | 46 'RULE_INPUT_NAME', |
| 47 'RULE_INPUT_PATH', | 47 'RULE_INPUT_PATH', |
| 48 'SHARED_INTERMEDIATE_DIR', | 48 'SHARED_INTERMEDIATE_DIR', |
| 49 ] | 49 ] |
| 50 | 50 |
| 51 # gypd doesn't define a default value for OS like many other generator | 51 # gypd doesn't define a default value for OS like many other generator |
| 52 # modules. Specify "-D OS=whatever" on the command line to provide a value. | 52 # modules. Specify "-D OS=whatever" on the command line to provide a value. |
| 53 generator_default_variables = { | 53 generator_default_variables = { |
| 54 } | 54 } |
| 55 | 55 |
| 56 # gypd supports multiple toolsets |
| 57 generator_supports_multiple_toolsets = True |
| 58 |
| 56 # TODO(mark): This always uses <, which isn't right. The input module should | 59 # TODO(mark): This always uses <, which isn't right. The input module should |
| 57 # notify the generator to tell it which phase it is operating in, and this | 60 # notify the generator to tell it which phase it is operating in, and this |
| 58 # module should use < for the early phase and then switch to > for the late | 61 # module should use < for the early phase and then switch to > for the late |
| 59 # phase. Bonus points for carrying @ back into the output too. | 62 # phase. Bonus points for carrying @ back into the output too. |
| 60 for v in _generator_identity_variables: | 63 for v in _generator_identity_variables: |
| 61 generator_default_variables[v] = '<(%s)' % v | 64 generator_default_variables[v] = '<(%s)' % v |
| 62 | 65 |
| 63 | 66 |
| 64 def GenerateOutput(target_list, target_dicts, data, params): | 67 def GenerateOutput(target_list, target_dicts, data, params): |
| 65 output_files = {} | 68 output_files = {} |
| 66 for qualified_target in target_list: | 69 for qualified_target in target_list: |
| 67 [input_file, target] = \ | 70 [input_file, target] = \ |
| 68 gyp.common.BuildFileAndTarget('', qualified_target)[0:2] | 71 gyp.common.ParseQualifiedTarget(qualified_target)[0:2] |
| 69 | 72 |
| 70 if input_file[-4:] != '.gyp': | 73 if input_file[-4:] != '.gyp': |
| 71 continue | 74 continue |
| 72 input_file_stem = input_file[:-4] | 75 input_file_stem = input_file[:-4] |
| 73 output_file = input_file_stem + params['options'].suffix + '.gypd' | 76 output_file = input_file_stem + params['options'].suffix + '.gypd' |
| 74 | 77 |
| 75 if not output_file in output_files: | 78 if not output_file in output_files: |
| 76 output_files[output_file] = input_file | 79 output_files[output_file] = input_file |
| 77 | 80 |
| 78 for output_file, input_file in output_files.iteritems(): | 81 for output_file, input_file in output_files.iteritems(): |
| 79 output = open(output_file, 'w') | 82 output = open(output_file, 'w') |
| 80 pprint.pprint(data[input_file], output) | 83 pprint.pprint(data[input_file], output) |
| 81 output.close() | 84 output.close() |
| OLD | NEW |