Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: build/landmines.py

Issue 832933004: Prevent landmines.py from deleting your source directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make blank CHROMIUM_OUT_DIR fatal Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698