diff --git a/build/linux/setup-pcl.sh b/build/linux/setup-pcl.sh old mode 100644 new mode 100755 diff --git a/cibuild.sh b/cibuild.sh index 6acc936a2b54c94b7a8ad14a4883ba555ea51248..cdf9df783a7aa60940c6f4470af17eef23dfe0b7 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -14,6 +14,7 @@ usage() XUNIT_VERSION=2.0.0-alpha-build2576 FULL_RUN=true OS_NAME=$(uname -s) + while [[ $# > 0 ]] do opt="$1" @@ -132,6 +133,57 @@ build_roslyn() fi } +# Install the specified Mono toolset from our Azure blob storage. +install_mono_toolset() +{ + TARGET=/tmp/$1 + echo "Installing Mono toolset $1" + if [ -d $TARGET ]; then + echo "Already installed" + return + fi + + pushd /tmp + + rm $TARGET 2>/dev/null + curl -O https://dotnetci.blob.core.windows.net/roslyn/$1.tar.bz2 + tar -jxf $1.tar.bz2 + if [ $? -ne 0 ]; then + echo "Unable to download toolset" + exit 1 + fi + + popd +} + +# This function will update the PATH variable to put the desired +# version of Mono ahead of the system one. +set_mono_path() +{ + if [ "$CUSTOM_MONO_PATH" != "" ]; then + if [ ! -d "$CUSTOM_MONO_PATH" ]; then + echo "Not a valid directory $CUSTOM_MONO_PATH" + exit 1 + fi + + echo "Using mono path $CUSTOM_MONO_PATH" + PATH=$CUSTOM_MONO_PATH:$PATH + return + fi + + if [ "$OS_NAME" = "Darwin" ]; then + MONO_TOOLSET_NAME=mono.mac.1 + elif [ "$OS_NAME" = "Linux" ]; then + MONO_TOOLSET_NAME=mono.linux.1 + else + echo "Error: Unsupported OS $OS_NAME" + exit 1 + fi + + install_mono_toolset $MONO_TOOLSET_NAME + PATH=/tmp/$MONO_TOOLSET_NAME/bin:$PATH +} + test_roslyn() { if [ "$FULL_RUN" != "true" ]; then @@ -170,23 +222,6 @@ if [ "$OS_NAME" = "Linux" ]; then FULL_RUN=false fi -if [ "$CUSTOM_MONO_PATH" != "" ]; then - if [ ! -d "$CUSTOM_MONO_PATH" ]; then - echo "Not a valid directory $CUSTOM_MONO_PATH" - exit 1 - fi - - echo "Using mono path $CUSTOM_MONO_PATH" - PATH=$CUSTOM_MONO_PATH:$PATH -else - echo Changing mono snapshot - . mono-snapshot mono/20150316155603 - if [ $? -ne 0 ]; then - echo Could not set mono snapshot - exit 1 - fi -fi - # NuGet on mono crashes about every 5th time we run it. This is causing # Linux runs to fail frequently enough that we need to employ a # temporary work around. @@ -194,6 +229,8 @@ echo Restoring NuGet packages run_nuget restore src/Roslyn.sln run_nuget install xunit.runners -PreRelease -Version $XUNIT_VERSION -OutputDirectory packages +set_mono_path +which mono compile_toolset save_toolset clean_roslyn diff --git a/docs/infrastructure/mono-toolset.md b/docs/infrastructure/mono-toolset.md new file mode 100644 index 0000000000000000000000000000000000000000..d9c714897944ced528aa1d1f7f78f4edbc76e252 --- /dev/null +++ b/docs/infrastructure/mono-toolset.md @@ -0,0 +1,29 @@ +Building a new Mono toolset +==== +This document describes building a new Mono toolset for use in our Mac or Linux Jenkins jobs. + +### Building +The new *toolset name* will be chosen as one of the following: + +- Linux: mono.linux.`` +- Mac: mono.mac.`` + +The value of *version number* will simply be the one number higher than the current version number of the toolset. + +To build the toolset execute the following: + +- Set `$PREFIX` to `/tmp/` +- Follow the remainder of the [Compiling Mono](http://www.mono-project.com/docs/compiling-mono/) instructions. +- Install the PCL references: `/build/linux/setup-pcl.sh /tmp/` +- Bzip the resulting directory. `tar -jcvf .tar.bz2 /tmp/` +- Upload the file to the Azure in the dotnetci storage account in the roslyn container. +- Send a PR to change [cibuild.sh](https://github.com/dotnet/roslyn/blob/master/cibuild.sh) to use the new toolset. + +Note: This process needs to be repeated for both Mac and Linux. + +### Existing toolsets +This table describes the existing Mono toolsets and the commit they were built from. + +| Version | Linux | Mac | +| --- | --- | --- | +| 1 | [43af8d475d853c8408ddaddbed4cfd61d2919780](https://github.com/jaredpar/mono/commit/43af8d475d853c8408ddaddbed4cfd61d2919780) | [43af8d475d853c8408ddaddbed4cfd61d2919780](https://github.com/jaredpar/mono/commit/43af8d475d853c8408ddaddbed4cfd61d2919780) |