[travis] use ./build-infer.sh to build infer

Summary: This uses opam.lock which is less likely to break due to external opam changes.

Reviewed By: cristianoc

Differential Revision: D5208622

fbshipit-source-id: af6f03c
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 57dd45dd82
commit 53f5c2ef13

@ -9,16 +9,11 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y aspcud; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y aspcud; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install aspcud; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install opam; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install opam; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam init; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam switch 4.04.0; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam install -y depext; fi
install: install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam pin add -y --no-action infer .; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_wait 120 ./build-infer.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam depext infer; 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 opam install -y infer; fi
script: script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/local_install_tests.sh; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/local_install_tests.sh; fi

@ -31,7 +31,7 @@ function usage() {
echo echo
echo " options:" echo " options:"
echo " -h,--help show this message" echo " -h,--help show this message"
echo " --only-install-opam install the opam dependencies of infer and exists" 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 " --opam-switch specify the opam switch where to install infer (default: $INFER_OPAM_SWITCH_DEFAULT)"
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.lock file and let opam resolve dependencies"
echo " -y,--yes automatically agree to everything" echo " -y,--yes automatically agree to everything"
@ -120,13 +120,13 @@ export OPAMYES=1
check_installed () { check_installed () {
local cmd=$1 local cmd=$1
if ! which $cmd >/dev/null 2>&1; then if ! which $cmd >/dev/null 2>&1; then
echo "dependency not found: $cmd" echo "dependency not found: $cmd" >&2
exit 1 exit 1
fi fi
} }
setup_opam () { setup_opam () {
opam init --compiler=$OCAML_VERSION -j $NCPU --no-setup --yes opam init --compiler=$OCAML_VERSION -j $NCPU --no-setup
opam switch set -j $NCPU $INFER_OPAM_SWITCH --alias-of $OCAML_VERSION opam switch set -j $NCPU $INFER_OPAM_SWITCH --alias-of $OCAML_VERSION
} }
@ -151,7 +151,7 @@ install_infer-deps () {
install_locked_deps() { install_locked_deps() {
if ! opam lock 2> /dev/null; then if ! opam lock 2> /dev/null; then
echo "opam-lock not found in the current switch, installing from '$OPAM_LOCK_URL'..." echo "opam-lock not found in the current switch, installing from '$OPAM_LOCK_URL'..." >&2
opam pin add -k git lock "$OPAM_LOCK_URL" opam pin add -k git lock "$OPAM_LOCK_URL"
fi fi
opam lock --install < "$INFER_ROOT"/opam.lock opam lock --install < "$INFER_ROOT"/opam.lock
@ -166,7 +166,7 @@ install_opam_deps() {
} }
echo "initializing opam... " echo "initializing opam... " >&2
check_installed opam check_installed opam
if [ "$INFER_OPAM_SWITCH" = "$INFER_OPAM_SWITCH_DEFAULT" ]; then if [ "$INFER_OPAM_SWITCH" = "$INFER_OPAM_SWITCH_DEFAULT" ]; then
# set up the custom infer switch # set up the custom infer switch
@ -175,12 +175,12 @@ else
opam switch set -j $NCPU $INFER_OPAM_SWITCH opam switch set -j $NCPU $INFER_OPAM_SWITCH
fi fi
eval $(SHELL=bash opam config env --switch=$INFER_OPAM_SWITCH) eval $(SHELL=bash opam config env --switch=$INFER_OPAM_SWITCH)
echo echo >&2
echo "installing infer dependencies; this can take up to 30 minutes... " echo "installing infer dependencies; this can take up to 30 minutes... " >&2
install_opam_deps || ( \ install_opam_deps || ( \
echo; \ echo >&2; \
echo '*** Failed to install opam dependencies'; \ echo '*** Failed to install opam dependencies' >&2; \
echo '*** Updating opam then retrying'; \ echo '*** Updating opam then retrying' >&2; \
opam update && \ opam update && \
install_opam_deps \ install_opam_deps \
) )
@ -189,7 +189,7 @@ if [ "$ONLY_SETUP_OPAM" = "yes" ]; then
exit 0 exit 0
fi fi
echo "preparing build... " echo "preparing build... " >&2
if [ ! -f .release ]; then if [ ! -f .release ]; then
if [ "$BUILD_CLANG" = "no" ]; then if [ "$BUILD_CLANG" = "no" ]; then
SKIP_SUBMODULES=true ./autogen.sh > /dev/null SKIP_SUBMODULES=true ./autogen.sh > /dev/null
@ -239,10 +239,10 @@ if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-
fi fi
make -j $NCPU all || ( make -j $NCPU all || (
echo echo >&2
echo ' compilation failure; you can try running' echo ' compilation failure; you can try running' >&2
echo echo >&2
echo ' make clean' echo ' make clean' >&2
echo " $0 $ORIG_ARGS" echo " $0 $ORIG_ARGS" >&2
echo echo >&2
exit 1) exit 1)

Loading…
Cancel
Save