diff --git a/build.sh b/build.sh index 30d20c0236273..fd659a3dd15ea 100755 --- a/build.sh +++ b/build.sh @@ -21,9 +21,7 @@ usage() echo " --bootstrap Implies --build-bootstrap and --use-bootstrap" } -this_dir="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "${this_dir}"/build/scripts/build-utils.sh -root_path="$(get_repo_dir)" +root_path="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" binaries_path="${root_path}"/Binaries bootstrap_path="${binaries_path}"/Bootstrap bootstrap_framework=netcoreapp2.0 @@ -34,11 +32,20 @@ build=false test_=false build_bootstrap=false use_bootstrap=false +stop_vbcscompiler=false # LTTNG is the logging infrastructure used by coreclr. Need this variable set # so it doesn't output warnings to the console. export LTTNG_HOME="$HOME" +if [[ $# = 0 ]] +then + usage + echo "" + echo "To build and test this repo, try: ./build.sh --restore --build --test" + exit 1 +fi + while [[ $# > 0 ]] do opt="$(echo "$1" | awk '{print tolower($0)}')" @@ -55,15 +62,15 @@ do build_configuration=Release shift 1 ;; - --restore) + --restore|-r) restore=true shift 1 ;; - --build) + --build|-b) build=true shift 1 ;; - --test) + --test|-t) test_=true shift 1 ;; @@ -80,6 +87,10 @@ do use_bootstrap=true shift 1 ;; + --stop-vbcscompiler) + stop_vbcscompiler=true + shift 1 + ;; *) usage exit 1 @@ -87,6 +98,8 @@ do esac done +source "${root_path}"/build/scripts/obtain_dotnet.sh + if [[ "$restore" == true ]] then "${root_path}"/build/scripts/restore.sh @@ -115,7 +128,19 @@ then dotnet build "${root_path}"/Compilers.sln ${build_args} "/bl:${binaries_path}/Build.binlog" fi +if [[ "${stop_vbcscompiler}" == true ]] +then + if [[ "${use_bootstrap}" == true ]] + then + echo "Stopping VBCSCompiler" + dotnet "${bootstrap_path}"/bincore/VBCSCompiler.dll -shutdown + else + echo "--stop-vbcscompiler requires --use-bootstrap. Aborting." + exit 1 + fi +fi + if [[ "${test_}" == true ]] then - "${root_path}"/build/scripts/tests.sh + "${root_path}"/build/scripts/tests.sh "${build_configuration}" fi diff --git a/build/linux/setup-certs.sh b/build/linux/setup-certs.sh deleted file mode 100644 index a510c1146e2a2..0000000000000 --- a/build/linux/setup-certs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if [ "$EUID" -ne 0 ]; then - echo "This script must be run as root" - exit 1 -fi - -# Install the certs so NuGet.exe can function correctly -mozroots --import --machine --sync -echo "Y" | certmgr -ssl https://go.microsoft.com -echo "Y" | certmgr -ssl https://nugetgallery.blob.core.windows.net -echo "Y" | certmgr -ssl https://nuget.org diff --git a/build/linux/setup-pcl.sh b/build/linux/setup-pcl.sh deleted file mode 100755 index be452ef3d8fca..0000000000000 --- a/build/linux/setup-pcl.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -usage() -{ - echo "Install PCL reference assemblies in a mono drop" - echo "setup-pcl.sh " -} - -XBUILD_FRAMEWORKS="$1"/lib/mono/xbuild-frameworks -if [ ! -d "$XBUILD_FRAMEWORKS" ]; then - echo "$XBUILD_FRAMEWORKS does not exist" - usage - exit 1 -fi - -PCL_NAME=PortableReferenceAssemblies-2014-04-14 -PCL_TARGET="$XBUILD_FRAMEWORKS"/.NETPortable - -# Now to install the PCL on the snapshot -pushd /tmp -wget http://storage.bos.xamarin.com/bot-provisioning/$PCL_NAME.zip -O /tmp/pcl.zip -unzip pcl.zip -popd - -if [ ! -d "/tmp/$PCL_NAME" ]; then - echo "Error: Did not unzip the PCL correctly" - exit 1 -fi - -echo "Installing to $PCL_TARGET" -mkdir "$PCL_TARGET" -cp -r /tmp/"$PCL_NAME"/* "$PCL_TARGET" - -rm -rf /tmp/"$PCL_NAME" -rm /tmp/pcl.zip - diff --git a/build/linux/setup-snapshot.sh b/build/linux/setup-snapshot.sh deleted file mode 100755 index 2daddd7590fa1..0000000000000 --- a/build/linux/setup-snapshot.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -if [ "$EUID" -ne 0 ]; then - echo "Error: This script must be run as root" - exit 1 -fi - -# Setup apt-get for grabbing mono snapshot builds -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -echo "deb http://jenkins.mono-project.com/repo/debian sid main" | tee /etc/apt/sources.list.d/mono-jenkins.list -apt-get update > /dev/null - -apt-get -y install mono-snapshot-latest - -. mono-snapshot mono -if [ ! -d "$MONO_PREFIX" ]; then - echo "Error: Mono snapshot did not load correctly" - exit 1 -fi - -# Now install the PCL assemblies on the snapshot -source setup-pcl "$MONO_PREFIX" diff --git a/build/linux/setup.sh b/build/linux/setup.sh deleted file mode 100755 index e4ab35f370f68..0000000000000 --- a/build/linux/setup.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -if [ "$EUID" -ne 0 ]; then - echo "This script must be run as root" - exit 1 -fi - -source setup-certs.sh -source setup-snapshot.sh - diff --git a/build/scripts/cibuild.sh b/build/scripts/cibuild.sh new file mode 100755 index 0000000000000..803e32a09f677 --- /dev/null +++ b/build/scripts/cibuild.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. + +set -e +set -u + +root_path="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" + +# $HOME is unset when running the mac unit tests. +if [[ -z "${HOME+x}" ]] +then + # Note that while ~ usually refers to $HOME, in the case where $HOME is unset, + # it looks up the current user's home dir, which is what we want. + # https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html + export HOME="$(cd ~ && pwd)" +fi + +# There's no reason to send telemetry or prime a local package cach when building +# in CI. +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + +echo "Building this commit:" +git show --no-patch --pretty=raw HEAD + +"${root_path}"/build.sh --restore --bootstrap --build --stop-vbcscompiler --test "$@" diff --git a/build/scripts/obtain_dotnet.sh b/build/scripts/obtain_dotnet.sh index bd81eab86b31e..32c54b49871aa 100755 --- a/build/scripts/obtain_dotnet.sh +++ b/build/scripts/obtain_dotnet.sh @@ -19,13 +19,13 @@ install_dotnet () { # check if the correct `dotnet` is already on the PATH if command -v dotnet >/dev/null 2>&1 then - if [[ "${FORCE_DOWNLOAD:-false}" != true && "$(dotnet --version)" = "${DOTNET_VERSION}" ]] + if [[ "${FORCE_DOWNLOAD:-false}" != true && "$(dotnet --version)" = "${DOTNET_SDK_VERSION}" ]] then return 0 fi fi - if [[ ! -x "${DOTNET_PATH}/dotnet" || "$(${DOTNET_PATH}/dotnet --version)" != "${DOTNET_VERSION}" ]] + if [[ ! -x "${DOTNET_PATH}/dotnet" || "$(${DOTNET_PATH}/dotnet --version)" != "${DOTNET_SDK_VERSION}" ]] then echo "Downloading and installing .NET CLI version ${DOTNET_SDK_VERSION} to ${DOTNET_PATH}" curl https://dot.net/v1/dotnet-install.sh | \ @@ -33,8 +33,6 @@ install_dotnet () { curl https://dot.net/v1/dotnet-install.sh | \ /usr/bin/env bash -s -- --version "${DOTNET_RUNTIME_VERSION}" --shared-runtime --install-dir "${DOTNET_PATH}" - else - echo "Skipping download of .NET CLI: Already installed at ${DOTNET_PATH}" fi export PATH="${DOTNET_PATH}:${PATH}" diff --git a/build/scripts/unzip.sh b/build/scripts/unzip.sh deleted file mode 100755 index 52ca69b40514f..0000000000000 --- a/build/scripts/unzip.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# Unzip reports a warning that zip contains backslashes and returns exit code 1 -# even though everything is good. Ignore exit code 1. - -unzip -nq "$1" -d "$2" -EC=$? -if [ $EC -eq 1 ] - then exit 0 - else exit $EC -fi diff --git a/build/unix/extra_unix_args.rsp b/build/unix/extra_unix_args.rsp deleted file mode 100644 index a4dd45895171f..0000000000000 --- a/build/unix/extra_unix_args.rsp +++ /dev/null @@ -1 +0,0 @@ -/publicsign diff --git a/cibuild.sh b/cibuild.sh index 438d9627297e0..c547a03bac910 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -2,70 +2,5 @@ # Copyright (c) .NET Foundation and contributors. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. -set -e -set -u - -usage() -{ - echo "Runs our integration suite on Linux" - echo "usage: cibuild.sh [options]" - echo "" - echo "Options" - echo " --debug Build Debug (default)" - echo " --release Build Release" -} - -THIS_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "${THIS_DIR}"/build/scripts/build-utils.sh -ROOT_PATH="$(get_repo_dir)" - -BUILD_CONFIGURATION=--debug - -# $HOME is unset when running the mac unit tests. -if [[ -z "${HOME+x}" ]] -then - # Note that while ~ usually refers to $HOME, in the case where $HOME is unset, - # it looks up the current user's home dir, which is what we want. - # https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html - export HOME="$(cd ~ && pwd)" -fi - -# There's no reason to send telemetry or prime a local package cach when building -# in CI. -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - -while [[ $# > 0 ]] -do - opt="$(echo "$1" | awk '{print tolower($0)}')" - case "$opt" in - -h|--help) - usage - exit 1 - ;; - --debug) - BUILD_CONFIGURATION=--debug - shift 1 - ;; - --release) - BUILD_CONFIGURATION=--release - shift 1 - ;; - *) - usage - exit 1 - ;; - esac -done - -echo Building this commit: -git show --no-patch --pretty=raw HEAD - -# obtain_dotnet.sh puts the right dotnet on the PATH -FORCE_DOWNLOAD=true -source "${ROOT_PATH}"/build/scripts/obtain_dotnet.sh - -"${ROOT_PATH}"/build.sh --restore --bootstrap --build --test "${BUILD_CONFIGURATION}" - -echo "Killing VBCSCompiler" -dotnet "${ROOT_PATH}"/Binaries/Bootstrap/bincore/VBCSCompiler.dll -shutdown +# Temporary file until the netci.groovy change to use the new location propogates +exec ./build/scripts/cibuild.sh "$@" diff --git a/netci.groovy b/netci.groovy index f8ea849755860..4deb5c6fba43f 100644 --- a/netci.groovy +++ b/netci.groovy @@ -105,7 +105,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Ubuntu 14.04 tests") steps { - shell("./cibuild.sh --debug") + shell("./build/scripts/cibuild.sh --debug") } } @@ -122,7 +122,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Ubuntu 16.04 tests") steps { - shell("./cibuild.sh --debug") + shell("./build/scripts/cibuild.sh --debug") } } @@ -139,7 +139,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Mac tests") steps { - shell("./cibuild.sh --debug") + shell("./build/scripts/cibuild.sh --debug") } }