# -*- 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") @imports(_from="mozboot.util", _import="locate_java_bin_path") @imports(_from="mozboot.util", _import="JavaLocationFailedException") def java_search_paths(path): if path: # Look for javac and jar in the specified path. return path try: return [locate_java_bin_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. Set $JAVA_HOME to your Java " "SDK directory or 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)) )