| OLD | NEW |
| 1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 copy | 5 import copy |
| 6 import hashlib | 6 import hashlib |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os.path | 8 import os.path |
| 9 import re | 9 import re |
| 10 import signal | 10 import signal |
| 11 import subprocess | 11 import subprocess |
| 12 import sys | 12 import sys |
| 13 import gyp | 13 import gyp |
| 14 import gyp.common | 14 import gyp.common |
| 15 import gyp.msvs_emulation | 15 import gyp.msvs_emulation |
| 16 import gyp.MSVSUtil as MSVSUtil | 16 import gyp.MSVSUtil as MSVSUtil |
| 17 import gyp.xcode_emulation | 17 import gyp.xcode_emulation |
| 18 from cStringIO import StringIO |
| 18 | 19 |
| 19 from gyp.common import GetEnvironFallback | 20 from gyp.common import GetEnvironFallback |
| 20 import gyp.ninja_syntax as ninja_syntax | 21 import gyp.ninja_syntax as ninja_syntax |
| 21 | 22 |
| 22 generator_default_variables = { | 23 generator_default_variables = { |
| 23 'EXECUTABLE_PREFIX': '', | 24 'EXECUTABLE_PREFIX': '', |
| 24 'EXECUTABLE_SUFFIX': '', | 25 'EXECUTABLE_SUFFIX': '', |
| 25 'STATIC_LIB_PREFIX': 'lib', | 26 'STATIC_LIB_PREFIX': 'lib', |
| 26 'STATIC_LIB_SUFFIX': '.a', | 27 'STATIC_LIB_SUFFIX': '.a', |
| 27 'SHARED_LIB_PREFIX': 'lib', | 28 'SHARED_LIB_PREFIX': 'lib', |
| (...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) | 2013 gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) |
| 2013 | 2014 |
| 2014 build_file = gyp.common.RelativePath(build_file, options.toplevel_dir) | 2015 build_file = gyp.common.RelativePath(build_file, options.toplevel_dir) |
| 2015 | 2016 |
| 2016 base_path = os.path.dirname(build_file) | 2017 base_path = os.path.dirname(build_file) |
| 2017 obj = 'obj' | 2018 obj = 'obj' |
| 2018 if toolset != 'target': | 2019 if toolset != 'target': |
| 2019 obj += '.' + toolset | 2020 obj += '.' + toolset |
| 2020 output_file = os.path.join(obj, base_path, name + '.ninja') | 2021 output_file = os.path.join(obj, base_path, name + '.ninja') |
| 2021 | 2022 |
| 2023 ninja_output = StringIO() |
| 2022 writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir, | 2024 writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir, |
| 2023 OpenOutput(os.path.join(toplevel_build, output_file)), | 2025 ninja_output, |
| 2024 toplevel_build, output_file, | 2026 toplevel_build, output_file, |
| 2025 flavor, toplevel_dir=options.toplevel_dir) | 2027 flavor, toplevel_dir=options.toplevel_dir) |
| 2026 master_ninja.subninja(output_file) | 2028 target = writer.WriteSpec(spec, config_name, generator_flags) |
| 2027 | 2029 |
| 2028 target = writer.WriteSpec(spec, config_name, generator_flags) | 2030 if ninja_output.tell() > 0: |
| 2031 # Only create files for ninja files that actually have contents. |
| 2032 with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file: |
| 2033 ninja_file.write(ninja_output.getvalue()) |
| 2034 ninja_output.close() |
| 2035 master_ninja.subninja(output_file) |
| 2036 |
| 2029 if target: | 2037 if target: |
| 2030 if name != target.FinalOutput() and spec['toolset'] == 'target': | 2038 if name != target.FinalOutput() and spec['toolset'] == 'target': |
| 2031 target_short_names.setdefault(name, []).append(target) | 2039 target_short_names.setdefault(name, []).append(target) |
| 2032 target_outputs[qualified_target] = target | 2040 target_outputs[qualified_target] = target |
| 2033 if qualified_target in all_targets: | 2041 if qualified_target in all_targets: |
| 2034 all_outputs.add(target.FinalOutput()) | 2042 all_outputs.add(target.FinalOutput()) |
| 2035 | 2043 |
| 2036 if target_short_names: | 2044 if target_short_names: |
| 2037 # Write a short name to build this target. This benefits both the | 2045 # Write a short name to build this target. This benefits both the |
| 2038 # "build chrome" case as well as the gyp tests, which expect to be | 2046 # "build chrome" case as well as the gyp tests, which expect to be |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 arglists.append( | 2095 arglists.append( |
| 2088 (target_list, target_dicts, data, params, config_name)) | 2096 (target_list, target_dicts, data, params, config_name)) |
| 2089 pool.map(CallGenerateOutputForConfig, arglists) | 2097 pool.map(CallGenerateOutputForConfig, arglists) |
| 2090 except KeyboardInterrupt, e: | 2098 except KeyboardInterrupt, e: |
| 2091 pool.terminate() | 2099 pool.terminate() |
| 2092 raise e | 2100 raise e |
| 2093 else: | 2101 else: |
| 2094 for config_name in config_names: | 2102 for config_name in config_names: |
| 2095 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2103 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2096 config_name) | 2104 config_name) |
| OLD | NEW |