| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 This script runs every build as a hook. If it detects that the build should | 7 This script runs every build as a hook. If it detects that the build should |
| 8 be clobbered, it will touch the file <build_dir>/.landmine_triggered. The | 8 be clobbered, it will touch the file <build_dir>/.landmine_triggered. The |
| 9 various build scripts will then check for the presence of this file and clobber | 9 various build scripts will then check for the presence of this file and clobber |
| 10 accordingly. The script will also emit the reasons for the clobber to stdout. | 10 accordingly. The script will also emit the reasons for the clobber to stdout. |
| 11 | 11 |
| 12 A landmine is tripped when a builder checks out a different revision, and the | 12 A landmine is tripped when a builder checks out a different revision, and the |
| 13 diff between the new landmines and the old ones is non-null. At this point, the | 13 diff between the new landmines and the old ones is non-null. At this point, the |
| 14 build is clobbered. | 14 build is clobbered. |
| 15 """ | 15 """ |
| 16 | 16 |
| 17 import difflib | 17 import difflib |
| 18 import gyp_helper | |
| 19 import logging | 18 import logging |
| 20 import optparse | 19 import optparse |
| 21 import os | 20 import os |
| 22 import sys | 21 import sys |
| 23 import subprocess | 22 import subprocess |
| 24 import time | 23 import time |
| 25 | 24 |
| 26 import landmine_utils | 25 import landmine_utils |
| 27 | 26 |
| 28 | 27 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 105 |
| 107 extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT') | 106 extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT') |
| 108 if extra_script: | 107 if extra_script: |
| 109 return options.landmine_scripts + [extra_script] | 108 return options.landmine_scripts + [extra_script] |
| 110 else: | 109 else: |
| 111 return options.landmine_scripts | 110 return options.landmine_scripts |
| 112 | 111 |
| 113 | 112 |
| 114 def main(): | 113 def main(): |
| 115 landmine_scripts = process_options() | 114 landmine_scripts = process_options() |
| 116 gyp_helper.apply_chromium_gyp_env() | 115 |
| 116 if landmine_utils.builder() == 'dump_dependency_json': |
| 117 return 0 |
| 117 | 118 |
| 118 for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'): | 119 for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'): |
| 119 landmines = [] | 120 landmines = [] |
| 120 for s in landmine_scripts: | 121 for s in landmine_scripts: |
| 121 proc = subprocess.Popen([sys.executable, s, '-t', target], | 122 proc = subprocess.Popen([sys.executable, s, '-t', target], |
| 122 stdout=subprocess.PIPE) | 123 stdout=subprocess.PIPE) |
| 123 output, _ = proc.communicate() | 124 output, _ = proc.communicate() |
| 124 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) | 125 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) |
| 125 set_up_landmines(target, landmines) | 126 set_up_landmines(target, landmines) |
| 126 | 127 |
| 127 return 0 | 128 return 0 |
| 128 | 129 |
| 129 | 130 |
| 130 if __name__ == '__main__': | 131 if __name__ == '__main__': |
| 131 sys.exit(main()) | 132 sys.exit(main()) |
| OLD | NEW |