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
4 # found in the LICENSE file.
11 """VS2010 MSBuild has a ULDI bug that we patch here. See http://goo.gl/Pn8tj.
13 source_path = os.path.join(os.environ['ProgramFiles(x86)'],
17 "Microsoft.CppBuild.targets")
18 backup_path = source_path + ".backup"
19 if not os.path.exists(backup_path):
21 print "Backing up %s..." % source_path
22 shutil.copyfile(source_path, backup_path)
24 print "Could not back up %s to %s. Run as Administrator?" % (
25 source_path, backup_path)
28 source = open(source_path).read()
29 base = ('''<Target Name="GetResolvedLinkObjs" Returns="@(ObjFullPath)" '''
30 '''DependsOnTargets="$(CommonBuildOnlyTargets);ComputeCLOutputs;'''
31 '''ResolvedLinkObjs"''')
33 replace = base + ''' Condition="'$(ConfigurationType)'=='StaticLibrary'">'''
34 result = source.replace(find, replace)
37 open(source_path, "w").write(result)
38 print "Patched %s." % source_path
43 return patch_msbuild()
46 if __name__ == "__main__":