diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /build/moz.configure/java.configure | |
parent | Initial commit. (diff) | |
download | firefox-upstream/124.0.1.tar.xz firefox-upstream/124.0.1.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/moz.configure/java.configure')
-rw-r--r-- | build/moz.configure/java.configure | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/build/moz.configure/java.configure b/build/moz.configure/java.configure new file mode 100644 index 0000000000..0bb0a22c71 --- /dev/null +++ b/build/moz.configure/java.configure @@ -0,0 +1,76 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +# Java detection +# ======================================================== +option( + "--with-java-bin-path", + nargs=1, + help="Location of Java binaries", +) + + +@depends("--with-java-bin-path", host, toolchains_base_dir) +@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): + if path: + # Look for javac and jar in the specified path. + return path + + try: + path = locate_java_bin_path(host.kernel, toolchains_base_dir) + + java_home = environ.get("JAVA_HOME") + if java_home and java_home != dirname(path): + log.info( + "Ignoring JAVA_HOME value. Use --with-java-bin-path " + "to override the default Java location." + ) + return [path] + except JavaLocationFailedException as e: + die(str(e)) + + +# Finds the given java tool, failing with a custom error message if we can't +# find it. + + +@template +def check_java_tool(tool): + check = check_prog( + tool.upper(), (tool,), paths=java_search_paths, allow_missing=True + ) + + @depends(check) + def require_tool(result): + if result is None: + die( + "The program %s was not found. Use '--with-java-bin-path={java-bin-dir}'" + % tool + ) + return result + + return require_tool + + +check_java_tool("java") + + +# Java Code Coverage +# ======================================================== +option( + "--enable-java-coverage", + env="MOZ_JAVA_CODE_COVERAGE", + help="Enable Java code coverage", +) + +set_config( + "MOZ_JAVA_CODE_COVERAGE", depends("--enable-java-coverage")(lambda v: bool(v)) +) |