-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix toolchain path when invoking build_script_helper.py #41739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,11 +100,17 @@ def get_dependencies(cls): | |
|
||
|
||
def _get_toolchain_path(host_target, product, args): | ||
# TODO check if we should prefer using product.install_toolchain_path | ||
# this logic initially was inside run_build_script_helper | ||
# and was factored out so it can be used in testing as well | ||
|
||
toolchain_path = product.host_install_destdir(host_target) | ||
install_destdir = args.install_destdir | ||
if swiftpm.SwiftPM.has_cross_compile_hosts(args): | ||
install_destdir = swiftpm.SwiftPM.get_install_destdir(args, | ||
host_target, | ||
product.build_dir) | ||
toolchain_path = targets.toolchain_path(install_destdir, | ||
args.install_prefix) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note the prefix added for Darwin in the next couple lines, that's going to break this usual formulation there, which is why I didn't mess with it last year. |
||
|
||
if platform.system() == 'Darwin': | ||
# The prefix is an absolute path, so concatenate without os.path. | ||
toolchain_path += \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,13 +77,29 @@ def get_dependencies(cls): | |
swiftpm.SwiftPM] | ||
|
||
|
||
def run_build_script_helper(host_target, product, args): | ||
toolchain_path = args.install_destdir | ||
def _get_toolchain_path(host_target, product, args): | ||
# this logic initially was inside run_build_script_helper | ||
# and was factored out so it can be used in testing as well | ||
|
||
install_destdir = args.install_destdir | ||
if swiftpm.SwiftPM.has_cross_compile_hosts(args): | ||
install_destdir = swiftpm.SwiftPM.get_install_destdir(args, | ||
host_target, | ||
product.build_dir) | ||
toolchain_path = targets.toolchain_path(install_destdir, | ||
args.install_prefix) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try using this better two-line formulation I came up with for other build products, though as above, you will have to do something about that Darwin prefix added below too. |
||
|
||
if platform.system() == 'Darwin': | ||
# The prefix is an absolute path, so concatenate without os.path. | ||
toolchain_path += \ | ||
targets.darwin_toolchain_prefix(args.install_prefix) | ||
|
||
return toolchain_path | ||
|
||
|
||
def run_build_script_helper(host_target, product, args): | ||
toolchain_path = _get_toolchain_path(host_target, product, args) | ||
|
||
# Our source_dir is expected to be './$SOURCE_ROOT/benchmarks'. That is due | ||
# the assumption that each product is in its own build directory. This | ||
# product is not like that and has its package/tools instead in | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I removed several of these in #30565 and related pulls a couple years ago, but I don't build these products, so it looks like these slipped through.