[build] Replace custom make cmds w/ dune promotion and byte_complete

Summary:
Main changes are:

1. Dune can promote targets into the source tree as a part of build. This
allows us to **remove custom promotion/installation logic in src/Makefile**.

2. Dune promotion only works for path within workspace. This required
**moving dune-workspace one folder up**: from infer/infer/src to infer/infer.
But this is not bad, since it makes it possible to migrate tests under dune at some point.

3. `checkCopyright` now also promoted into `infer/infer/bin` instead of
`infer/scripts` partly for consistency and partly because of the
dune-workspace location.

4. `byte` mode was replaced with `byte_complete`. The latter takes
similar amount of time to build compared to `byte`, but produces
standalone binaries that don't require InferCStubs to be
installed. This allowed to remove `dune_exec_shim` and custom logic
around `dune build InferCStubs.install` when dealing with byte
targets.

All in all, `infer/src/Makefile` is not about 2/3 its previous size
with less custom logic in Makefiles/scripts and more encoded in dune
build files.

Reviewed By: jvillard

Differential Revision: D20303902

fbshipit-source-id: 9e4c65bd0
master
Artem Pianykh 5 years ago committed by Facebook GitHub Bot
parent 9fc048b503
commit 786a72574f

19
.gitignore vendored

@ -112,20 +112,6 @@ buck-out/
.buckd/
#other
/infer/bin/infer
/infer/bin/infer.bc
/infer/bin/infer.exe
/infer/bin/infer-analyze
/infer/bin/infer-capture
/infer/bin/infer-compile
/infer/bin/infer-explore
/infer/bin/infer-report
/infer/bin/infer-reportdiff
/infer/bin/infer-run
/infer/bin/InferCreateTraceViewLinks
/infer/bin/InferUnit
/infer/bin/infertop.bc
/infer/bin/llvm_sil
/infer/man/man1/*.1
/infer/man/man1/*.1.gz
@ -142,7 +128,6 @@ buck-out/
/infer/lib/specs/cpp_models
/infer/lib/specs/objc_models
/infer/lib/specs/clean_models
/scripts/checkCopyright
/infer/etc/clang_ast.dict
/infer/src/toplevel.mlpack
@ -174,10 +159,10 @@ infer/src/.project
/infer/annotations/target
# dune
/infer/src/_build
/infer/_build
/infer/dune-workspace
/infer/src/dune.common
/infer/src/dune
/infer/src/dune-workspace
.merlin
# generated when looking for dead code

@ -55,7 +55,7 @@ make devsetup
if you're unsure of a module name.
```console
$ ledit ocamldebug infer/bin/infer.bc
$ ledit ocamldebug infer/bin/infer.bc.exe
(ocd) break @ InferModules__InferAnalyze 100
Breakpoint 1 at 9409684: file backend/InferAnalyze.ml, line 99, characters 18-78
```

@ -439,8 +439,7 @@ clang_plugin_test_replace: clang_setup
ocaml_unit_test: test_build
$(QUIET)$(REMOVE_DIR) infer-out-unit-tests
$(QUIET)$(call silent_on_success,Running OCaml unit tests,\
INFER_ARGS=--results-dir^infer-out-unit-tests \
$(SCRIPT_DIR)/dune_exec_shim.sh $(BUILD_DIR)/default/inferunit.bc)
INFER_ARGS=--results-dir^infer-out-unit-tests $(INFERUNIT_BIN))
define silence_make
$(1) 2> >(grep -v 'warning: \(ignoring old\|overriding\) \(commands\|recipe\) for target')
@ -593,9 +592,6 @@ ifeq (,$(findstring s,$(MAKEFLAGS)))
$(QUIET)echo "$(TERM_INFO)ALL TESTS PASSED$(TERM_RESET)"
endif
.PHONY: quick-test
quick-test: test_build ocaml_unit_test
.PHONY: test-replace
test-replace: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) $(DIRECT_TESTS:%=direct_%_replace) \
clang_plugin_test_replace

@ -43,7 +43,7 @@ JAVA_BUILTINS_DIR = $(MODELS_DIR)/java/builtins
JAVA_MODELS_DIR = $(MODELS_DIR)/java/src
SRC_DIR = $(INFER_DIR)/src
BUILD_DIR = $(SRC_DIR)/_build
BUILD_DIR = $(INFER_DIR)/_build
JAVA_LIB_DIR = $(LIB_DIR)/java
SPECS_LIB_DIR = $(LIB_DIR)/specs
@ -62,8 +62,9 @@ INFER_COMMANDS = \
infer-reportdiff \
infer-run \
INFERTOP_BIN = $(BIN_DIR)/infertop.bc
INFERUNIT_BIN = $(BIN_DIR)/InferUnit
INFERTOP_BIN = $(BIN_DIR)/infertop.bc.exe
INFERUNIT_BIN = $(BIN_DIR)/inferunit.bc.exe
CHECKCOPYRIGHT_BIN = $(BIN_DIR)/checkCopyright
INFER_CREATE_TRACEVIEW_LINKS = InferCreateTraceViewLinks
INFER_CREATE_TRACEVIEW_LINKS_BIN = $(BIN_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS)

@ -0,0 +1,6 @@
# .gitignore to keep the directory for dune to promote binaries into
###################################
# Filter everything except the .gitignore
*
!.gitignore

@ -1,11 +0,0 @@
#!/bin/bash
# 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.
## Wrapper around the bytecode version of infer produced by `make byte`
# This is needed to find the dynamic libraries of our C stubs
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec "$SCRIPT_DIR"/../../scripts/dune_exec_shim.sh "${0%.byte}.bc" "$@"

@ -8,21 +8,19 @@ include $(ROOT_DIR)/Makefile.config
#### Global declarations ####
# override this for faster builds (but slower infer)
# Override this for faster builds (but slower infer)
BUILD_MODE ?= opt
BUILD_ROOT = _build
# paths to BUILD_DIR are relative because that's how dune likes it
INFER_BUILD_DIR = $(BUILD_ROOT)/default
DUNE_BUILD = dune build --profile=$(BUILD_MODE) --build-dir=$(BUILD_ROOT)
DUNE_BUILD = dune build --profile=$(BUILD_MODE)
ETC_DIR = $(INFER_DIR)/etc
#### Backend declarations ####
INFER_MAIN = infer
#### Checkers declarations ####
INFERTOP_MAIN = infertop
INFERUNIT_MAIN = inferunit
INFER_CREATE_TRACEVIEW_LINKS_MODULE = InferCreateTraceViewLinks
INFER_CREATE_TRACEVIEW_LINKS_MAIN = $(INFER_CREATE_TRACEVIEW_LINKS_MODULE)
CHECKCOPYRIGHT_MAIN = checkCopyright
INFER_ATDGEN_STUB_BASES = atd/jsonbug atd/runstate atd/java_method_decl atd/perf_profiler atd/java_profiler_samples atd/clang_profiler_samples
INFER_ATDGEN_TYPES = j t
@ -31,15 +29,8 @@ INFER_ATDGEN_SUFFIXES = $(foreach atd_t,$(INFER_ATDGEN_TYPES),_$(atd_t).ml _$(at
INFER_ATDGEN_STUBS = $(foreach base,$(INFER_ATDGEN_STUB_BASES),\
$(addprefix $(base),$(INFER_ATDGEN_SUFFIXES)))
#### InferCreateTraceViewLinks declarations ####
FACEBOOK_DIR = facebook
INFER_CREATE_TRACEVIEW_LINKS_MODULE = InferCreateTraceViewLinks
INFER_CREATE_TRACEVIEW_LINKS_MAIN = $(INFER_CREATE_TRACEVIEW_LINKS_MODULE)
### InferUnit declarations ###
INFERUNIT_MAIN = inferunit
#### Clang declarations ####
@ -65,21 +56,14 @@ CLANG_PLUGIN_MIRRORED_FILES = $(addprefix $(CLANG_PLUGIN_MIRROR)/, $(notdir $(FC
CLANG_BINIOU_DICT = $(ETC_DIR)/clang_ast.dict
#### scripts declarations ####
CHECKCOPYRIGHT_BIN = $(SCRIPT_DIR)/checkCopyright
CHECKCOPYRIGHT_MAIN = checkCopyright
#### End of declarations ####
ifeq ($(ENABLE_OCAMLOPT_CUSTOM_CC),yes)
EXTRA_CFLAGS += -cc,$(CC)
endif
# list of ocamlbuild targets common to all build targets -- native version
INFER_CONFIG_TARGETS = $(INFER_BUILD_DIR)/$(INFER_MAIN).exe
INFER_CONFIG_TARGETS = $(INFER_MAIN).exe
ifeq ($(IS_FACEBOOK_TREE),yes)
INFER_CONFIG_TARGETS += $(INFER_BUILD_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS_MAIN).exe
INFER_CONFIG_TARGETS += $(INFER_CREATE_TRACEVIEW_LINKS_MAIN).exe
endif
OCAML_GENERATED_SOURCES = \
@ -96,7 +80,10 @@ OCAML_SOURCES = \
.PHONY: all
all: infer
GENERATED_FROM_AUTOCONF = dune.common dune-workspace base/Version.ml
GENERATED_FROM_AUTOCONF = dune.common ../dune-workspace base/Version.ml
.PHONY: dune-workspace
dune-workspace: ../dune-workspace
GENERATED_DUNES += dune
@ -108,25 +95,12 @@ endif
.PHONY: src_build_common
src_build_common: $(SRC_BUILD_COMMON)
# Single out infer.exe as the source of truth for make, knowing that in fact several
# targets are produced by the build.
# The target is marked as .PHONY because if you build with one profile `make
# BUILD_MODE=dev` and then try with another profile `make BUILD_MODE=opt`, make won't
# trigger a rebuild since it has only partial view on the dependencies.
.PHONY: $(INFER_BUILD_DIR)/$(INFER_MAIN).exe
$(INFER_BUILD_DIR)/$(INFER_MAIN).exe: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(QUIET)$(DUNE_BUILD) $(INFER_CONFIG_TARGETS)
# let make know that the target is up-to-date even if ocamlbuild cached it
$(QUIET)touch $@
.PHONY: test
test: BUILD_MODE = test
test: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
# needed for dune to "install" the relevant dynamic libraries for the C stubs
$(QUIET)cd c_stubs; $(DUNE_BUILD) InferCStubs.install
$(QUIET)$(DUNE_BUILD) \
$(patsubst $(INFER_BUILD_DIR)/%.exe,%.bc, $(INFER_CONFIG_TARGETS)) \
scripts/checkCopyright.bc $(INFERUNIT_MAIN).bc infertop.bc
$(patsubst %.exe, %.bc.exe, $(INFER_CONFIG_TARGETS)) \
scripts/$(CHECKCOPYRIGHT_MAIN).bc.exe $(INFERUNIT_MAIN).bc.exe $(INFERTOP_MAIN).bc.exe
.PHONY: doc
doc: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
@ -136,57 +110,54 @@ doc: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
check: src_build_common
$(DUNE_BUILD) @check
#### Aliases for building binaries ####
INFER_BIN_ALIASES = $(foreach alias,$(INFER_COMMANDS),$(BIN_DIR)/$(alias))
# Single out infer[.bc].exe as the source of truth for make, knowing that in fact several
# targets are produced by the build.
# The targets below are marked as .PHONY because if you build with one profile `make
# BUILD_MODE=dev` and then try with another profile `make BUILD_MODE=opt`, make won't
# trigger a rebuild since it has only partial view on the dependencies.
$(INFER_BIN_ALIASES): Makefile $(BIN_DIR)/$(INFER_MAIN)
$(REMOVE) $@
$(QUIET)cd $(@D) && $(LN_S) -f infer $(@F)
$(QUIET)touch $@
.PHONY: $(INFER_BIN).exe
$(INFER_BIN).exe: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(QUIET)$(DUNE_BUILD) $(INFER_CONFIG_TARGETS)
$(INFER_BIN).exe: $(INFER_BUILD_DIR)/$(INFER_MAIN).exe
$(QUIET)$(MKDIR_P) $(BIN_DIR)
ifeq ($(WINDOWS_BUILD),yes)
# http://cygwin.1069669.n5.nabble.com/cp-utility-bug-when-dest-name-exe-file-exist-tp57955p58001.html
$(REMOVE) $(INFER_BIN) $(INFER_BIN).exe
endif
$(INSTALL_PROGRAM) -C $(INFER_BUILD_DIR)/$(INFER_MAIN).exe $(INFER_BIN).exe
ifeq ($(IS_FACEBOOK_TREE),yes)
$(INSTALL_PROGRAM) -C $(INFER_BUILD_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS_MAIN).exe \
$(INFER_CREATE_TRACEVIEW_LINKS_BIN)
endif
.PHONY: $(INFER_BIN).bc.exe
$(INFER_BIN).bc.exe: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(QUIET)$(DUNE_BUILD) $(patsubst %.exe, %.bc.exe, $(INFER_CONFIG_TARGETS))
.PHONY: $(INFERTOP_BIN) toplevel
$(INFERTOP_BIN): $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(DUNE_BUILD) $(INFERTOP_MAIN).bc.exe
toplevel: $(INFERTOP_BIN)
.PHONY: $(CHECKCOPYRIGHT_BIN) checkCopyright
$(CHECKCOPYRIGHT_BIN): $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(DUNE_BUILD) scripts/$(CHECKCOPYRIGHT_MAIN)
checkCopyright: $(CHECKCOPYRIGHT_BIN)
.PHONY: infer
infer: $(INFER_BIN).exe
$(INSTALL_PROGRAM) -C $(INFER_BIN).exe $(INFER_BIN)
$(MAKE) $(INFER_BIN_ALIASES)
.PHONY: $(INFER_BUILD_DIR)/$(INFER_MAIN).bc
$(INFER_BUILD_DIR)/$(INFER_MAIN).bc: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(DUNE_BUILD) $(INFER_CONFIG_TARGETS:.exe=.bc)
$(QUIET)touch $@
.PHONY: $(INFER_BIN).bc
$(INFER_BIN).bc: $(INFER_BUILD_DIR)/$(INFER_MAIN).bc
$(QUIET)$(MKDIR_P) $(BIN_DIR)
ifeq ($(WINDOWS_BUILD),yes)
# http://cygwin.1069669.n5.nabble.com/cp-utility-bug-when-dest-name-exe-file-exist-tp57955p58001.html
$(REMOVE) $(INFER_BIN) $(INFER_BIN).exe
endif
$(INSTALL_PROGRAM) -C $(INFER_BUILD_DIR)/$(INFER_MAIN).bc $(INFER_BIN).bc
ifeq ($(IS_FACEBOOK_TREE),yes)
$(INSTALL_PROGRAM) -C $(INFER_BUILD_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS_MAIN).bc \
$(INFER_CREATE_TRACEVIEW_LINKS_BIN)
$(INSTALL_PROGRAM) -C $(INFER_CREATE_TRACEVIEW_LINKS_BIN).exe $(INFER_CREATE_TRACEVIEW_LINKS_BIN)
endif
# needed for dune to "install" the relevant dynamic libraries for the C stubs
cd c_stubs; $(DUNE_BUILD) InferCStubs.install
$(MAKE) $(INFER_BIN_ALIASES)
.PHONY: byte
byte: $(INFER_BIN).bc
$(INSTALL_PROGRAM) -C $(INFER_BIN).byte $(INFER_BIN)
byte: $(INFER_BIN).bc.exe
$(INSTALL_PROGRAM) -C $(INFER_BIN).bc.exe $(INFER_BIN)
ifeq ($(IS_FACEBOOK_TREE),yes)
$(INSTALL_PROGRAM) -C $(INFER_CREATE_TRACEVIEW_LINKS_BIN).bc.exe $(INFER_CREATE_TRACEVIEW_LINKS_BIN)
endif
$(MAKE) $(INFER_BIN_ALIASES)
INFER_BIN_ALIASES = $(foreach alias,$(INFER_COMMANDS),$(BIN_DIR)/$(alias))
$(INFER_BIN_ALIASES): Makefile $(BIN_DIR)/$(INFER_MAIN)
$(REMOVE) $@
$(QUIET)cd $(@D) && $(LN_S) -f infer $(@F)
$(QUIET)touch $@
roots:=Infer
ifeq ($(IS_FACEBOOK_TREE),yes)
roots += $(INFER_CREATE_TRACEVIEW_LINKS_MODULE)
@ -212,28 +183,6 @@ mod_dep.pdf: mod_dep.dot
dsort:
$(QUIET)ocamldep.opt -sort $(inc_flags) $(ml_src_files)
.PHONY: $(INFER_BUILD_DIR)/infertop.bc
$(INFER_BUILD_DIR)/infertop.bc: $(SRC_DIR)/infertop.ml $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(DUNE_BUILD) $@
# needed for dune to "install" the relevant dynamic libraries for the C stubs
cd c_stubs; $(DUNE_BUILD) InferCStubs.install
$(QUIET)touch $@
$(INFERTOP_BIN): $(INFER_BUILD_DIR)/infertop.bc
$(QUIET)$(INSTALL_PROGRAM) -C $< $@
$(QUIET)touch $@
.PHONY: toplevel
toplevel: $(INFERTOP_BIN)
.PHONY: checkCopyright
checkCopyright: $(CHECKCOPYRIGHT_BIN)
.PHONY: $(CHECKCOPYRIGHT_BIN)
$(CHECKCOPYRIGHT_BIN): $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(DUNE_BUILD) $(INFER_BUILD_DIR)/scripts/$(CHECKCOPYRIGHT_MAIN).exe
$(INSTALL_PROGRAM) -C $(INFER_BUILD_DIR)/scripts/$(CHECKCOPYRIGHT_MAIN).exe $(CHECKCOPYRIGHT_BIN)
define gen_atdgen_rules
# generate files using atdgen
# parameters:
@ -300,7 +249,7 @@ $(GENERATED_FROM_AUTOCONF): $(MAKEFILE_LIST)
cat "$$TMPFILE" > $@; \
$(REMOVE) "$$TMPFILE"
dune.common: dune.common.in
dune-workspace: dune-workspace.in
../dune-workspace: ../dune-workspace.in
base/Version.ml: base/Version.ml.in
$(GENERATED_DUNES): dune.common
@ -314,20 +263,18 @@ clean:
$(MAKE) -C deadcode clean
$(REMOVE) $(INFER_TARGET)
$(REMOVE) toplevel.mlpack
$(REMOVE_DIR) $(BUILD_DIR)
$(REMOVE) $(ETC_DIR)/clang_ast.dict
$(REMOVE) $(GENERATED_FROM_AUTOCONF)
$(REMOVE) $(GENERATED_DUNES)
$(REMOVE) base/Version.ml.tmp.* dune.tmp.* dune-workspace.tmp.*
# be a bit more aggressive than needed with what we remove here so that stale binaries that
# only existed in previous versions get removed as well
$(REMOVE) $(BIN_DIR)/Infer* $(BIN_DIR)/infer-* $(INFER_BIN){,.bc,.exe} $(INFER_BIN_ALIASES) \
$(INFERUNIT_BIN) $(CHECKCOPYRIGHT_BIN)
$(REMOVE) $(INFER_BIN) $(INFER_BIN_ALIASES) $(INFER_CREATE_TRACEVIEW_LINKS_BIN)
$(REMOVE) $(BIN_DIR)/llvm_sil
$(REMOVE) $(INFER_CREATE_TRACEVIEW_LINKS_BIN)
$(REMOVE) atd/*_{j,t,v}.ml{,i} atd/clang_ast_*
$(REMOVE) mod_dep.dot
$(REMOVE) mod_dep.pdf
cd .. && dune clean
.PHONY: fmt
fmt:

@ -1,18 +1,11 @@
(* -*- tuareg -*- *)
(*
* 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.
*)
; 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.
;;
Format.sprintf
{|
(library
(name InferCStubs)
(public_name InferCStubs)
(foreign_stubs (language c) (names fnv64_hash))
)
|}
|> Jbuild_plugin.V1.send
(foreign_stubs
(language c)
(names fnv64_hash)))

@ -28,7 +28,7 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
INFER_BUILD_DIR = ../_build/default
INFER_BUILD_DIR = $(INFER_DIR)/_build/default/src
ALL_INFER_IN_ONE_FILE_ML = all_infer_in_one_file.ml
ALL_ML_FILES = all_ml_files
@ -38,13 +38,13 @@ ALL_MLI_FILES_COPIED = all_mli_files_copied
default: detect_dead_code
ml_src_files_from_mlly:=$(shell find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../_build/*" -regex '\.\./[a-zA-Z].*\.ml[ly]')
ml_src_files_from_mlly:=$(shell find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../../_build/*" -regex '\.\./[a-zA-Z].*\.ml[ly]')
ml_src_files:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../_build/*" -regex '\.\./[a-zA-Z].*\.ml'); do echo $${i\#"../"}; done)
ml_src_files:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../../_build/*" -regex '\.\./[a-zA-Z].*\.ml'); do echo $${i\#"../"}; done)
mli_src_files:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../_build/*" -regex '\.\./[a-zA-Z].*\.mli'); do echo $${i\#"../"}; done)
mli_src_files:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../../_build/*" -regex '\.\./[a-zA-Z].*\.mli'); do echo $${i\#"../"}; done)
ml_src_files_without_mli:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../_build/*" -regex '\.\./[a-zA-Z].*\.ml'); do [ -f $${i}i ] || echo $${i\#"../"}; done)
ml_src_files_without_mli:=$(shell for i in $$(find .. -not -path "../*clang_stubs/*" -not -path "../*java_stubs/*" -not -path "../../_build/*" -regex '\.\./[a-zA-Z].*\.ml'); do [ -f $${i}i ] || echo $${i\#"../"}; done)
.PHONY: depend
depend:
@ -168,7 +168,7 @@ detect_dead_code:
rm "$$tmp_file_copied"
$(MAKE) -j 1 detect_dead_src_file
# build and get dead code warnings; clean in case of errors so as not to leave rubbish around
if ! dune build --profile test $(INFER_BUILD_DIR)/deadcode/all_infer_in_one_file.bc; then \
if ! dune build --profile test all_infer_in_one_file.bc; then \
$(MAKE) clean; \
exit 1; \
fi

@ -5,3 +5,4 @@
; LICENSE file in the root directory of this source tree.
(using menhir 1.0)
(formatting (enabled_for dune))

@ -45,7 +45,8 @@ let env_stanza =
(flags %s)
(ocamlopt_flags (:standard -O3)))
(test
(flags %s)))
(flags %s))
)
|}
lenient_flags lenient_flags strict_flags
@ -102,11 +103,12 @@ let infer_exe_stanza =
{|
(executables
(names %s)
(modes byte exe)
(modes byte_complete exe)
(flags (:standard %s -open InferModules))
(libraries InferModules)
(modules %s)
(preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check))
(promote (until-clean) (into ../bin))
)
|}
(String.concat " " infer_binaries)
@ -119,12 +121,13 @@ let infertop_stanza =
{|
(executable
(name infertop)
(modes byte)
(modes byte_complete)
(flags (:standard %s))
(libraries utop InferModules)
(link_flags (-linkall -warn-error -31))
(modules Infertop)
(preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check))
(link_flags (-linkall -warn-error -31))
(promote (until-clean) (into ../bin))
)
|}
infer_cflags

@ -6,7 +6,7 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
INFER_BUILD_DIR = ../_build/default
INFER_BUILD_DIR = ../../_build/default
default: llvm_sil

@ -5,8 +5,16 @@
(executable
(name checkCopyright)
(modes byte exe)
(modes byte_complete exe)
(flags (:standard))
(libraries core str)
(preprocess
(pps ppx_compare)))
(rule
(action
(copy checkCopyright.exe checkCopyright))
(mode
(promote
(until-clean)
(into ../../bin))))

@ -8,13 +8,12 @@ ROOT_DIR = $(TESTS_DIR)/../..
include $(TESTS_DIR)/base.make
toplevel.exp.test: $(BUILD_DIR)/default/infertop.bc $(SCRIPT_DIR)/infer_repl \
toplevel.exp.test: $(INFERTOP_BIN) $(SCRIPT_DIR)/infer_repl \
$(SCRIPT_DIR)/toplevel_init $(INFER_DIR)/tests/repl/infer_batch_script.mltop
$(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\
BUILD_DIR=$(BUILD_DIR)/default \
$(SCRIPT_DIR)/infer_repl $(INFER_DIR)/tests/repl/infer_batch_script.mltop | \
sed -e 's#^The files .*/extLib.cma$$#The files [...]/extLib.cma#' \
-e 's#^and .*/infertop.bc$$#and [...]/infertop.bc#' \
-e 's#^and .*/infertop.bc.exe$$#and [...]/infertop.bc.exe#' \
> $@)
.PHONY: print

