diff --git a/.gitignore b/.gitignore index 6d1091b06..60fd31629 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ /_build /_build_logs /infer/tests/codetoanalyze/java/*/codetoanalyze -/dependencies/infer-deps-* _build_infer *.exp.test* *.test.dot diff --git a/.travis.yml b/.travis.yml index 28f5aab33..2417df77c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ sudo: required language: c os: - linux + - osx services: docker osx_image: xcode7.3 before_install: @@ -11,10 +12,9 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install opam; fi install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_wait 60 ./build-infer.sh --yes java --opam-switch 4.06.1 --only-setup-opam; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam pin add -y --no-action -k git infer .; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam install -y infer; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_wait 60 ./build-infer.sh --yes java --user-opam-switch --only-setup-opam; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam env`; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam install --yes infer .; fi script: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/local_install_tests.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/docker_tests.sh; fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 115482f6f..6ec2d7ab3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -233,13 +233,13 @@ $ infer --debug -- clang -c examples/hello.c $ firefox infer-out/captured/hello.c.*.html ``` -## Updating opam and opam.lock +## Updating opam and opam.locked -tl; dr: Run `make opam.lock`. +tl; dr: Run `make opam.locked`. -opam.lock records fixed versions of the opam dependencies known to work with infer and to respect +opam.locked 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`. +To add an opam package or update its version constraints, edit 'opam' then run `make opam.locked`. diff --git a/INSTALL.md b/INSTALL.md index 8faeba4a8..fb202c09d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,7 +14,7 @@ page to install Infer. Here are the prerequisites to be able to compile Infer on MacOSX. This is required to compile everything from source. -- opam 1.2.2 (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX)) +- opam >= 2.0.0 (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX)) - Python 2.7 - sqlite - pkg-config @@ -41,7 +41,7 @@ brew cask install java Here are the prerequisites to be able to compile Infer on Linux. This is required to compile everything from source. -- opam 1.2.2 +- opam >= 2.0.0 - Python 2.7 - pkg-config - Java (only needed for the Java analysis) diff --git a/Makefile b/Makefile index 82f5d66cd..f4e12389a 100644 --- a/Makefile +++ b/Makefile @@ -689,33 +689,20 @@ conf-clean: clean $(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 +.PHONY: opam.locked +opam.locked: opam # allow users to not force a run of opam update since it's very slow ifeq ($(NO_OPAM_UPDATE),) $(QUIET)$(call silent_on_success,opam update,$(OPAM) update) endif - $(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_PKG_OPAMLOCK)) - $(QUIET)$(call silent_on_success,generating opam.lock,\ - $(OPAM) lock --pkg $(INFER_PKG_OPAMLOCK) > opam.lock) + $(QUIET)$(call silent_on_success,generating opam.locked,\ + $(OPAM) lock .) # This is a magical version number that doesn't reinstall the world when added on top of what we -# have in opam.lock. To upgrade this version number, manually try to install several utop versions +# have in opam.locked. To upgrade this version number, manually try to install several utop versions # until you find one that doesn't recompile the world. TODO(t20828442): get rid of magic -OPAM_DEV_DEPS = ocp-indent merlin utop.2.2.0 webbrowser +OPAM_DEV_DEPS = ocamlformat.0.8 ocp-indent merlin utop.2.2.0 webbrowser ifneq ($(EMACS),no) OPAM_DEV_DEPS += tuareg @@ -726,10 +713,6 @@ devsetup: Makefile.autoconf $(QUIET)[ $(OPAM) != "no" ] || (echo 'No `opam` found, aborting setup.' >&2; exit 1) $(QUIET)$(call silent_on_success,installing $(OPAM_DEV_DEPS),\ OPAMSWITCH=$(OPAMSWITCH); $(OPAM) install --yes --no-checksum user-setup $(OPAM_DEV_DEPS)) - $(QUIET)echo '$(TERM_INFO)*** Running `opam config setup -a`$(TERM_RESET)' >&2 - $(QUIET)OPAMSWITCH=$(OPAMSWITCH); $(OPAM) config --yes setup -a - $(QUIET)$(call silent_on_success,installing ocamlformat,\ - OPAMSWITCH=$(OPAMSWITCH); $(OPAM) pin add --yes ocamlformat.$$(grep version .ocamlformat | cut -d ' ' -f 3) https://github.com/ocaml-ppx/ocamlformat.git#$$(grep version .ocamlformat | cut -d ' ' -f 3)-opam1) $(QUIET)echo '$(TERM_INFO)*** Running `opam user-setup`$(TERM_RESET)' >&2 $(QUIET)OPAMSWITCH=$(OPAMSWITCH); OPAMYES=1; $(OPAM) user-setup install $(QUIET)if [ "$(PLATFORM)" = "Darwin" ] && [ x"$(GNU_SED)" = x"no" ]; then \ @@ -791,7 +774,7 @@ devsetup: Makefile.autoconf echo '$(TERM_INFO)*** NOTE: The current shell is not set up for the right opam switch.$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** NOTE: Please run:$(TERM_RESET)' >&2; \ echo >&2; \ - echo "$(TERM_INFO) eval \$$($(OPAM) config env)$(TERM_RESET)" >&2; \ + echo "$(TERM_INFO) eval \$$($(OPAM) env)$(TERM_RESET)" >&2; \ fi GHPAGES ?= no diff --git a/build-infer.sh b/build-infer.sh index 9d45d805a..94afbaca7 100755 --- a/build-infer.sh +++ b/build-infer.sh @@ -13,12 +13,10 @@ set -u SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" INFER_ROOT="$SCRIPT_DIR" -INFER_DEPS_DIR="$INFER_ROOT/dependencies/infer-deps" PLATFORM="$(uname)" NCPU="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)" -OCAML_VERSION_DEFAULT="4.06.1+flambda" -INFER_OPAM_SWITCH_DEFAULT=infer-"$OCAML_VERSION_DEFAULT" - +INFER_OPAM_DEFAULT_SWITCH="ocaml-variants.4.06.1+flambda" +INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_DEFAULT_SWITCH} function usage() { echo "Usage: $0 [-y] [targets]" @@ -30,9 +28,9 @@ function usage() { echo echo " options:" echo " -h,--help show this message" - echo " --no-opam-lock do not use the opam.lock file and let opam resolve dependencies" + echo " --no-opam-lock do not use the opam.locked file and let opam resolve dependencies" echo " --only-setup-opam initialize opam, install the opam dependencies of infer, and exit" - echo " --opam-switch specify the opam switch where to install infer (default: $INFER_OPAM_SWITCH_DEFAULT)" + echo " --user-opam-switch use the current opam switch to install infer (default: $INFER_OPAM_DEFAULT_SWITCH)" echo " -y,--yes automatically agree to everything" echo echo " examples:" @@ -48,10 +46,9 @@ INFER_CONFIGURE_OPTS=${INFER_CONFIGURE_OPTS:-""} INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_SWITCH_DEFAULT} INTERACTIVE=${INTERACTIVE:-yes} JOBS=${JOBS:-$NCPU} -OCAML_VERSION=${OCAML_VERSION:-$OCAML_VERSION_DEFAULT} ONLY_SETUP_OPAM=${ONLY_SETUP_OPAM:-no} -OPAM_LOCK_URL=${OPAM_LOCK_URL:-https://github.com/rgrinberg/opam-lock} USE_OPAM_LOCK=${USE_OPAM_LOCK:-yes} +USER_OPAM_SWITCH=no ORIG_ARGS="$*" @@ -83,10 +80,8 @@ while [[ $# > 0 ]]; do shift continue ;; - --opam-switch) - shift - [[ $# > 0 ]] || (usage; exit 1) - INFER_OPAM_SWITCH="$1" + --user-opam-switch) + USER_OPAM_SWITCH=yes shift continue ;; @@ -108,115 +103,90 @@ while [[ $# > 0 ]]; do done # if no arguments then build both clang and Java -if [ "$BUILD_CLANG" = "no" ] && [ "$BUILD_JAVA" = "no" ]; then +if [ "$BUILD_CLANG" == "no" ] && [ "$BUILD_JAVA" == "no" ]; then BUILD_CLANG=yes BUILD_JAVA=yes fi # enable --yes option for some commands in non-interactive mode YES= -if [ "$INTERACTIVE" = "no" ]; then +if [ "$INTERACTIVE" == "no" ]; then YES=--yes fi -# --yes by default for opam commands -export OPAMYES=1 - -check_installed () { - local cmd="$1" - if ! which "$cmd" >/dev/null 2>&1; then - echo "dependency not found: '$cmd'" >&2 - exit 1 - fi -} - -opam_retry () { - "$@" || ( \ - echo >&2; \ - printf '*** `%s` failed\n' "$*" >&2; \ - echo '*** Updating opam then retrying' >&2; \ - opam update && \ - "$@" || ( \ - echo >&2; \ - printf '*** ERROR: `%s` failed\n' "$*" >&2; \ - exit 1 \ - ) \ - ) \ -} +# --yes by default for opam commands except if we are using the user's opam switch +if [ "$INTERACTIVE" == "no" ] || [ "$USER_OPAM_SWITCH" == "no" ]; then + export OPAMYES=true +fi setup_opam () { - opam_retry opam init --compiler="$OCAML_VERSION" -j "$JOBS" --no-setup - if [ "$INFER_OPAM_SWITCH" = "$INFER_OPAM_SWITCH_DEFAULT" ]; then - opam_retry opam switch set -j "$JOBS" "$INFER_OPAM_SWITCH" --alias-of "$OCAML_VERSION" - else - opam_retry opam switch set -j "$JOBS" "$INFER_OPAM_SWITCH" - fi -} - -# Install and record the infer dependencies in opam. The main trick is to install the -# $INFER_DEPS_DIR directory instead of the much larger infer repository. That directory contains -# just enough to pretend it installs infer. -install_infer-deps () { - # remove previous infer-deps pin, which might have conflicting dependencies - opam pin remove infer-deps --no-action - INFER_TMP_DEPS_DIR="$(mktemp -d "$INFER_ROOT"/dependencies/infer-deps-XXXX)" - INFER_TMP_PACKAGE_NAME="$(basename "$INFER_TMP_DEPS_DIR")" - cp -a "$INFER_DEPS_DIR"/* "$INFER_TMP_DEPS_DIR" - # give unique name to the package to force opam to recheck the dependencies are all installed - opam pin add --no-action "$INFER_TMP_PACKAGE_NAME" "$INFER_TMP_DEPS_DIR" - opam install -j "$JOBS" --deps-only "$INFER_TMP_PACKAGE_NAME" - opam pin remove "$INFER_TMP_PACKAGE_NAME" - rm -fr "$INFER_TMP_DEPS_DIR" - # pin infer so that opam doesn't violate its package constraints when the user does - # "opam upgrade" - opam pin add infer-deps "$INFER_DEPS_DIR" + opam var root 1>/dev/null 2>/dev/null || opam init --reinit --bare --no-setup + opam_switch_create_if_needed "$INFER_OPAM_SWITCH" + opam switch set "$INFER_OPAM_SWITCH" } -install_locked_deps() { - if ! opam lock 2> /dev/null; then - echo "opam-lock not found in the current switch, installing from '$OPAM_LOCK_URL'..." >&2 - opam pin add -k git lock "$OPAM_LOCK_URL" +install_opam_deps () { + local locked= + if [ "$USE_OPAM_LOCK" == yes ]; then + locked=--locked fi - opam lock --install < "$INFER_ROOT"/opam.lock + opam install --deps-only $locked infer "$INFER_ROOT" } -install_opam_deps() { - if [ "$USE_OPAM_LOCK" = yes ]; then - install_locked_deps - else - install_infer-deps - fi +# temporary +# https://github.com/ocaml/opam-repository/issues/13040 +warn_javalib_sandbox () { + echo "*** Did opam just fail to install javalib? If so you need to disable sandboxing." >&2 + echo "*** Delete the following lines in $(opam var root)/config:" >&2 + echo >&2 + echo ' wrap-build-commands:' >&2 + echo ' ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"}' >&2 + echo ' wrap-install-commands:' >&2 + echo ' ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"}' >&2 + echo ' wrap-remove-commands:' >&2 + echo ' ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"}' >&2 + echo >&2 + echo "*** once you are done don't forget to enable sandboxing again with" >&2 + echo >&2 + echo " opam init --reinit -ni" >&2 + exit 1 } - echo "initializing opam... " >&2 -check_installed opam -setup_opam -eval $(SHELL=bash opam config env --switch="$INFER_OPAM_SWITCH") +. "$INFER_ROOT"/scripts/opam_utils.sh +# workaround bug in opam regarding symlinks +# https://github.com/ocaml/opam/issues/3622 +OPAMROOT=${OPAMROOT:-"$HOME"/.opam} +OPAMROOT=$(realpath "$OPAMROOT") +export OPAMROOT +if [ "$USER_OPAM_SWITCH" == "no" ]; then + setup_opam +fi +eval $(SHELL=bash opam env) echo >&2 echo "installing infer dependencies; this can take up to 30 minutes... " >&2 -opam_retry install_opam_deps +opam_retry install_opam_deps || warn_javalib_sandbox -if [ "$ONLY_SETUP_OPAM" = "yes" ]; then +if [ "$ONLY_SETUP_OPAM" == "yes" ]; then exit 0 fi echo "preparing build... " >&2 -if [ "$BUILD_CLANG" = "no" ]; then +if [ "$BUILD_CLANG" == "no" ]; then SKIP_SUBMODULES=true ./autogen.sh > /dev/null else ./autogen.sh > /dev/null fi -if [ "$BUILD_CLANG" = "no" ]; then +if [ "$BUILD_CLANG" == "no" ]; then INFER_CONFIGURE_OPTS+=" --disable-c-analyzers" fi -if [ "$BUILD_JAVA" = "no" ]; then +if [ "$BUILD_JAVA" == "no" ]; then INFER_CONFIGURE_OPTS+=" --disable-java-analyzers" fi ./configure $INFER_CONFIGURE_OPTS -if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-check-install; then +if [ "$BUILD_CLANG" == "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-check-install; then echo "" echo " Warning: you are not using a release of Infer. The C and" echo " Objective-C analyses require a custom clang to be compiled" @@ -235,7 +205,7 @@ if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only- confirm="n" printf "Are you sure you want to compile clang? (y/N) " - if [ "$INTERACTIVE" = "no" ]; then + if [ "$INTERACTIVE" == "no" ]; then confirm="y" echo "$confirm" else diff --git a/configure.ac b/configure.ac index 4144c0dcc..ef822cda1 100644 --- a/configure.ac +++ b/configure.ac @@ -189,7 +189,7 @@ AC_ASSERT_OCAML_PKG([atdgen], [], []) AC_ASSERT_OCAML_PKG([biniou]) AC_ASSERT_OCAML_PKG([camlzip], [zip]) AC_ASSERT_OCAML_PKG([easy-format]) -AC_ASSERT_OCAML_PKG([oUnit], [], [2.0.0]) +AC_ASSERT_OCAML_PKG([oUnit], [], [2.0.5]) AC_CHECK_TOOL([UTOP], [utop], [no]) AC_ASSERT_OCAML_PKG([yojson]) @@ -202,6 +202,12 @@ AC_ARG_VAR([OPAMSWITCH], [Opam switch used for building infer.]) AC_CHECK_TOOL([OPAM], [opam], [no]) AS_IF([test "$OPAM" != "no"], [ + AC_MSG_CHECKING([opam version]) + opam_version=$(opam --version) + case $opam_version in + 2.*) AC_MSG_RESULT([$opam_version]); break;; + *) AC_MSG_ERROR([opam version $opam_version is not supported, please install opam version 2 instead]); break;; + esac AC_MSG_CHECKING([current opam root]) OPAMROOT=$("$OPAM" config var root) AC_MSG_RESULT([$OPAMROOT]) @@ -222,7 +228,6 @@ if test "x$enable_java_analyzers" = "xyes"; then AC_ASSERT_PROG([java], [$JAVA]) AC_ASSERT_OCAML_PKG([javalib], [], [2.3.3]) AC_ASSERT_OCAML_PKG([sawja], [], [1.5.2]) - AC_ASSERT_OCAML_PKG([ptrees]) AC_MSG_CHECKING([for JAVA_HOME]) cat - <<_ACEOF >conftest.java diff --git a/dependencies/infer-deps/Makefile b/dependencies/infer-deps/Makefile deleted file mode 100644 index 13772b9a1..000000000 --- a/dependencies/infer-deps/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2017-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# This file exists to make opam happy, it should not do anything useful besides that. - -.PHONY: install uninstall -install uninstall: - @: diff --git a/dependencies/infer-deps/autogen.sh b/dependencies/infer-deps/autogen.sh deleted file mode 100755 index 082d9dcba..000000000 --- a/dependencies/infer-deps/autogen.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2017-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# This file exists just to make opam happy, it should not do anything useful besides that. diff --git a/dependencies/infer-deps/configure b/dependencies/infer-deps/configure deleted file mode 100755 index 082d9dcba..000000000 --- a/dependencies/infer-deps/configure +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2017-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# This file exists just to make opam happy, it should not do anything useful besides that. diff --git a/dependencies/infer-deps/opam b/dependencies/infer-deps/opam deleted file mode 120000 index 9d9c75a75..000000000 --- a/dependencies/infer-deps/opam +++ /dev/null @@ -1 +0,0 @@ -../../opam \ No newline at end of file diff --git a/infer/src/dune.common.in b/infer/src/dune.common.in index 7cdd3f03c..fec6e7a9f 100644 --- a/infer/src/dune.common.in +++ b/infer/src/dune.common.in @@ -57,7 +57,7 @@ let common_cflags = let common_optflags = match build_mode with Opt -> ["-O3"] | Default | Test -> [] let common_libraries = - (if java then ["javalib"; "ptrees"; "sawja"] else []) + (if java then ["javalib"; "sawja"] else []) @ [ "ANSITerminal" ; "apron" ; "apron.octMPQ" diff --git a/m4/ac_assert_ocaml_min_version.m4 b/m4/ac_assert_ocaml_min_version.m4 index 4d2c71d90..3f0ff35da 100644 --- a/m4/ac_assert_ocaml_min_version.m4 +++ b/m4/ac_assert_ocaml_min_version.m4 @@ -15,6 +15,6 @@ AC_DEFUN([AC_ASSERT_OCAML_MIN_VERSION], m4_newline([ Please upgrade to OCaml >= $1. If you are using opam, you can run]) m4_newline([dnl opam switch $1 - eval \$(opam config env)]) + eval \$(opam env)]) ])])]) ]) diff --git a/m4/ac_assert_ocaml_pkg.m4 b/m4/ac_assert_ocaml_pkg.m4 index aa37a8b4c..8055fe6cc 100644 --- a/m4/ac_assert_ocaml_pkg.m4 +++ b/m4/ac_assert_ocaml_pkg.m4 @@ -38,7 +38,6 @@ AC_DEFUN([AC_ASSERT_OCAML_PKG], If you are using opam, please run opam update - opam pin add --yes --no-action infer . - opam install --deps-only infer]) + opam install --deps-only infer .]) ]) ]) diff --git a/opam b/opam index 725daca69..25082acc6 100644 --- a/opam +++ b/opam @@ -1,30 +1,23 @@ -opam-version: "1.2" +opam-version: "2.0" name: "infer" version: "0.15.0" -maintainer: "opam-devel@lists.ocaml.org" +synopsis: "A static analyzer for Java, C, C++, and Objective-C" +maintainer: "the infer team" authors: "Facebook" homepage: "https://github.com/facebook/infer" bug-reports: "https://github.com/facebook/infer/issues" -dev-repo: "https://github.com/facebook/infer.git" +dev-repo: "git://github.com/facebook/infer.git" license: "MIT" build: [ ["./autogen.sh"] ["./configure" "--disable-c-analyzers" "--prefix=%{prefix}%"] - ["make" "-j%{jobs}%"] + [make "-j%{jobs}%"] ] install: [ - ["make" "install"] + [make "install"] ] -remove: [ - ["./autogen.sh"] - ["./configure" - "--disable-c-analyzers" - "--prefix=%{prefix}%"] - ["make" "uninstall"] -] -ocaml-version: [ >= "4.04.2" ] depends: [ "ANSITerminal" {>="0.7"} "apron" @@ -42,6 +35,7 @@ depends: [ "elina" {>="1.1"} "javalib" {>="2.3.5"} "mtime" + "ocaml" {>="4.06.0"} "ocamlfind" {build} "ocamlgraph" "ounit" {="2.0.5"} diff --git a/opam.lock b/opam.lock deleted file mode 100644 index 324907357..000000000 --- a/opam.lock +++ /dev/null @@ -1,95 +0,0 @@ -ANSITerminal = 0.8 -apron = 20160125 -atd = 2.0.0 -atdgen = 2.0.0 -atdgen-runtime = 2.0.0 -base = v0.11.0 -base64 = 2.2.0 -bin_prot = v0.11.0 -biniou = 1.2.0 -camlidl = 1.05 -camlp4 = 4.06+1 -camlzip = 1.07 -camomile = 1.0.1 -cmdliner = 1.0.2 -conf-autoconf = 0.1 -conf-gmp = 1 -conf-m4 = 1 -conf-mpfr = 1 -conf-perl = 1 -conf-pkg-config = 1.0 -conf-sqlite3 = 1 -conf-which = 1 -conf-zlib = 1 -configurator = v0.11.0 -core = v0.11.2 -core_kernel = v0.11.1 -cppo = 1.6.4 -cppo_ocamlbuild = 1.6.0 -ctypes = 0.14.0 -dune = 1.1.1 -easy-format = 1.3.1 -elina = 1.1 -extlib = 1.7.5 -fieldslib = v0.11.0 -integers = 0.2.2 -jane-street-headers = v0.11.0 -javalib = 2.3.5 -jbuilder = transition -menhir = 20180703 -mlgmpidl = 1.2.7 -mtime = 1.1.0 -num = 1.1 -ocaml-compiler-libs = v0.11.0 -ocaml-migrate-parsetree = 1.0.11 -ocamlbuild = 0.12.0 -ocamlfind = 1.8.0 -ocamlgraph = 1.8.8 -octavius = 1.2.0 -ounit = 2.0.5 -parmap = 1.0-rc10 -parsexp = v0.11.0 -ppx_assert = v0.11.0 -ppx_base = v0.11.0 -ppx_bench = v0.11.0 -ppx_bin_prot = v0.11.0 -ppx_compare = v0.11.0 -ppx_custom_printf = v0.11.0 -ppx_derivers = 1.0 -ppx_deriving = 4.2.1 -ppx_enumerate = v0.11.0 -ppx_expect = v0.11.0 -ppx_fail = v0.11.0 -ppx_fields_conv = v0.11.0 -ppx_hash = v0.11.0 -ppx_here = v0.11.0 -ppx_inline_test = v0.11.0 -ppx_jane = v0.11.0 -ppx_js_style = v0.11.0 -ppx_let = v0.11.0 -ppx_optcomp = v0.11.0 -ppx_optional = v0.11.0 -ppx_pipebang = v0.11.0 -ppx_sexp_conv = v0.11.1 -ppx_sexp_message = v0.11.0 -ppx_sexp_value = v0.11.0 -ppx_tools = 5.1+4.06.0 -ppx_typerep_conv = v0.11.0 -ppx_variants_conv = v0.11.0 -ppxlib = 0.2.1 -re = 1.8.0 -result = 1.3 -sawja = 1.5.4 -seq = 0.1 -sexplib = v0.11.0 -sexplib0 = v0.11.0 -spawn = v0.12.0 -splittable_random = v0.11.0 -sqlite3 = 4.4.0 -stdio = v0.11.0 -topkg = 0.9.1 -typerep = v0.11.0 -variantslib = v0.11.0 -xmlm = 1.3.0 -yojson = 1.4.1 -zarith = 1.7 diff --git a/opam.locked b/opam.locked new file mode 100644 index 000000000..89d61f174 --- /dev/null +++ b/opam.locked @@ -0,0 +1,127 @@ +opam-version: "2.0" +name: "infer" +version: "0.15.0" +synopsis: "A static analyzer for Java, C, C++, and Objective-C" +maintainer: "the infer team" +authors: "Facebook" +homepage: "https://github.com/facebook/infer" +bug-reports: "https://github.com/facebook/infer/issues" +dev-repo: "git://github.com/facebook/infer.git" +license: "MIT" +build: [ + ["./autogen.sh"] + ["./configure" + "--disable-c-analyzers" + "--prefix=%{prefix}%"] + [make "-j%{jobs}%"] +] +install: [ + [make "install"] +] +depends: [ + "ANSITerminal" {= "0.8"} + "apron" {= "20160125"} + "atd" {= "2.0.0"} + "atdgen" {= "2.0.0"} + "atdgen-runtime" {= "2.0.0"} + "base" {= "v0.11.0"} + "base-bytes" {= "base"} + "base-threads" {= "base"} + "base-unix" {= "base"} + "base64" {= "2.2.0"} + "bin_prot" {= "v0.11.0"} + "biniou" {= "1.2.0"} + "camlidl" {= "1.05"} + "camlp4" {= "4.06+1"} + "camlzip" {= "1.07"} + "camomile" {= "1.0.1"} + "cmdliner" {= "1.0.2"} + "conf-autoconf" {= "0.1"} + "conf-gmp" {= "1"} + "conf-m4" {= "1"} + "conf-mpfr" {= "1"} + "conf-perl" {= "1"} + "conf-pkg-config" {= "1.0"} + "conf-sqlite3" {= "1"} + "conf-which" {= "1"} + "conf-zlib" {= "1"} + "configurator" {= "v0.11.0"} + "core" {= "v0.11.2"} + "core_kernel" {= "v0.11.1"} + "cppo" {= "1.6.4"} + "cppo_ocamlbuild" {= "1.6.0"} + "ctypes" {= "0.14.0"} + "dune" {= "1.1.1"} + "easy-format" {= "1.3.1"} + "elina" {= "1.1"} + "extlib" {= "1.7.5"} + "fieldslib" {= "v0.11.0"} + "integers" {= "0.2.2"} + "jane-street-headers" {= "v0.11.0"} + "javalib" {= "2.3.5"} + "jbuilder" {= "transition"} + "menhir" {= "20180703"} + "mlgmpidl" {= "1.2.7"} + "mtime" {= "1.1.0"} + "num" {= "1.1"} + "ocaml" {= "4.06.1"} + "ocaml-compiler-libs" {= "v0.11.0"} + "ocaml-migrate-parsetree" {= "1.0.11"} + "ocamlbuild" {= "0.12.0"} + "ocamlfind" {= "1.8.0"} + "ocamlgraph" {= "1.8.8"} + "octavius" {= "1.2.0"} + "ounit" {= "2.0.5"} + "parmap" {= "1.0-rc10"} + "parsexp" {= "v0.11.0"} + "ppx_assert" {= "v0.11.0"} + "ppx_base" {= "v0.11.0"} + "ppx_bench" {= "v0.11.0"} + "ppx_bin_prot" {= "v0.11.0"} + "ppx_compare" {= "v0.11.0"} + "ppx_custom_printf" {= "v0.11.0"} + "ppx_derivers" {= "1.0"} + "ppx_deriving" {= "4.2.1"} + "ppx_enumerate" {= "v0.11.0"} + "ppx_expect" {= "v0.11.0"} + "ppx_fail" {= "v0.11.0"} + "ppx_fields_conv" {= "v0.11.0"} + "ppx_hash" {= "v0.11.0"} + "ppx_here" {= "v0.11.0"} + "ppx_inline_test" {= "v0.11.0"} + "ppx_jane" {= "v0.11.0"} + "ppx_js_style" {= "v0.11.0"} + "ppx_let" {= "v0.11.0"} + "ppx_optcomp" {= "v0.11.0"} + "ppx_optional" {= "v0.11.0"} + "ppx_pipebang" {= "v0.11.0"} + "ppx_sexp_conv" {= "v0.11.1"} + "ppx_sexp_message" {= "v0.11.0"} + "ppx_sexp_value" {= "v0.11.0"} + "ppx_tools" {= "5.1+4.06.0"} + "ppx_typerep_conv" {= "v0.11.0"} + "ppx_variants_conv" {= "v0.11.0"} + "ppxlib" {= "0.2.1"} + "re" {= "1.8.0"} + "result" {= "1.3"} + "sawja" {= "1.5.4"} + "seq" {= "0.1"} + "sexplib" {= "v0.11.0"} + "sexplib0" {= "v0.11.0"} + "spawn" {= "v0.12.0"} + "splittable_random" {= "v0.11.0"} + "sqlite3" {= "4.4.0"} + "stdio" {= "v0.11.0"} + "topkg" {= "0.9.1"} + "typerep" {= "v0.11.0"} + "variantslib" {= "v0.11.0"} + "xmlm" {= "1.3.0"} + "yojson" {= "1.4.1"} + "zarith" {= "1.7"} +] +depexts: [ + [ ["ubuntu"] ["python2.7-dev"] ] + [ ["debian"] ["python2.7-dev"] ] + [ ["ubuntu"] ["default-jdk"] ] + [ ["debian"] ["default-jdk"] ] +] diff --git a/scripts/create_binary_release.sh b/scripts/create_binary_release.sh index 1b8d2dd1f..423e882c0 100755 --- a/scripts/create_binary_release.sh +++ b/scripts/create_binary_release.sh @@ -39,7 +39,7 @@ pushd "$ROOT_DIR" rm -fr "$RELEASE_NAME" ./build-infer.sh --only-setup-opam -eval $(opam config env) +eval $(opam env) touch .release ./autogen.sh ./configure --prefix="/$RELEASE_NAME" diff --git a/scripts/opam_utils.sh b/scripts/opam_utils.sh new file mode 100644 index 000000000..1a51f0415 --- /dev/null +++ b/scripts/opam_utils.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright (c) 2018-present, Facebook, Inc. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +# source this script to import its utility functions + +opam_retry () { + "$@" || ( \ + echo >&2; \ + printf '*** `%s` failed\n' "$*" >&2; \ + echo '*** Updating opam then retrying' >&2; \ + opam update && \ + "$@" || ( \ + echo >&2; \ + printf '*** ERROR: `%s` failed\n' "$*" >&2; \ + exit 1 \ + ) \ + ) +} + +opam_failed () { + local command=$1 + echo + printf '*** ERROR: %s failed\n' "$command" >&2 + printf "*** ERROR: Try running \$(opam update) then running this script again\n" >&2 + exit 1 +} + +opam_require_version_2 () { + local status=0 + local version=0 + { version=$(opam --version 2>/dev/null); status=$?; } + if [ "$status" != 0 ]; then + printf '*** ERROR: `opam --version` failed, please install opam version 2\n' >&2 + env >&2 + exit 1 + fi + case $version in + 2*) ;; + *) + printf '*** ERROR: opam version "%s" is not supported, please install opam version 2\n' "$version" >&2 + printf '*** NOTE: opam is "%s"\n' "$(which opam)" >&2 + env >&2 + exit 1 + esac +} + +# assumes opam is available and initialized +opam_switch_create_if_needed () { + local switch=$1 + local switch_exists=no + for installed_switch in $(opam switch list --short); do + if [ "$installed_switch" == "$switch" ]; then + switch_exists=yes + break + fi + done + if [ "$switch_exists" = "no" ]; then + opam switch create "$switch" + fi +} + +opam_require_version_2