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

Unified Diff: build/vs_toolchain.py

Issue 2884613003: Update merge_pgc_files.py in preparation for VS2017 (Closed)
Patch Set: Copy pgomgr's dependencies. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/win/merge_pgc_files.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/vs_toolchain.py
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
index 0ff51815212da7198fc521eedaf1f45ffefe5cd6..9385ba8d7f9829b08112fa2ce86dffede8f148e0 100755
--- a/build/vs_toolchain.py
+++ b/build/vs_toolchain.py
@@ -218,6 +218,27 @@ def _CopyUCRTRuntime(target_dir, source_dir, target_cpu, dll_pattern, suffix):
os.path.join(source_dir, 'ucrtbase' + suffix))
+def _FindVCToolsRoot():
scottmg 2017/05/19 20:25:10 Since you're calling this ouside of this script, i
Sébastien Marchand 2017/05/19 22:30:37 Done.
+ """In VS2017 the PGO runtime dependencies are located in
+ {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/, the
+ {version_number} part is likely to change in case of a minor update of the
+ toolchain so we don't hardcode this value here (except for the major number).
+
+ This returns the '{toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/' path.
+
+ This function should only be called when using VS2017.
+ """
+ assert GetVisualStudioVersion() == '2017'
+ vc_tools_msvc_root = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
scottmg 2017/05/19 20:25:10 (I know you just moved this, but since it's in a s
Sébastien Marchand 2017/05/19 22:30:37 Sure, asserting seems like a good-enough solution.
+ 'VC', 'Tools', 'MSVC')
+ for directory in os.listdir(vc_tools_msvc_root):
+ if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
+ continue
+ if re.match('14\.\d+\.\d+', directory):
+ return os.path.join(vc_tools_msvc_root, directory, 'bin')
+ return
+
+
def _CopyPGORuntime(target_dir, target_cpu):
"""Copy the runtime dependencies required during a PGO build.
"""
@@ -229,20 +250,7 @@ def _CopyPGORuntime(target_dir, target_cpu):
'VC', 'bin')
pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64')
elif env_version == '2017':
- # In VS2017 the PGO runtime dependencies are located in
- # {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/,
- # the {version_number} part is likely to change in case of a minor update of
- # the toolchain so we don't hardcode this value here (except for the major
- # number).
- vc_tools_msvc_root = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
- 'VC', 'Tools', 'MSVC')
- pgo_runtime_root = None
- for directory in os.listdir(vc_tools_msvc_root):
- if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
- continue
- if re.match('14\.\d+\.\d+', directory):
- pgo_runtime_root = os.path.join(vc_tools_msvc_root, directory, 'bin')
- break
+ pgo_runtime_root = _FindVCToolsRoot()
assert pgo_runtime_root
# There's no version of pgosweep.exe in HostX64/x86, so we use the copy
# from HostX86/x86.
« no previous file with comments | « no previous file | build/win/merge_pgc_files.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698