2017-02-25 00:00:47 -08:00
|
|
|
#!/bin/bash
|
2016-10-11 12:21:40 -07:00
|
|
|
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2017-01-28 13:38:06 -08:00
|
|
|
if [ "$NO_CHANGE_USER" = "" ]; then
|
|
|
|
if [ "$LOCAL_USER_ID" != "" ]; then
|
|
|
|
useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
|
|
|
|
export HOME=/home/user
|
|
|
|
unset LOCAL_USER_ID
|
|
|
|
exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
|
|
|
|
fi
|
2016-10-11 12:21:40 -07:00
|
|
|
fi
|
|
|
|
|
2017-02-25 00:00:47 -08:00
|
|
|
ci_dir=`cd $(dirname $0) && pwd`
|
|
|
|
source "$ci_dir/shared.sh"
|
|
|
|
|
2017-01-13 15:35:58 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-sccache"
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules"
|
2017-02-10 22:59:40 +02:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-locked-deps"
|
2017-02-15 15:57:06 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-cargo-openssl-static"
|
2017-03-08 16:22:08 +03:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-clean-rebuild"
|
2017-01-13 15:35:58 -08:00
|
|
|
|
2017-02-14 09:54:58 -08:00
|
|
|
if [ "$DIST_SRC" = "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-dist-src"
|
|
|
|
fi
|
|
|
|
|
2017-01-13 15:35:58 -08:00
|
|
|
# If we're deploying artifacts then we set the release channel, otherwise if
|
|
|
|
# we're not deploying then we want to be sure to enable all assertions becauase
|
|
|
|
# we'll be running tests
|
|
|
|
#
|
|
|
|
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
|
|
|
|
# either automatically or manually.
|
2017-02-11 17:28:29 -08:00
|
|
|
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
|
2017-01-13 15:35:58 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=nightly"
|
2017-01-15 18:50:22 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
|
2017-01-13 15:35:58 -08:00
|
|
|
|
|
|
|
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
2017-02-11 17:28:29 -08:00
|
|
|
elif [ "$DEPLOY_ALT" != "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
2017-01-13 15:35:58 -08:00
|
|
|
fi
|
2017-01-18 16:04:22 -08:00
|
|
|
else
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-debug-assertions"
|
|
|
|
|
|
|
|
# In general we always want to run tests with LLVM assertions enabled, but not
|
|
|
|
# all platforms currently support that, so we have an option to disable.
|
|
|
|
if [ "$NO_LLVM_ASSERTIONS" = "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions"
|
|
|
|
fi
|
2016-11-16 12:31:19 -08:00
|
|
|
fi
|
|
|
|
|
2017-01-13 15:35:58 -08:00
|
|
|
$SRC/configure $RUST_CONFIGURE_ARGS
|
2017-02-25 00:00:47 -08:00
|
|
|
retry make prepare
|
2016-10-11 12:21:40 -07:00
|
|
|
|
|
|
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
|
|
|
ncpus=$(sysctl -n hw.ncpu)
|
|
|
|
else
|
2017-01-18 16:04:22 -08:00
|
|
|
ncpus=$(grep processor /proc/cpuinfo | wc -l)
|
2016-10-11 12:21:40 -07:00
|
|
|
fi
|
|
|
|
|
2017-02-25 00:00:47 -08:00
|
|
|
set -x
|
|
|
|
|
2016-12-31 17:42:40 -08:00
|
|
|
if [ ! -z "$SCRIPT" ]; then
|
|
|
|
sh -x -c "$SCRIPT"
|
2016-11-16 12:31:19 -08:00
|
|
|
else
|
2016-12-30 09:26:25 -08:00
|
|
|
make -j $ncpus tidy
|
|
|
|
make -j $ncpus
|
2016-12-31 17:42:40 -08:00
|
|
|
make $RUST_CHECK_TARGET -j $ncpus
|
2016-11-16 12:31:19 -08:00
|
|
|
fi
|