[erl-frontend] Skeleton integration for Rebar3

Summary:
The command `infer capture -- rebar3 compile` will trigger
Rebar3.capture, which does nothing (yet).

Reviewed By: jvillard

Differential Revision: D28096898

fbshipit-source-id: 6f06a9640
master
Radu Grigore 4 years ago committed by Facebook GitHub Bot
parent 7207e05682
commit 495c89284b

@ -10,6 +10,7 @@ ATDGEN = @ATDGEN@
bindir = @bindir@
BUCK = @BUCK@
BUILD_C_ANALYZERS = @BUILD_C_ANALYZERS@
BUILD_ERLANG_ANALYZERS = @BUILD_ERLANG_ANALYZERS@
BUILD_JAVA_ANALYZERS = @BUILD_JAVA_ANALYZERS@
BUILD_PLATFORM = @BUILD_PLATFORM@
CAML_LD_LIBRARY_PATH = @CAML_LD_LIBRARY_PATH@

@ -31,6 +31,7 @@ function usage() {
echo " targets:"
echo " all build everything (default)"
echo " clang build C and Objective-C analyzer"
echo " erlang build Erlang analyzer"
echo " java build Java analyzer"
echo
echo " options:"
@ -41,13 +42,14 @@ function usage() {
echo " -y,--yes automatically agree to everything"
echo
echo " examples:"
echo " $0 # build Java and C/Objective-C analyzers"
echo " $0 java clang # equivalent way of doing the above"
echo " $0 # build Java, Erlang and C/Objective-C analyzers"
echo " $0 java erlang clang # equivalent way of doing the above"
echo " $0 java # build only the Java analyzer"
}
# arguments
BUILD_CLANG=${BUILD_CLANG:-no}
BUILD_ERLANG=${BUILD_ERLANG:-no}
BUILD_JAVA=${BUILD_JAVA:-no}
INFER_CONFIGURE_OPTS=${INFER_CONFIGURE_OPTS:-""}
INTERACTIVE=${INTERACTIVE:-yes}
@ -58,12 +60,17 @@ USER_OPAM_SWITCH=no
ORIG_ARGS="$*"
function build_all() {
BUILD_CLANG=yes
BUILD_ERLANG=yes
BUILD_JAVA=yes
}
while [[ $# -gt 0 ]]; do
opt_key="$1"
case $opt_key in
all)
BUILD_CLANG=yes
BUILD_JAVA=yes
build_all
shift
continue
;;
@ -72,6 +79,11 @@ while [[ $# -gt 0 ]]; do
shift
continue
;;
erlang)
BUILD_ERLANG=yes
shift
continue
;;
java)
BUILD_JAVA=yes
shift
@ -108,10 +120,8 @@ while [[ $# -gt 0 ]]; do
shift
done
# if no arguments then build both clang and Java
if [ "$BUILD_CLANG" == "no" ] && [ "$BUILD_JAVA" == "no" ]; then
BUILD_CLANG=yes
BUILD_JAVA=yes
if [ "$BUILD_CLANG" == "no" ] && [ "$BUILD_ERLANG" == "no" ] && [ "$BUILD_JAVA" == "no" ]; then
build_all
fi
# enable --yes option for some commands in non-interactive mode
@ -161,6 +171,9 @@ echo "preparing build... " >&2
if [ "$BUILD_CLANG" == "no" ]; then
INFER_CONFIGURE_OPTS+=" --disable-c-analyzers"
fi
if [ "$BUILD_ERLANG" == "no" ]; then
INFER_CONFIGURE_OPTS+=" --disable-erlang-analyzers"
fi
if [ "$BUILD_JAVA" == "no" ]; then
INFER_CONFIGURE_OPTS+=" --disable-java-analyzers"
fi

@ -91,12 +91,19 @@ AC_ARG_ENABLE(c-analyzers,
BUILD_C_ANALYZERS=$enable_c_analyzers
AC_SUBST([BUILD_C_ANALYZERS])
AC_ARG_ENABLE(erlang-analyzers,
AS_HELP_STRING([--disable-erlang-analyzers],
[do not build the Erlang analyzers (default is to build them)]),
,
enable_erlang_analyzers=yes)
BUILD_ERLANG_ANALYZERS=$enable_erlang_analyzers
AC_SUBST([BUILD_ERLANG_ANALYZERS])
AC_ARG_ENABLE(java-analyzers,
AS_HELP_STRING([--disable-java-analyzers],
[do not build the Java analyzers (default is to build them)]),
,
enable_java_analyzers=yes)
BUILD_JAVA_ANALYZERS=$enable_java_analyzers
AC_SUBST([BUILD_JAVA_ANALYZERS])

@ -64,7 +64,7 @@ OPTIONS
Proceed as if the first argument after -- was command. Possible
values: ant, buck, gradle, gradlew, java, javac, cc, clang, gcc,
clang++, c++, g++, make, configure, cmake, waf, mvn, mvnw,
ndk-build, xcodebuild.
ndk-build, rebar3, xcodebuild.
--help
Show this manual

@ -638,7 +638,7 @@ OPTIONS
Proceed as if the first argument after -- was command. Possible
values: ant, buck, gradle, gradlew, java, javac, cc, clang, gcc,
clang++, c++, g++, make, configure, cmake, waf, mvn, mvnw,
ndk-build, xcodebuild. See also infer-capture(1) and infer-run(1).
ndk-build, rebar3, xcodebuild. See also infer-capture(1) and infer-run(1).
--no-fragment-retains-view
Deactivates: checker fragment-retains-view: Detects when Android

@ -74,7 +74,7 @@ OPTIONS
Proceed as if the first argument after -- was command. Possible
values: ant, buck, gradle, gradlew, java, javac, cc, clang, gcc,
clang++, c++, g++, make, configure, cmake, waf, mvn, mvnw,
ndk-build, xcodebuild.
ndk-build, rebar3, xcodebuild.
--help
Show this manual

@ -638,7 +638,7 @@ OPTIONS
Proceed as if the first argument after -- was command. Possible
values: ant, buck, gradle, gradlew, java, javac, cc, clang, gcc,
clang++, c++, g++, make, configure, cmake, waf, mvn, mvnw,
ndk-build, xcodebuild. See also infer-capture(1) and infer-run(1).
ndk-build, rebar3, xcodebuild. See also infer-capture(1) and infer-run(1).
--no-fragment-retains-view
Deactivates: checker fragment-retains-view: Detects when Android

@ -234,6 +234,7 @@ $(GENERATED_FROM_AUTOCONF): $(MAKEFILE_LIST)
-e "s|@INFER_GIT_BRANCH[@]|$$INFER_GIT_BRANCH|g" \
-e "s|@JAVA_MAJOR_VERSION[@]|$(JAVA_MAJOR_VERSION)|g" \
-e "s|@BUILD_C_ANALYZERS[@]|$(BUILD_C_ANALYZERS)|g" \
-e "s|@BUILD_ERLANG_ANALYZERS[@]|$(BUILD_ERLANG_ANALYZERS)|g" \
-e "s|@BUILD_JAVA_ANALYZERS[@]|$(BUILD_JAVA_ANALYZERS)|g" \
-e "s|@BUILD_PLATFORM[@]|$(BUILD_PLATFORM)|g" \
-e "s|@OPAMSWITCH[@]|$(OPAMSWITCH)|g" \

@ -42,6 +42,7 @@ type build_system =
| BMake
| BMvn
| BNdk
| BRebar3
| BXcode
[@@deriving compare]
@ -72,6 +73,7 @@ let build_system_exe_assoc =
; (BMvn, "mvn")
; (BMvn, "mvnw")
; (BNdk, "ndk-build")
; (BRebar3, "rebar3")
; (BXcode, "xcodebuild") ]

@ -23,6 +23,7 @@ type build_system =
| BMake
| BMvn
| BNdk
| BRebar3
| BXcode
type scheduler = File | Restart | SyntacticCallGraph [@@deriving equal]

@ -49,6 +49,8 @@ let java_enabled = is_yes "@BUILD_JAVA_ANALYZERS@"
let java_version = int_of_string_opt "@JAVA_MAJOR_VERSION@"
let erlang_enabled = is_yes "@BUILD_ERLANG_ANALYZERS@"
let xcode_enabled = is_not_no "@XCODE_SELECT@"
let man_pages_last_modify_date = "@INFER_MAN_LAST_MODIFIED@"

@ -29,6 +29,8 @@ val java_enabled : bool
val java_version : int option
val erlang_enabled : bool
val xcode_enabled : bool
val man_pages_last_modify_date : string

@ -15,6 +15,8 @@ let clang = is_yes "@BUILD_C_ANALYZERS@"
let java = is_yes "@BUILD_JAVA_ANALYZERS@"
let erlang = is_yes "@BUILD_ERLANG_ANALYZERS@"
let facebook = is_yes "@IS_FACEBOOK_TREE@"
let extra_cflags = if is_empty "@EXTRA_CFLAGS@" then [] else ["@EXTRA_CFLAGS@"]

@ -27,6 +27,7 @@ type mode =
| Javac of {compiler: Javac.compiler; prog: string; args: string list}
| Maven of {prog: string; args: string list}
| NdkBuild of {build_cmd: string list}
| Rebar3 of {args: string list}
| XcodeBuild of {prog: string; args: string list}
| XcodeXcpretty of {prog: string; args: string list}
@ -60,6 +61,8 @@ let pp_mode fmt = function
F.fprintf fmt "Maven driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args args
| NdkBuild {build_cmd} ->
F.fprintf fmt "NdkBuild driver mode: build_cmd = %a" Pp.cli_args build_cmd
| Rebar3 {args} ->
F.fprintf fmt "Rebar3 driver mode:@\nargs = %a" Pp.cli_args args
| XcodeBuild {prog; args} ->
F.fprintf fmt "XcodeBuild driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args args
| XcodeXcpretty {prog; args} ->
@ -139,6 +142,9 @@ let capture ~changed_files = function
| NdkBuild {build_cmd} ->
L.progress "Capturing in ndk-build mode...@." ;
NdkBuild.capture ~build_cmd
| Rebar3 {args} ->
L.progress "Capturing in rebar3 mode...@." ;
Rebar3.capture ~args
| XcodeBuild {prog; args} ->
L.progress "Capturing in xcodebuild mode...@." ;
XcodeBuild.capture ~prog ~args
@ -302,6 +308,8 @@ let assert_supported_mode required_analyzer requested_mode_string =
Version.clang_enabled && Version.java_enabled
| `Java ->
Version.java_enabled
| `Erlang ->
Version.erlang_enabled
| `Xcode ->
Version.clang_enabled && Version.xcode_enabled
in
@ -314,6 +322,8 @@ let assert_supported_mode required_analyzer requested_mode_string =
"clang & java"
| `Java ->
"java"
| `Erlang ->
"erlang"
| `Xcode ->
"clang and xcode"
in
@ -336,6 +346,8 @@ let assert_supported_build_system build_system =
Config.string_of_build_system build_system |> assert_supported_mode `Java
| BClang | BMake | BNdk ->
Config.string_of_build_system build_system |> assert_supported_mode `Clang
| BRebar3 ->
Config.string_of_build_system build_system |> assert_supported_mode `Erlang
| BXcode ->
Config.string_of_build_system build_system |> assert_supported_mode `Xcode
| BBuck ->
@ -399,6 +411,8 @@ let mode_of_build_command build_cmd (buck_mode : BuckMode.t option) =
Maven {prog; args}
| BNdk, _ ->
NdkBuild {build_cmd}
| BRebar3, _ ->
Rebar3 {args}
| BXcode, _ when Config.xcpretty ->
XcodeXcpretty {prog; args}
| BXcode, _ ->

@ -25,6 +25,7 @@ type mode =
| Javac of {compiler: Javac.compiler; prog: string; args: string list}
| Maven of {prog: string; args: string list}
| NdkBuild of {build_cmd: string list}
| Rebar3 of {args: string list}
| XcodeBuild of {prog: string; args: string list}
| XcodeXcpretty of {prog: string; args: string list}

@ -0,0 +1,11 @@
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
(* TODO *)
let capture ~args:_ = ()

@ -0,0 +1,10 @@
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
val capture : args:string list -> unit
Loading…
Cancel
Save