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 the first hook (See DEPS). If it detects that | 7 This script runs every build as the first hook (See DEPS). If it detects that |
8 the build should be clobbered, it will delete the contents of the build | 8 the build should be clobbered, it will delete the contents of the build |
9 directory. | 9 directory. |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 r'c:\b\build\slave\win\build\src\out' | 37 r'c:\b\build\slave\win\build\src\out' |
38 '/mnt/data/b/build/slave/linux/build/src/out' | 38 '/mnt/data/b/build/slave/linux/build/src/out' |
39 '/b/build/slave/ios_rel_device/build/src/xcodebuild' | 39 '/b/build/slave/ios_rel_device/build/src/xcodebuild' |
40 | 40 |
41 Keep this function in sync with tools/build/scripts/slave/compile.py | 41 Keep this function in sync with tools/build/scripts/slave/compile.py |
42 """ | 42 """ |
43 ret = None | 43 ret = None |
44 if build_tool == 'xcode': | 44 if build_tool == 'xcode': |
45 ret = os.path.join(SRC_DIR, 'xcodebuild') | 45 ret = os.path.join(SRC_DIR, 'xcodebuild') |
46 elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios. | 46 elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios. |
47 if ('CHROMIUM_OUT_DIR' not in os.environ and | 47 if 'CHROMIUM_OUT_DIR' in os.environ: |
48 'output_dir' in landmine_utils.gyp_generator_flags()): | 48 output_dir = os.environ.get('CHROMIUM_OUT_DIR').strip() |
49 output_dir = landmine_utils.gyp_generator_flags()['output_dir'] | 49 if not output_dir: |
| 50 raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!') |
50 else: | 51 else: |
51 output_dir = os.environ.get('CHROMIUM_OUT_DIR', 'out') | 52 output_dir = landmine_utils.gyp_generator_flags().get('output_dir', 'out') |
52 ret = os.path.join(SRC_DIR, output_dir) | 53 ret = os.path.join(SRC_DIR, output_dir) |
53 else: | 54 else: |
54 raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) | 55 raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) |
55 return os.path.abspath(ret) | 56 return os.path.abspath(ret) |
56 | 57 |
57 | 58 |
58 def extract_gn_build_commands(build_ninja_file): | 59 def extract_gn_build_commands(build_ninja_file): |
59 """Extracts from a build.ninja the commands to run GN. | 60 """Extracts from a build.ninja the commands to run GN. |
60 | 61 |
61 The commands to run GN are the gn rule and build.ninja build step at the | 62 The commands to run GN are the gn rule and build.ninja build step at the |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) | 207 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) |
207 output, _ = proc.communicate() | 208 output, _ = proc.communicate() |
208 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) | 209 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) |
209 clobber_if_necessary(landmines) | 210 clobber_if_necessary(landmines) |
210 | 211 |
211 return 0 | 212 return 0 |
212 | 213 |
213 | 214 |
214 if __name__ == '__main__': | 215 if __name__ == '__main__': |
215 sys.exit(main()) | 216 sys.exit(main()) |
OLD | NEW |