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

Side by Side Diff: build/vs_toolchain.py

Issue 1890053004: Stop gyp_chromium prior to mass DLL copies on error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/gyp_chromium.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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 import glob 6 import glob
7 import json 7 import json
8 import os 8 import os
9 import pipes 9 import pipes
10 import shutil 10 import shutil
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 else: 151 else:
152 raise ValueError('Unexpected GYP_MSVS_VERSION') 152 raise ValueError('Unexpected GYP_MSVS_VERSION')
153 153
154 154
155 def _CopyRuntimeImpl(target, source, verbose=True): 155 def _CopyRuntimeImpl(target, source, verbose=True):
156 """Copy |source| to |target| if it doesn't already exist or if it 156 """Copy |source| to |target| if it doesn't already exist or if it
157 needs to be updated. 157 needs to be updated.
158 """ 158 """
159 if (os.path.isdir(os.path.dirname(target)) and 159 if (os.path.isdir(os.path.dirname(target)) and
160 (not os.path.isfile(target) or 160 (not os.path.isfile(target) or
161 os.stat(target).st_mtime != os.stat(source).st_mtime)): 161 os.stat(target).st_mtime != os.stat(source).st_mtime)):
gab 2016/04/15 19:11:24 Seems to already be supposed to skip if files have
162 if verbose: 162 if verbose:
163 print 'Copying %s to %s...' % (source, target) 163 print 'Copying %s to %s...' % (source, target)
164 if os.path.exists(target): 164 if os.path.exists(target):
165 os.unlink(target) 165 os.unlink(target)
166 shutil.copy2(source, target) 166 shutil.copy2(source, target)
167 167
168 168
169 def _CopyRuntime2013(target_dir, source_dir, dll_pattern): 169 def _CopyRuntime2013(target_dir, source_dir, dll_pattern):
170 """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't 170 """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't
171 exist, but the target directory does exist.""" 171 exist, but the target directory does exist."""
172 for file_part in ('p', 'r'): 172 for file_part in ('p', 'r'):
173 dll = dll_pattern % file_part 173 dll = dll_pattern % file_part
174 target = os.path.join(target_dir, dll) 174 target = os.path.join(target_dir, dll)
175 source = os.path.join(source_dir, dll) 175 source = os.path.join(source_dir, dll)
176 _CopyRuntimeImpl(target, source) 176 _CopyRuntimeImpl(target, source)
177 177
178 178
179 def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix): 179 def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix):
180 """Copy both the msvcp and vccorlib runtime DLLs, only if the target doesn't 180 """Copy both the msvcp and vccorlib runtime DLLs, only if the target doesn't
181 exist, but the target directory does exist.""" 181 exist, but the target directory does exist."""
182 for file_part in ('msvcp', 'vccorlib', 'vcruntime'): 182 for file_part in ('msvcp', 'vccorlib', 'vcruntime'):
183 dll = dll_pattern % file_part 183 dll = dll_pattern % file_part
184 target = os.path.join(target_dir, dll) 184 target = os.path.join(target_dir, dll)
185 source = os.path.join(source_dir, dll) 185 source = os.path.join(source_dir, dll)
186 _CopyRuntimeImpl(target, source) 186 _CopyRuntimeImpl(target, source)
187 ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll') 187 ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll')
188 print 'Copying %s to %s...' % (ucrt_src_dir, target_dir) 188 print 'Copying %s to %s...' % (ucrt_src_dir, target_dir)
scottmg 2016/04/15 19:45:27 Looks like it was duplicated here. I would be happ
189 for ucrt_src_file in glob.glob(ucrt_src_dir): 189 for ucrt_src_file in glob.glob(ucrt_src_dir):
190 file_part = os.path.basename(ucrt_src_file) 190 file_part = os.path.basename(ucrt_src_file)
191 ucrt_dst_file = os.path.join(target_dir, file_part) 191 ucrt_dst_file = os.path.join(target_dir, file_part)
192 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) 192 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False)
193 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), 193 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix),
194 os.path.join(source_dir, 'ucrtbase' + suffix)) 194 os.path.join(source_dir, 'ucrtbase' + suffix))
195 195
196 196
197 def _CopyRuntime(target_dir, source_dir, target_cpu, debug): 197 def _CopyRuntime(target_dir, source_dir, target_cpu, debug):
198 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target 198 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 'copy_dlls': CopyDlls, 368 'copy_dlls': CopyDlls,
369 } 369 }
370 if len(sys.argv) < 2 or sys.argv[1] not in commands: 370 if len(sys.argv) < 2 or sys.argv[1] not in commands:
371 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 371 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
372 return 1 372 return 1
373 return commands[sys.argv[1]](*sys.argv[2:]) 373 return commands[sys.argv[1]](*sys.argv[2:])
374 374
375 375
376 if __name__ == '__main__': 376 if __name__ == '__main__':
377 sys.exit(main()) 377 sys.exit(main())
OLDNEW
« no previous file with comments | « build/gyp_chromium.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698