Bug 1947388 - Download jdk under --enable-bootstrap if it's missing r=nalexander,glandium,gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D237711
This commit is contained in:
@@ -14,12 +14,14 @@ option(
|
||||
)
|
||||
|
||||
|
||||
@depends("--with-java-bin-path", host, toolchains_base_dir)
|
||||
@depends("--with-java-bin-path", host, toolchains_base_dir, want_bootstrap)
|
||||
@imports(_from="mozboot.android", _import="ensure_java")
|
||||
@imports(_from="mozboot.android", _import="JavaLocationFailedException")
|
||||
@imports(_from="mozboot.android", _import="locate_java_bin_path")
|
||||
@imports(_from="os", _import="environ")
|
||||
@imports(_from="os.path", _import="dirname")
|
||||
def java_search_paths(path, host, toolchains_base_dir):
|
||||
@imports(_from="__builtin__", _import="Exception")
|
||||
def java_search_paths(path, host, toolchains_base_dir, want_bootstrap):
|
||||
if path:
|
||||
# Look for javac and jar in the specified path.
|
||||
return path
|
||||
@@ -35,6 +37,24 @@ def java_search_paths(path, host, toolchains_base_dir):
|
||||
)
|
||||
return [path]
|
||||
except JavaLocationFailedException as e:
|
||||
if not want_bootstrap("jdk"):
|
||||
die(str(e))
|
||||
|
||||
os_name = {"Linux": "linux", "Darwin": "macosx", "WINNT": "windows"}.get(
|
||||
host.kernel
|
||||
)
|
||||
if os_name is None:
|
||||
die(
|
||||
"We don't support bootstrapping the Java SDK on {0} yet!".format(
|
||||
host.kernel
|
||||
)
|
||||
)
|
||||
os_arch = host.cpu
|
||||
|
||||
try:
|
||||
# FIXME: should use the bootstrap.configure mechanism instead
|
||||
return [str(ensure_java(os_name, os_arch))]
|
||||
except Exception as e:
|
||||
die(str(e))
|
||||
|
||||
|
||||
|
||||
@@ -554,6 +554,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
def host(_):
|
||||
return namespace(os='unknown', kernel='unknown')
|
||||
toolchains_base_dir = depends(when=True)(lambda: '/mozbuild')
|
||||
want_bootstrap = dependable(lambda: lambda _: False)
|
||||
include('%(topsrcdir)s/build/moz.configure/java.configure')
|
||||
"""
|
||||
% {"topsrcdir": topsrcdir}
|
||||
|
||||
Reference in New Issue
Block a user