@ -8,7 +8,7 @@ Findlib has been successfully loaded. Additional directives:
#thread;; to enable threads
The files [...]/extLib.cma
and [...]/infertop.bc
and [...]/infertop.bc.exe
disagree over interface Base64
n$5
false

@ -1,25 +0,0 @@
#!/bin/bash
# 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.
## Wrapper around the bytecode versions of infer
# This is needed to find the dynamic libraries of our C stubs
if [ "$#" -lt 1 ]; then
echo "usage: $0 BYTECODE_PROGRAM" >&2
exit 1
fi
prog=$1
shift
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC_DIR="$SCRIPT_DIR"/../infer/src
BUILD_MODE=${BUILD_MODE:-dev}
DUNE_INSTALL_DIR=${INSTALL_DIR:-"$SRC_DIR/_build/install/default"}
export CAML_LD_LIBRARY_PATH="$DUNE_INSTALL_DIR"/lib/stublibs:"$CAML_LD_LIBRARY_PATH"
exec "$prog" "$@"

@ -5,7 +5,8 @@
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# where to find toplevel.bc, can be overridden
BUILD_DIR=${BUILD_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default}
BUILD_DIR=${BUILD_DIR:-"$SCRIPT_DIR"/../infer/_build/default/src}
BIN_DIR="$SCRIPT_DIR/../infer/bin"
INCLUDE_FLAGS=$(find "$BUILD_DIR" -type d -name '*.objs' -exec printf -- '-I {}/byte\n' \;)
# The -init option is effective only in interactive mode.
@ -17,7 +18,7 @@ INCLUDE_FLAGS=$(find "$BUILD_DIR" -type d -name '*.objs' -exec printf -- '-I {}/
# file. In interactive mode $SCRIPT_DIR isn't needed
set -x
"$SCRIPT_DIR"/dune_exec_shim.sh infertop.bc \
$BIN_DIR/infertop.bc.exe \
-init "$SCRIPT_DIR"/toplevel_init \
$INCLUDE_FLAGS \
-I "$SCRIPT_DIR" \

Loading…
Cancel
Save