Skip to content

Commit 18374a3

Browse files
jvillardfacebook-github-bot
authored andcommitted
[build] set the opam switch even when the switch is specified by the user
Reviewed By: jberdine Differential Revision: D4875350 fbshipit-source-id: 0f2952d
1 parent e105085 commit 18374a3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

build-infer.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ BUILD_CLANG=${BUILD_CLANG:-no}
4444
BUILD_JAVA=${BUILD_JAVA:-no}
4545
INTERACTIVE=${INTERACTIVE:-yes}
4646
ONLY_SETUP_OPAM=${ONLY_SETUP_OPAM:-no}
47-
# do not set INFER_OPAM_SWITCH by default
47+
INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_SWITCH_DEFAULT}
4848
ORIG_ARGS="$*"
4949

5050
while [[ $# > 0 ]]; do
@@ -152,10 +152,11 @@ install_opam_deps () {
152152

153153
echo "initializing opam... "
154154
check_installed opam
155-
if [ -z $INFER_OPAM_SWITCH ]; then
156-
# the user didn't pass an opam switch explicitly, set up a custom switch for infer
157-
INFER_OPAM_SWITCH=$INFER_OPAM_SWITCH_DEFAULT
155+
if [ "$INFER_OPAM_SWITCH" = "$INFER_OPAM_SWITCH_DEFAULT" ]; then
156+
# set up the custom infer switch
158157
setup_opam
158+
else
159+
opam switch set -j $NCPU $INFER_OPAM_SWITCH
159160
fi
160161
eval $(SHELL=bash opam config env --switch=$INFER_OPAM_SWITCH)
161162
echo "installing infer dependencies... "

0 commit comments

Comments
 (0)