| # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """VS2010 MSBuild has a ULDI bug that we patch here. See http://goo.gl/Pn8tj. |
| source_path = os.path.join(os.environ['ProgramFiles(x86)'], |
| "Microsoft.CppBuild.targets") |
| backup_path = source_path + ".backup" |
| if not os.path.exists(backup_path): |
| print "Backing up %s..." % source_path |
| shutil.copyfile(source_path, backup_path) |
| print "Could not back up %s to %s. Run as Administrator?" % ( |
| source_path, backup_path) |
| source = open(source_path).read() |
| base = ('''<Target Name="GetResolvedLinkObjs" Returns="@(ObjFullPath)" ''' |
| '''DependsOnTargets="$(CommonBuildOnlyTargets);ComputeCLOutputs;''' |
| replace = base + ''' Condition="'$(ConfigurationType)'=='StaticLibrary'">''' |
| result = source.replace(find, replace) |
| open(source_path, "w").write(result) |
| print "Patched %s." % source_path |
| if __name__ == "__main__": |