Bug 1686646 - Look for more tools in MOZ_FETCHES_DIR. r=firefox-build-system-reviewers,dmajor

This will allow to find them on automation without setting anything in
mozconfigs.

Differential Revision: https://phabricator.services.mozilla.com/D101720
This commit is contained in:
Mike Hommey 2021-01-15 04:33:01 +00:00
parent 758c53a631
commit 4ed35480e2
5 changed files with 34 additions and 21 deletions

View file

@ -5,11 +5,12 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
@depends(mozbuild_state_path, "--help") @depends(toolchains_base_dir, "--help")
@imports(_from="os.path", _import="isdir") @imports(_from="os.path", _import="isdir")
@imports(_from="mozboot.android", _import="NDK_VERSION") @imports(_from="mozboot.android", _import="NDK_VERSION")
def default_android_ndk_root(mozbuild_state_path, _): def default_android_ndk_root(toolchains_base_dir, _):
path = os.path.join(mozbuild_state_path, "android-ndk-%s" % NDK_VERSION) for ndk in ("android-ndk-%s" % NDK_VERSION, "android-ndk"):
path = os.path.join(toolchains_base_dir, ndk)
if isdir(path): if isdir(path):
return path return path

View file

@ -7,16 +7,16 @@
# Ensure Android SDK and build-tools versions depending on mobile target. # Ensure Android SDK and build-tools versions depending on mobile target.
@depends(host, mozbuild_state_path, "--help") @depends(host, toolchains_base_dir, "--help")
@imports(_from="os.path", _import="isdir") @imports(_from="os.path", _import="isdir")
def default_android_sdk_root(host, mozbuild_state_path, _): def default_android_sdk_root(host, toolchains_base_dir, _):
sdk_basename = { sdk_basename = {
"Darwin": "android-sdk-macosx", "Darwin": "android-sdk-macosx",
"Linux": "android-sdk-linux", "Linux": "android-sdk-linux",
"WINNT": "android-sdk-windows", "WINNT": "android-sdk-windows",
}.get(host.kernel) }.get(host.kernel, "android-sdk")
if sdk_basename: for sdk_basename in (sdk_basename, "android-sdk"):
path = os.path.join(mozbuild_state_path, sdk_basename) path = os.path.join(toolchains_base_dir, sdk_basename)
if isdir(path): if isdir(path):
return path return path

View file

@ -657,11 +657,11 @@ def vc_toolchain_search_path(vc_compiler_path, original_path):
clang_search_path = bootstrap_search_path("clang", "bin") clang_search_path = bootstrap_search_path("clang", "bin")
@depends(original_path) @depends(bootstrap_search_path("rustc", "bin", when="MOZ_AUTOMATION"), original_path)
@imports("os") @imports("os")
@imports(_from="os", _import="environ") @imports(_from="os", _import="environ")
def rust_search_path(original_path): def rust_search_path(rust_path, original_path):
result = list(original_path) result = list(rust_path or original_path)
# Also add the rustup install directory for cargo/rustc. # Also add the rustup install directory for cargo/rustc.
cargo_home = environ.get("CARGO_HOME", "") cargo_home = environ.get("CARGO_HOME", "")
if cargo_home: if cargo_home:

View file

@ -240,8 +240,12 @@ def original_path():
@template @template
def bootstrap_search_path(*path_parts): def bootstrap_search_path(*path_parts, **kwargs):
@depends(bootstrap_search_path_order, original_path, toolchains_base_dir) when = kwargs.pop("when", None)
if kwargs:
configure_error("bootstrap_search_path only takes `when` as keyword argument")
@depends(bootstrap_search_path_order, original_path, toolchains_base_dir, when=when)
def bootstrap_search_path(order, original_path, toolchains_base_dir): def bootstrap_search_path(order, original_path, toolchains_base_dir):
path = [os.path.join(toolchains_base_dir, *path_parts)] path = [os.path.join(toolchains_base_dir, *path_parts)]
if order == "prepend": if order == "prepend":
@ -251,13 +255,17 @@ def bootstrap_search_path(*path_parts):
return bootstrap_search_path return bootstrap_search_path
@depends(target, host)
def want_wine(target, host):
return target.kernel == "WINNT" and host.kernel != "WINNT"
wine = check_prog( wine = check_prog(
"WINE", "WINE",
["wine64", "wine"], ["wine64", "wine"],
allow_missing=True, allow_missing=True,
when=depends(target, host)( when=want_wine,
lambda t, h: t.kernel == "WINNT" and h.kernel != "WINNT" paths=bootstrap_search_path("wine", "bin", when=want_wine),
),
) )
check_prog("WGET", ("wget",), allow_missing=True) check_prog("WGET", ("wget",), allow_missing=True)

View file

@ -2076,12 +2076,12 @@ with only_when(requires_wasm_sandboxing & compile_environment):
help="Path to wasi sysroot for wasm sandboxing", help="Path to wasi sysroot for wasm sandboxing",
) )
@depends("--with-wasi-sysroot", mozbuild_state_path) @depends("--with-wasi-sysroot", toolchains_base_dir)
@imports("os") @imports("os")
def wasi_sysroot(wasi_sysroot, mozbuild_state_path): def wasi_sysroot(wasi_sysroot, toolchains_base_dir):
if not wasi_sysroot: if not wasi_sysroot:
sysroot = os.path.join( sysroot = os.path.join(
mozbuild_state_path, "wasi-sysroot", "share", "wasi-sysroot" toolchains_base_dir, "wasi-sysroot", "share", "wasi-sysroot"
) )
if os.path.isdir(sysroot): if os.path.isdir(sysroot):
return sysroot return sysroot
@ -2326,6 +2326,7 @@ check_prog(
"PDBSTR", "PDBSTR",
["pdbstr.exe"], ["pdbstr.exe"],
allow_missing=True, allow_missing=True,
paths=bootstrap_search_path("pdbstr", when=compile_environment & target_is_windows),
when=compile_environment & target_is_windows, when=compile_environment & target_is_windows,
) )
@ -2341,6 +2342,9 @@ def allow_missing_winchecksec(automation, c_compiler):
check_prog( check_prog(
"WINCHECKSEC", "WINCHECKSEC",
["winchecksec.exe", "winchecksec"], ["winchecksec.exe", "winchecksec"],
paths=bootstrap_search_path(
"winchecksec", when=compile_environment & target_is_windows
),
allow_missing=allow_missing_winchecksec, allow_missing=allow_missing_winchecksec,
when=compile_environment & target_is_windows, when=compile_environment & target_is_windows,
) )