Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/build/moz.configure/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  java.configure   Sprache: unbekannt

 
Spracherkennung für: .configure vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

# 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, want_bootstrap)
@imports(_from="mozboot.android", _import="ensure_gradle_jdk_installations")
@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")
@imports(_from="pathlib", _import="Path")
@imports(_from="__builtin__", _import="Exception")
def java_search_paths(path, host, toolchains_base_dir, want_bootstrap):
    if not 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[0]):
                log.info(
                    "Ignoring JAVA_HOME value. Use --with-java-bin-path "
                    "to override the default Java location."
                )
        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
                path = [str(ensure_java(os_name, os_arch))]
            except Exception as e:
                die(str(e))

    ensure_gradle_jdk_installations(Path(path[0]).parent)
    return path


# 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))
)

[Dauer der Verarbeitung: 0.23 Sekunden, vorverarbeitet 2026-08-25]