Bug 1869043 add a main thread record of track audio outputs r=padenot
[gecko.git] / build / moz.configure / java.configure
blob0bb0a22c712f7f1805d8122bdbc10ed116ba674e
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # Java detection
9 # ========================================================
10 option(
11     "--with-java-bin-path",
12     nargs=1,
13     help="Location of Java binaries",
17 @depends("--with-java-bin-path", host, toolchains_base_dir)
18 @imports(_from="mozboot.android", _import="JavaLocationFailedException")
19 @imports(_from="mozboot.android", _import="locate_java_bin_path")
20 @imports(_from="os", _import="environ")
21 @imports(_from="os.path", _import="dirname")
22 def java_search_paths(path, host, toolchains_base_dir):
23     if path:
24         # Look for javac and jar in the specified path.
25         return path
27     try:
28         path = locate_java_bin_path(host.kernel, toolchains_base_dir)
30         java_home = environ.get("JAVA_HOME")
31         if java_home and java_home != dirname(path):
32             log.info(
33                 "Ignoring JAVA_HOME value. Use --with-java-bin-path "
34                 "to override the default Java location."
35             )
36         return [path]
37     except JavaLocationFailedException as e:
38         die(str(e))
41 # Finds the given java tool, failing with a custom error message if we can't
42 # find it.
45 @template
46 def check_java_tool(tool):
47     check = check_prog(
48         tool.upper(), (tool,), paths=java_search_paths, allow_missing=True
49     )
51     @depends(check)
52     def require_tool(result):
53         if result is None:
54             die(
55                 "The program %s was not found. Use '--with-java-bin-path={java-bin-dir}'"
56                 % tool
57             )
58         return result
60     return require_tool
63 check_java_tool("java")
66 # Java Code Coverage
67 # ========================================================
68 option(
69     "--enable-java-coverage",
70     env="MOZ_JAVA_CODE_COVERAGE",
71     help="Enable Java code coverage",
74 set_config(
75     "MOZ_JAVA_CODE_COVERAGE", depends("--enable-java-coverage")(lambda v: bool(v))