[opam] add `make opam.lock` target

Summary: Useful to update opam package versions.

Reviewed By: jberdine

Differential Revision: D5190763

fbshipit-source-id: 225462e
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent ba5e04cf39
commit e00a82adcb

@ -218,3 +218,14 @@ Follow `clang-format` (see ".clang-format" at the root of the repository).
$ infer --debug -- clang -c examples/hello.c
$ firefox infer-out/captured/hello.c.*.html
```
## Updating opam and opam.lock
tl; dr: Run `make opam.lock`.
opam.lock records fixed versions of the opam dependencies known to work with infer and to respect
the constraints in opam. This prevents unpredictable breakages of infer or its dependencies,
especially for infer releases, for which it is more difficult to change their package constraints
after the fact.
To add an opam package or update its version constraints, edit 'opam' then run `make opam.lock`.

@ -518,6 +518,27 @@ conf-clean: clean
$(REMOVE_DIR) $(MODELS_DIR)/java/infer-out/
$(REMOVE_DIR) $(MODELS_DIR)/objc/out/
# opam package to hold infer dependencies
INFER_PKG_OPAMLOCK=infer-lock-deps
# phony because it depends on opam's internal state
.PHONY: opam.lock
opam.lock: opam
$(QUIET)if test x"$$(git status --porcelain -- opam)" != "x"; then \
echo "ERROR: Changes to 'opam' detected." 1>&2; \
echo "ERROR: Please commit or revert your changes before updating opam.lock." 1>&2; \
echo "ERROR: This is because opam.lock is generated from the HEAD commit." 1>&2; \
exit 1; \
fi
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
$(QUIET)$(call silent_on_success,installing dependencies $(INFER_PKG_OPAMLOCK) opam package,\
OPAMSWITCH=$(OPAMSWITCH); \
$(OPAM) pin add --yes --no-action -k git $(INFER_PKG_OPAMLOCK) .#HEAD; \
$(OPAM) install --deps-only --yes infer)
$(QUIET)$(call silent_on_success,generating opam.lock,\
$(OPAM) lock --pkg $(INFER_PKG_OPAMLOCK) > opam.lock)
# print any variable for Makefile debugging
print-%:
$(QUIET)echo '$*=$($*)'

@ -56,6 +56,8 @@ OCAMLC = @OCAMLC@
OCAMLFIND = @OCAMLFIND@
OCAMLLEX = @OCAMLLEX@
OCAMLOPT = @OCAMLOPT@
OPAM = @OPAM@
OPAMSWITCH = @OPAMSWITCH@
PATH = @PATH@
prefix = @prefix@
PYTHON_lxml = @PYTHON_lxml@

@ -193,6 +193,14 @@ AC_ASSERT_PROG([rebuild], [$REBUILD])
AC_ARG_VAR([CAML_LD_LIBRARY_PATH],
[Additional directories to search for dynamically-loaded libraries.])
AC_CHECK_TOOL([OPAM], [opam], [no])
AS_IF([test "$OPAM" != "no"], [
AC_MSG_CHECKING([current opam switch])
OPAMSWITCH=$("$OPAM" switch show)
AC_MSG_RESULT([$OPAMSWITCH])
])
if test "x$enable_java_analyzers" = "xyes"; then
AC_CHECK_TOOL([JAVA], [java], [no])
AC_PATH_TOOL([JAVAC], [javac], [no])

Loading…
Cancel
Save