Commit 1f667687 authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Handle toolchains with/without ..\.. in variables

The packaging script previously would generate environment variables
with lots of ..\.. entries in environment variables, which is difficult
to read and increases the odds of hitting MAX_PATH limits.
crrev.com/c/2372727 changes the packaging and this change to
setup_toolchain.py adjusts the setup code to handle both the old and new
systems.

Bug: 1120785
Change-Id: I7c3449a54cf6fba9f70f52db83d940ffd4c32573
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2370604
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801277}
parent 2fa6967e
...@@ -102,9 +102,15 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store): ...@@ -102,9 +102,15 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store):
# Load environment from json file. # Load environment from json file.
env = os.path.normpath(os.path.join(sdk_dir, 'bin/SetEnv.%s.json' % cpu)) env = os.path.normpath(os.path.join(sdk_dir, 'bin/SetEnv.%s.json' % cpu))
env = json.load(open(env))['env'] env = json.load(open(env))['env']
if env['VSINSTALLDIR'] == [["..", "..\\"]]:
# Old-style paths were relative to the win_sdk\bin directory.
json_relative_dir = os.path.join(sdk_dir, 'bin')
else:
# New-style paths are relative to the toolchain directory, which is the
# parent of the SDK directory.
json_relative_dir = os.path.split(sdk_dir)[0]
for k in env: for k in env:
entries = [os.path.join(*([os.path.join(sdk_dir, 'bin')] + e)) entries = [os.path.join(*([json_relative_dir] + e)) for e in env[k]]
for e in env[k]]
# clang-cl wants INCLUDE to be ;-separated even on non-Windows, # clang-cl wants INCLUDE to be ;-separated even on non-Windows,
# lld-link wants LIB to be ;-separated even on non-Windows. Path gets :. # lld-link wants LIB to be ;-separated even on non-Windows. Path gets :.
# The separator for INCLUDE here must match the one used in main() below. # The separator for INCLUDE here must match the one used in main() below.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment