Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit af9de51

Browse files
author
Robert Bartlensky
committed
Bug 1479503: Check infer in ./mach static-analysis autotest. r=nalexander
Adds infer to ./mach static-analysis autotest. Differential Revision: https://phabricator.services.mozilla.com/D5692 --HG-- rename : taskcluster/docker/infer-build/Dockerfile => taskcluster/docker/static-analysis-build/Dockerfile extra : moz-landing-system : lando
1 parent 678de76 commit af9de51

34 files changed

Lines changed: 1322 additions & 153 deletions

File tree

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ exclude =
2222
testing/mochitest/pywebsocket,
2323
tools/lint/test/files,
2424
build/build-infer/build-infer.py,
25+
tools/infer/test/*.configure,

.hgignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ _OPT\.OBJ/
7474

7575
# Gradle cache.
7676
^.gradle/
77+
^tools/infer/test/.gradle/
7778

7879
# Local Gradle configuration properties.
7980
^local.properties$

build/moz.configure/java.configure

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7-
8-
# Java detection
9-
# ========================================================
10-
option('--with-java-bin-path', nargs=1,
11-
help='Location of Java binaries (java, javac, jar)')
12-
13-
14-
@depends('--with-java-bin-path')
15-
@imports(_from='os', _import='environ')
16-
def java_search_paths(path):
17-
if path:
18-
# Look for javac and jar in the specified path.
19-
return path
20-
# With no path specified, look for javac and jar in $JAVA_HOME (if set)
21-
# and $PATH.
22-
if 'JAVA_HOME' in environ:
23-
return [os.path.join(environ['JAVA_HOME'], 'bin'),
24-
environ.get('PATH', '')]
25-
return [environ.get('PATH')]
26-
27-
# Finds the given java tool, failing with a custom error message if we can't
28-
# find it.
29-
30-
31-
@template
32-
def check_java_tool(tool):
33-
check = check_prog(tool.upper(), (tool,), paths=java_search_paths,
34-
allow_missing=True)
35-
36-
@depends(check)
37-
def require_tool(result):
38-
if result is None:
39-
die("The program %s was not found. Set $JAVA_HOME to your Java "
40-
"SDK directory or use '--with-java-bin-path={java-bin-dir}'"
41-
% tool)
42-
return result
43-
44-
return require_tool
45-
46-
47-
check_java_tool('java')
48-
check_java_tool('javah')
49-
check_java_tool('jar')
50-
check_java_tool('jarsigner')
51-
check_java_tool('keytool')
52-
javac = check_java_tool('javac')
53-
7+
include('java_common.configure')
548

559
@depends(javac)
5610
@checking('for javac version')
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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/.
6+
7+
# Java detection
8+
# ========================================================
9+
option('--with-java-bin-path', nargs=1,
10+
help='Location of Java binaries (java, javac, jar)')
11+
12+
13+
@depends('--with-java-bin-path')
14+
@imports(_from='os', _import='environ')
15+
def java_search_paths(path):
16+
if path:
17+
# Look for javac and jar in the specified path.
18+
return path
19+
# With no path specified, look for javac and jar in $JAVA_HOME (if set)
20+
# and $PATH.
21+
if 'JAVA_HOME' in environ:
22+
return [os.path.join(environ['JAVA_HOME'], 'bin'),
23+
environ.get('PATH', '')]
24+
return [environ.get('PATH')]
25+
26+
# Finds the given java tool, failing with a custom error message if we can't
27+
# find it.
28+
29+
30+
@template
31+
def check_java_tool(tool):
32+
check = check_prog(tool.upper(), (tool,), paths=java_search_paths,
33+
allow_missing=True)
34+
35+
@depends(check)
36+
def require_tool(result):
37+
if result is None:
38+
die("The program %s was not found. Set $JAVA_HOME to your Java "
39+
"SDK directory or use '--with-java-bin-path={java-bin-dir}'"
40+
% tool)
41+
return result
42+
43+
return require_tool
44+
45+
46+
check_java_tool('java')
47+
check_java_tool('javah')
48+
check_java_tool('jar')
49+
check_java_tool('jarsigner')
50+
check_java_tool('keytool')
51+
javac = check_java_tool('javac')

moz.configure

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,21 @@ set_config('MAKENSISU_FLAGS', nsis_flags)
567567

568568
check_prog('7Z', ('7z', '7za'), allow_missing=True, when=target_is_windows)
569569

570+
@depends(target, host, check_build_environment, '--help')
571+
@imports('os')
572+
def include_infer_autotest(target, host, build_env, help):
573+
# Do not include autotest configuration on Windows or macos
574+
# because infer is not available there
575+
if target.kernel in ['Linux'] and host.kernel in ['Linux']:
576+
path = os.path.join(build_env.topsrcdir, 'tools', 'infer', 'test', 'moz.configure')
577+
# on some builds, this path won't exists, in which case we can just
578+
# ignore the infer autotest
579+
if os.path.exists(path):
580+
return path
581+
return None
582+
583+
include(include_infer_autotest)
584+
570585
# Fallthrough to autoconf-based configure
571586
include('build/moz.configure/old.configure')
572587

0 commit comments

Comments
 (0)