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

Side by Side Diff: build/win/merge_pgc_files.py

Issue 2901543002: [ABANDONED] Revert of Update merge_pgc_files.py in preparation for VS2017 (Closed)
Patch Set: Created 3 years, 7 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 | « build/vs_toolchain.py ('k') | 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 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 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 """Merge the PGC files generated during the profiling step to the PGD database. 6 """Merge the PGC files generated during the profiling step to the PGD database.
7 7
8 This is required to workaround a flakyness in pgomgr.exe where it can run out 8 This is required to workaround a flakyness in pgomgr.exe where it can run out
9 of address space while trying to merge all the PGC files at the same time. 9 of address space while trying to merge all the PGC files at the same time.
10 """ 10 """
11 11
12 import glob 12 import glob
13 import json 13 import json
14 import optparse 14 import optparse
15 import os 15 import os
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 18
19 19
20 script_dir = os.path.dirname(os.path.realpath(__file__))
21 sys.path.insert(0, os.path.join(script_dir, os.pardir))
22
23 import vs_toolchain
24
25
26 def find_pgomgr(chrome_checkout_dir): 20 def find_pgomgr(chrome_checkout_dir):
27 """Find pgomgr.exe.""" 21 """Find pgomgr.exe."""
28 win_toolchain_json_file = os.path.join(chrome_checkout_dir, 'build', 22 win_toolchain_json_file = os.path.join(chrome_checkout_dir, 'build',
29 'win_toolchain.json') 23 'win_toolchain.json')
30 if not os.path.exists(win_toolchain_json_file): 24 if not os.path.exists(win_toolchain_json_file):
31 raise Exception('The toolchain JSON file is missing.') 25 raise Exception('The toolchain JSON file is missing.')
32 with open(win_toolchain_json_file) as temp_f: 26 with open(win_toolchain_json_file) as temp_f:
33 toolchain_data = json.load(temp_f) 27 toolchain_data = json.load(temp_f)
34 if not os.path.isdir(toolchain_data['path']): 28 if not os.path.isdir(toolchain_data['path']):
35 raise Exception('The toolchain JSON file is invalid.') 29 raise Exception('The toolchain JSON file is invalid.')
36 30
37 # Always use the x64 version of pgomgr (the x86 one doesn't work on the bot's 31 # Always use the x64 version of pgomgr (the x86 one doesn't work on the bot's
38 # environment). 32 # environment).
39 if toolchain_data['version'] == '2015': 33 pgomgr_dir = os.path.join(toolchain_data['path'], 'VC', 'bin', 'amd64')
40 pgomgr_dir = os.path.join(toolchain_data['path'], 'VC', 'bin', 'amd64')
41 elif toolchain_data['version'] == '2017':
42 vc_tools_root = vs_toolchain.FindVCToolsRoot()
43 pgomgr_dir = os.path.join(vc_tools_root, 'HostX64', 'x64')
44 34
45 pgomgr_path = os.path.join(pgomgr_dir, 'pgomgr.exe') 35 pgomgr_path = os.path.join(pgomgr_dir, 'pgomgr.exe')
46 if not os.path.exists(pgomgr_path): 36 if not os.path.exists(pgomgr_path):
47 raise Exception('pgomgr.exe is missing from %s.' % pgomgr_dir) 37 raise Exception('pgomgr.exe is missing from %s.' % pgomgr_dir)
48 38
49 return pgomgr_path 39 return pgomgr_path
50 40
51 41
52 def main(): 42 def main():
53 parser = optparse.OptionParser(usage='%prog [options]') 43 parser = optparse.OptionParser(usage='%prog [options]')
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ]) 103 ])
114 proc = subprocess.Popen(merge_command, stdout=subprocess.PIPE) 104 proc = subprocess.Popen(merge_command, stdout=subprocess.PIPE)
115 stdout, stderr = proc.communicate() 105 stdout, stderr = proc.communicate()
116 print stdout 106 print stdout
117 if proc.returncode != 0: 107 if proc.returncode != 0:
118 raise Exception('Error while trying to merge the PGC files:\n%s' % stderr) 108 raise Exception('Error while trying to merge the PGC files:\n%s' % stderr)
119 109
120 110
121 if __name__ == '__main__': 111 if __name__ == '__main__':
122 sys.exit(main()) 112 sys.exit(main())
OLDNEW
« no previous file with comments | « build/vs_toolchain.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698