Clean up build scripts

Decompose into self-contained granular components
Provide reasonable defaults for cross cutting concerns, allowing for independent execution of steps
Start unifying Windows/Bash architecture

fix Bash CI scripts

dockerbuild.sh _common.sh path

Add missing restore-packages.sh

Copy/paste issues

Quote $SOURCE
fix .gitignore

PR Feedback

Merge in @SridarMS's work to avoid redownloading DNX

enabling build of dotnet-build

merge in @SridharMS's CentOS changes

Enable building FSC

enable restoring specific subdirectories

Fix dnx version check

Add missed dependency

Fix pathing to tests

Match Linux build version to Windows, fixing linux tests as a side effect.

workaround for coreclr#2215

fix pathing issue

disable building in docker

BUILD_IN_DOCKER was set, somehow...

fix headers
This commit is contained in:
Piotr Puszkiewicz 2015-12-28 11:47:21 -08:00
parent d1a257bff7
commit 4b217db9c0
66 changed files with 1163 additions and 242 deletions

7
.gitignore vendored
View file

@ -12,6 +12,9 @@
# OSX Packaging temp files # OSX Packaging temp files
*.pkg *.pkg
# OS X Device Services Store
.DS_Store
# CMake generated files # CMake generated files
cmake/ cmake/
@ -255,3 +258,7 @@ _Pvt_Extensions
# FAKE - F# Make # FAKE - F# Make
.fake/ .fake/
# Exceptions
# Build Scripts
!scripts/build/

BIN
bin Normal file

Binary file not shown.

View file

@ -3,4 +3,4 @@
REM Copyright (c) .NET Foundation and contributors. All rights reserved. REM Copyright (c) .NET Foundation and contributors. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information. REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
powershell -NoProfile -NoLogo -Command "%~dp0scripts\build.ps1 %*; exit $LastExitCode;" powershell -NoProfile -NoLogo -Command "%~dp0scripts\build\build.ps1 %*; exit $LastExitCode;"

View file

@ -12,62 +12,26 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/scripts/_common.sh" source "$DIR/scripts/common/_common.sh"
source "$REPOROOT/scripts/build/process-args.sh"
for i in "$@"
do
lowerI="$(echo $i | awk '{print tolower($0)}')"
case $lowerI in
release)
export CONFIGURATION=Release
;;
debug)
export CONFIGURATION=Debug
;;
offline)
export OFFLINE=true
;;
*)
esac
done
[ -z "$CONFIGURATION" ] && CONFIGURATION=Debug
if [ ! -z "$OFFLINE" ]; then
header " - Offline Build - "
fi
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
export DOTNET_INSTALL_DIR=$DIR/.dotnet_stage0/$RID
[ -d $DOTNET_INSTALL_DIR ] || mkdir -p $DOTNET_INSTALL_DIR
export PATH=$DOTNET_INSTALL_DIR/bin:$PATH
# UTC Timestamp of the last commit is used as the build number. This is for easy synchronization of build number between Windows, OSX and Linux builds.
LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
major=1
minor=0
# no. of days since epoch
build=0
revision=$LAST_COMMIT_TIMESTAMP
export DOTNET_BUILD_VERSION=$major.$minor.$build.$revision
header "Building dotnet tools version $DOTNET_BUILD_VERSION - $CONFIGURATION"
# splitting build from package is required to work around dotnet/coreclr#2215
# once that is fixed, we should remove the NOPACKAGE flag and do the full build either in
# or out of docker.
if [ ! -z "$BUILD_IN_DOCKER" ]; then if [ ! -z "$BUILD_IN_DOCKER" ]; then
export BUILD_COMMAND="/opt/code/scripts/compile.sh" export BUILD_COMMAND="/opt/code/scripts/build/build.sh NOPACKAGE"
$DIR/scripts/docker/dockerbuild.sh $REPOROOT/scripts/docker/dockerbuild.sh
else else
$DIR/scripts/compile.sh $REPOROOT/scripts/build/build.sh NOPACKAGE
fi fi
if [ ! -z "$PACKAGE_IN_DOCKER" ]; then if [ ! -z "$PACKAGE_IN_DOCKER" ]; then
export BUILD_COMMAND="/opt/code/scripts/package/package.sh" export BUILD_COMMAND="/opt/code/scripts/package/package-native.sh"
$DIR/scripts/docker/dockerbuild.sh $REPOROOT/scripts/docker/dockerbuild.sh
else else
$DIR/scripts/package/package.sh $REPOROOT/scripts/package/package.sh
fi fi

View file

@ -9,7 +9,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -2,7 +2,7 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
param( param(
[string]$toolsDir = $(throw "Specify the full path to the directory which has dotnet tool"), [Parameter(Mandatory=$true)][string]$toolsDir,
[string]$versionSuffix = "" [string]$versionSuffix = ""
) )
@ -13,7 +13,7 @@ if ($versionSuffix -ne "") {
$versionArg = "--version-suffix $VersionSuffix" $versionArg = "--version-suffix $VersionSuffix"
} }
. "$PSScriptRoot\..\..\scripts\_common.ps1" . "$PSScriptRoot\..\..\scripts\common\_common.ps1"
$IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate" $IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate"
$PackagesDir = "$RepoRoot\artifacts\packages" $PackagesDir = "$RepoRoot\artifacts\packages"

View file

@ -8,7 +8,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -2,10 +2,10 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
param( param(
[string]$inputDir = $(throw "Specify the full path to the directory which needs to be harvested") [Parameter(Mandatory=$true)][string]$inputDir
) )
. "$PSScriptRoot\..\..\scripts\_common.ps1" . "$PSScriptRoot\..\..\scripts\common\_common.ps1"
$DotnetMSIOutput = "" $DotnetMSIOutput = ""
$WixRoot = "" $WixRoot = ""
@ -124,39 +124,33 @@ $WixRoot = AcquireWixTools
if([string]::IsNullOrEmpty($WixRoot)) if([string]::IsNullOrEmpty($WixRoot))
{ {
return -1 Exit -1
} }
if(-Not (RunHeat)) if(-Not (RunHeat))
{ {
return -1 Exit -1
} }
if(-Not (RunCandle)) if(-Not (RunCandle))
{ {
return -1 Exit -1
} }
if(-Not (RunLight)) if(-Not (RunLight))
{ {
return -1 Exit -1
} }
if(!(Test-Path $DotnetMSIOutput)) if(!(Test-Path $DotnetMSIOutput))
{ {
throw "Unable to create the dotnet msi." throw "Unable to create the dotnet msi."
return -1 Exit -1
} }
Write-Host -ForegroundColor Green "Successfully created dotnet MSI - $DotnetMSIOutput" Write-Host -ForegroundColor Green "Successfully created dotnet MSI - $DotnetMSIOutput"
& $PSScriptRoot\testmsi.ps1 -inputMsi $DotnetMSIOutput _ $PSScriptRoot\testmsi.ps1 @("$DotnetMSIOutput")
if($LastExitCode -ne 0)
{
Write-Host -ForegroundColor Red "Msi testing failed."
Exit 1
}
$PublishScript = Join-Path $PSScriptRoot "..\..\scripts\publish\publish.ps1" $PublishScript = Join-Path $PSScriptRoot "..\..\scripts\publish\publish.ps1"
& $PublishScript -file $DotnetMSIOutput & $PublishScript -file $DotnetMSIOutput

View file

@ -2,10 +2,10 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
param( param(
[string]$inputMsi = $(throw "Specify the full path to the msi which needs to be tested") [Parameter(Mandatory=$true)][string]$inputMsi
) )
. "$PSScriptRoot\..\..\scripts\_common.ps1" . "$PSScriptRoot\..\..\scripts\common\_common.ps1"
function Test-Administrator function Test-Administrator
{ {

View file

@ -1,70 +0,0 @@
#
# 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.
#
param(
[string]$Configuration="Debug",
[switch]$Offline)
. "$PSScriptRoot\_common.ps1"
$ErrorActionPreference="Stop"
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
$env:DOTNET_INSTALL_DIR="$(Convert-Path "$PSScriptRoot\..")\.dotnet_stage0\win7-x64"
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
{
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
}
$env:PATH = "$env:DOTNET_INSTALL_DIR\cli\bin;$env:PATH"
$VersionSuffix = ""
if (!$env:DOTNET_BUILD_VERSION) {
# Get the timestamp of the most recent commit
$timestamp = git log -1 --format=%ct
$commitTime = [timespan]::FromSeconds($timestamp)
$majorVersion = 1
$minorVersion = 0
$buildnumber = 0
$revnumber = $commitTime.TotalSeconds
$VersionSuffix = "dev-$revnumber"
$env:DOTNET_BUILD_VERSION = "$majorVersion.$minorVersion.$buildnumber.$revnumber"
}
Write-Host -ForegroundColor Green "*** Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration ***"
if ($Offline)
{
Write-Host -ForegroundColor Yellow " - Offline Build -"
}
& "$PSScriptRoot\compile.ps1" -Configuration:$Configuration -Offline:$Offline
if (!$?) {
Write-Host "Building dotnet tools finished with errors."
Exit 1
}
Write-Host -ForegroundColor Green "*** Packaging dotnet ***"
& "$PSScriptRoot\package\package.ps1"
if (!$?) {
Write-Host "Packaging dotnet finished with errors."
Exit 1
}
Write-Host -ForegroundColor Green "*** Generating dotnet MSI ***"
& "$RepoRoot\packaging\windows\generatemsi.ps1" $Stage2Dir
if (!$?) {
Write-Host "Generating dotnet MSI finished with errors."
Exit 1
}
Write-Host -ForegroundColor Green "*** Generating NuGet packages ***"
& "$RepoRoot\packaging\nuget\package.ps1" $Stage2Dir\bin $VersionSuffix
if (!$?) {
Write-Host "Generating NuGet packages finished with errors."
Exit 1
}

View file

@ -10,7 +10,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/../.." && pwd )" REPOROOT="$( cd -P "$DIR/../.." && pwd )"

48
scripts/build/build.ps1 Normal file
View file

@ -0,0 +1,48 @@
#
# 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.
#
param(
[string]$Configuration="Debug",
[switch]$Offline)
$ErrorActionPreference="Stop"
. "$PSScriptRoot\..\common\_common.ps1"
_ "$RepoRoot\scripts\build\generate-version.ps1"
header "Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration"
header "Checking Pre-Reqs"
_ "$RepoRoot\scripts\test\check-prereqs.ps1"
header "Restoring Tools and Packages"
if ($Offline){
info "Skipping Tools and Packages dowlnoad: Offline build"
}
else {
_ "$RepoRoot\scripts\obtain\install-tools.ps1"
_ "$RepoRoot\scripts\build\restore-packages.ps1"
}
header "Compiling"
_ "$RepoRoot\scripts\compile\compile.ps1" @("$Configuration")
header "Running Tests"
_ "$RepoRoot\scripts\test\runtests.ps1"
header "Validating Dependencies"
_ "$RepoRoot\scripts\test\validate-dependencies.ps1"
header "Generating zip package"
_ "$RepoRoot\scripts\package\package.ps1"
header "Generating dotnet MSI"
_ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
header "Generating NuGet packages"
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$VersionSuffix")

61
scripts/build/build.sh Executable file
View file

@ -0,0 +1,61 @@
#!/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 OFFLINE environment variable to build offline
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
source "$REPOROOT/scripts/build/generate-version.sh"
header "Building dotnet tools version $DOTNET_BUILD_VERSION - $CONFIGURATION"
header "Checking Pre-Reqs"
$REPOROOT/scripts/test/check-prereqs.sh
header "Restoring Tools and Packages"
if [ ! -z "$OFFLINE" ]; then
info "Skipping Tools and Package Download: Offline build"
else
$REPOROOT/scripts/obtain/install-tools.sh
$REPOROOT/scripts/build/restore-packages.sh
fi
header "Compiling"
$REPOROOT/scripts/compile/compile.sh
# Skipping tests for centos
# tracked by issue - https://github.com/dotnet/corefx/issues/5066
if [ "$OSNAME" != "centos" ]; then
# Run tests on the stage2 output
header "Testing stage2..."
DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $REPOROOT/scripts/test/runtests.sh
else
header "Skipping tests on CentOS due to corefx issue 5066"
fi
header "Validating Dependencies"
$REPOROOT/scripts/test/validate-dependencies.sh
header "Generating tarball"
$REPOROOT/scripts/package/package.sh
if [ ! -z "$NOPACKAGE" ]; then
header "Generating Native Installer"
$REPOROOT/scripts/package/package-native.sh
else
header "Skipping packaging"
fi

View file

@ -1,14 +1,22 @@
#!/usr/bin/env bash #!/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.
#
# This file encapsulates the temporary steps to build the dotnet-compile-native command successfully set -e
# The AppDepSDK package is a temporary artifact until we have CoreRT assemblies published to Nuget
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source $SCRIPT_DIR/../_common.sh source "$DIR/../common/_common.sh"
REPO_ROOT="$SCRIPT_DIR/../.." APPDEPS_PROJECT_DIR="$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Native/appdep"
APPDEPS_PROJECT_DIR=$REPO_ROOT/src/Microsoft.DotNet.Tools.Compiler.Native/appdep
# Get Absolute Output Dir # Get Absolute Output Dir
pushd $1 pushd $1

View file

@ -0,0 +1,19 @@
#
# 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.
#
#. "$PSScriptRoot\..\common\_common.ps1"
# Get the timestamp of the most recent commit
$timestamp = git log -1 --format=%ct
$commitTime = [timespan]::FromSeconds($timestamp)
$majorVersion = 1
$minorVersion = 0
$buildnumber = 0
$revnumber = $commitTime.TotalSeconds
$VersionSuffix = "dev-$revnumber"
$env:DOTNET_BUILD_VERSION = "$majorVersion.$minorVersion.$buildnumber.$revnumber"

View file

@ -0,0 +1,10 @@
#!/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.
#
# UTC Timestamp of the last commit is used as the build number. This is for easy synchronization of build number between Windows, OSX and Linux builds.
LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
export DOTNET_BUILD_VERSION=1.0.0-dev-$LAST_COMMIT_TIMESTAMP
echo "Version: $DOTNET_BUILD_VERSION"

View file

@ -3,18 +3,18 @@
# Copyright (c) .NET Foundation and contributors. All rights reserved. # 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. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
set -e set -e
SOURCE="${BASH_SOURCE[0]}" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$SCRIPT_DIR/../.." && pwd )"
source "$SCRIPT_DIR/../_common.sh" source "$DIR/../common/_common.sh"
echo "Copy From: $1" echo "Copy From: $1"
echo " To: $STAGE2_DIR/bin/" echo " To: $STAGE2_DIR/bin/"

25
scripts/build/process-args.sh Executable file
View file

@ -0,0 +1,25 @@
#!/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.
#
for i in "$@"
do
lowerI="$(echo $i | awk '{print tolower($0)}')"
case $lowerI in
release)
export CONFIGURATION=Release
;;
debug)
export CONFIGURATION=Debug
;;
offline)
export OFFLINE=true
;;
nopackage)
export NOPACKAGE=true
;;
*)
esac
done

View file

@ -0,0 +1,18 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
# Restore packages
header "Restoring packages"
& "$DnxRoot\dnu" restore "$RepoRoot\src" --quiet --runtime "$Rid" --no-cache --parallel
& "$DnxRoot\dnu" restore "$RepoRoot\test" --quiet --runtime "$Rid" --no-cache --parallel
& "$DnxRoot\dnu" restore "$RepoRoot\tools" --quiet --runtime "$Rid" --no-cache --parallel
$oldErrorAction=$ErrorActionPreference
$ErrorActionPreference="SilentlyContinue"
& "$DnxRoot\dnu" restore "$RepoRoot\testapp" --quiet --runtime "$Rid" --no-cache --parallel 2>&1 | Out-Null
$ErrorActionPreference=$oldErrorAction

View file

@ -0,0 +1,25 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
header "Restoring packages"
$DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime "$RID" --no-cache --parallel
$DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime "$RID" --no-cache --parallel
$DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime "$RID" --no-cache --parallel
set +e
$DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime "$RID" --no-cache --parallel >/dev/null 2>&1
set -e

View file

@ -10,11 +10,11 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$SCRIPT_DIR/_common.sh" source "$SCRIPT_DIR/common/_common.sh"
# Tell install scripts to skip pre-req check since the CI has the pre-reqs but not ldconfig it seems # Tell install scripts to skip pre-req check since the CI has the pre-reqs but not ldconfig it seems
# Also, install to a directory under the repo root since we don't have permission to work elsewhere # Also, install to a directory under the repo root since we don't have permission to work elsewhere
@ -41,6 +41,7 @@ if [[ "$OSNAME" == "ubuntu" ]]; then
export DOTNET_BUILD_CONTAINER_NAME="$container_name" export DOTNET_BUILD_CONTAINER_NAME="$container_name"
export PACKAGE_IN_DOCKER="true" export PACKAGE_IN_DOCKER="true"
unset BUILD_IN_DOCKER
$SCRIPT_DIR/../build.sh $@ $SCRIPT_DIR/../build.sh $@
else else

21
scripts/common/_clang.sh Normal file
View file

@ -0,0 +1,21 @@
#!/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 up the environment to be used for building with clang.
if which "clang-3.5" > /dev/null 2>&1; then
export CC="$(which clang-3.5)"
export CXX="$(which clang++-3.5)"
elif which "clang-3.6" > /dev/null 2>&1; then
export CC="$(which clang-3.6)"
export CXX="$(which clang++-3.6)"
elif which clang > /dev/null 2>&1; then
export CC="$(which clang)"
export CXX="$(which clang++)"
else
error "Unable to find Clang Compiler"
error "Install clang-3.5 or clang3.6"
exit 1
fi

View file

@ -3,17 +3,21 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
. $PSScriptRoot\_utility.ps1
$Rid = "win7-x64" $Rid = "win7-x64"
$Tfm = "dnxcore50" $Tfm = "dnxcore50"
$RepoRoot = Convert-Path "$PSScriptRoot\..\.."
$RepoRoot = Convert-Path "$PSScriptRoot\.."
$OutputDir = "$RepoRoot\artifacts\$Rid" $OutputDir = "$RepoRoot\artifacts\$Rid"
$DnxDir = "$OutputDir\dnx"
$DnxRoot = "$DnxDir\bin"
$Stage1Dir = "$OutputDir\stage1" $Stage1Dir = "$OutputDir\stage1"
$Stage2Dir = "$OutputDir\stage2" $Stage2Dir = "$OutputDir\stage2"
$HostDir = "$OutputDir\corehost" $HostDir = "$OutputDir\corehost"
$PackageDir = "$RepoRoot\artifacts\packages\dnvm" $PackageDir = "$RepoRoot\artifacts\packages\dnvm"
function header([string]$message) # Set reasonable defaults for unset variables
{ setEnvIfDefault "DOTNET_INSTALL_DIR" "$(Convert-Path "$PSScriptRoot\..")\.dotnet_stage0\win7-x64"
Write-Host -ForegroundColor Green "*** $message ***" setEnvIfDefault "DOTNET_BUILD_VERSION" "0.1.0.0"
} setPathAndHomeIfDefault "$Stage2Dir"
setEnvIfDefault "CONFIGURATION" "Debug"

37
scripts/common/_common.sh Normal file
View file

@ -0,0 +1,37 @@
#
# 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.
#
COMMONSOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
COMMONSOURCE="$(readlink "$COMMONSOURCE")"
[[ $COMMONSOURCE != /* ]] && COMMONSOURCE="$COMMONDIR/$COMMONSOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
source "$DIR/_clang.sh"
source "$DIR/_prettyprint.sh"
source "$DIR/_rid.sh"
# TODO: Replace this with a dotnet generation
export TFM=dnxcore50
export REPOROOT=$(cd $DIR/../.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx
export DNX_ROOT=$DNX_DIR/bin
export STAGE1_DIR=$OUTPUT_ROOT/stage1
export STAGE2_DIR=$OUTPUT_ROOT/stage2
export HOST_DIR=$OUTPUT_ROOT/corehost
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$RID
[ -z "$DOTNET_BUILD_VERSION" ] && export DOTNET_BUILD_VERSION=0.1.0.0
[ -z "$DOTNET_HOME" ] && export DOTNET_HOME=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
# if the conditional set is the last command in this file AND
# the condition is false then the program exits here. Seems like
# a bug in BASH... or indication that there is more to learn about Linux
# the below line is a hack that works around this issue
a=1+1

View file

@ -1,18 +1,9 @@
#!/usr/bin/env bash
# #
# Copyright (c) .NET Foundation and contributors. All rights reserved. # 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. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
# Source this to add some fancy stuff to your scripts
COMMONSOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
COMMONSOURCE="$(readlink "$COMMONSOURCE")"
[[ $COMMONSOURCE != /* ]] && COMMONSOURCE="$COMMONDIR/$COMMONSOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
# Detect build servers # Detect build servers
if [[ ! -z "$JENKINS_URL" || ! -z "$BUILD_BUILDID" ]]; then if [[ ! -z "$JENKINS_URL" || ! -z "$BUILD_BUILDID" ]]; then
# Jenkins or VSO build, disable colors because they make things gross. # Jenkins or VSO build, disable colors because they make things gross.
@ -69,36 +60,4 @@ die()
local text=$1 local text=$1
error "$text" error "$text"
exit 1 exit 1
} }
export UNAME=$(uname)
if [ -z "$RID" ]; then
if [ "$UNAME" == "Darwin" ]; then
export OSNAME=osx
export RID=osx.10.10-x64
elif [ "$UNAME" == "Linux" ]; then
# Detect Distro
if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
export OSNAME=ubuntu
export RID=ubuntu.14.04-x64
elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
export OSNAME=centos
export RID=centos.7.1-x64
else
error "unknown Linux Distro" 1>&2
fi
else
error "unknown OS: $UNAME" 1>&2
exit 1
fi
fi
export REPOROOT=$(cd $COMMONDIR/.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export STAGE1_DIR=$OUTPUT_ROOT/stage1
export STAGE2_DIR=$OUTPUT_ROOT/stage2
export HOST_DIR=$OUTPUT_ROOT/corehost
# TODO: Replace this with a dotnet generation
export TFM=dnxcore50

37
scripts/common/_rid.sh Normal file
View file

@ -0,0 +1,37 @@
#!/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.
#
export UNAME=$(uname)
if [ -z "$RID" ]; then
if [ "$UNAME" == "Darwin" ]; then
export OSNAME=osx
if [ -n "$(sw_vers -productVersion | grep 10.10.)" ]; then
export RID=osx.10.10-x64
elif [ -n "$(sw_vers -productVersion | grep 10.11.)" ]; then
export RID=osx.10.10-x64
else
error "unknown OS X: $(sw_vers -productVersion)" 1>&2
fi
elif [ "$UNAME" == "Linux" ]; then
# Detect Distro
if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
export OSNAME=ubuntu
export RID=ubuntu.14.04-x64
elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
export OSNAME=centos
export RID=centos.7.1-x64
else
error "unknown Linux Distro" 1>&2
fi
else
error "unknown OS: $UNAME" 1>&2
fi
fi
if [ -z "$RID" ]; then
exit 1
fi

View file

@ -0,0 +1,63 @@
#
# 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.
#
function header([string]$message)
{
Write-Host -ForegroundColor Green "*** $message ***"
}
function info([string]$message)
{
Write-Host -ForegroundColor Yellow "*** $message ***"
}
function error([string]$message)
{
Write-Host -ForegroundColor Red "$message"
}
function setEnvIfDefault([string]$envVarName, [string]$value)
{
If ([Environment]::GetEnvironmentVariable($envVarName) -eq $null)
{
[Environment]::SetEnvironmentVariable($envVarName, $value)
}
}
function setPathAndHomeIfDefault([string]$rootPath)
{
If ($env:DOTNET_HOME -eq $null)
{
$env:DOTNET_HOME=$rootPath
$env:PATH="$rootPath\bin;$env:PATH"
}
}
function _([string]$command)
{
& "$command"
if (!$?) {
error "Command Failed: '& $command'"
Exit 1
}
}
function _([string]$command, $arguments)
{
& "$command" @arguments
if (!$?) {
error "Command Failed: '& $command'"
Exit 1
}
}
function _cmd([string]$command)
{
cmd /c "$command"
if (!$?) {
error "Command Failed: 'cmd /c $command'"
Exit 1
}
}

View file

@ -10,7 +10,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -0,0 +1,37 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
header "Building corehost"
pushd "$RepoRoot\src\corehost"
try {
if (!(Test-Path "cmake\$Rid")) {
mkdir "cmake\$Rid" | Out-Null
}
cd "cmake\$Rid"
cmake ..\.. -G "Visual Studio 14 2015 Win64"
$pf = $env:ProgramFiles
if (Test-Path "env:\ProgramFiles(x86)") {
$pf = (cat "env:\ProgramFiles(x86)")
}
& "$pf\MSBuild\14.0\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration="$Configuration"
if (!$?) {
Write-Host "Command failed: $pf\MSBuild\14.0\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration="$Configuration"
Exit 1
}
if (!(Test-Path $HostDir)) {
mkdir $HostDir | Out-Null
}
cp "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.exe" $HostDir
if (Test-Path "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.pdb")
{
cp "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.pdb" $HostDir
}
} finally {
popd
}

View file

@ -0,0 +1,28 @@
#!/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.
#
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
header "Building corehost"
pushd "$REPOROOT/src/corehost" 2>&1 >/dev/null
[ -d "cmake/$RID" ] || mkdir -p "cmake/$RID"
cd "cmake/$RID"
cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=$CONFIGURATION
make
# Publish to artifacts
[ -d "$HOST_DIR" ] || mkdir -p $HOST_DIR
cp "$REPOROOT/src/corehost/cmake/$RID/corehost" $HOST_DIR
popd 2>&1 >/dev/null

View file

@ -0,0 +1,17 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
header "Compiling stage1 dotnet using downloaded stage0 ..."
$StartPath = $env:PATH
$env:PATH = "$env:DOTNET_INSTALL_DIR\cli\bin;$StartPath"
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage1Dir","$RepoRoot","$HostDir")
# Copy in the dotnet-restore script
cp "$RepoRoot\scripts\dotnet-restore.cmd" "$Stage1Dir\bin\dotnet-restore.cmd"
$env:PATH=$StartPath

View file

@ -0,0 +1,26 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
export StartPath=$PATH
export PATH=$DOTNET_INSTALL_DIR/bin:$PATH
# Build Stage 1
header "Building stage1 dotnet using downloaded stage0 ..."
OUTPUT_DIR=$STAGE1_DIR $REPOROOT/scripts/compile/compile-stage.sh
export PATH=$StartPath

View file

@ -0,0 +1,30 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
header "Compiling stage2 dotnet using stage1 ..."
$StartPath = $env:PATH
$env:PATH = "$Stage1Dir\bin;$env:PATH"
# Compile
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage2Dir","$RepoRoot","$HostDir")
# Crossgen Roslyn
header "Crossgening Roslyn compiler ..."
_cmd "$RepoRoot\scripts\crossgen\crossgen_roslyn.cmd ""$Stage2Dir"""
# Copy dnx into stage 2
cp -rec "$DnxRoot\" "$Stage2Dir\bin\dnx\"
# Copy in the dotnet-restore script
cp "$RepoRoot\scripts\dotnet-restore.cmd" "$Stage2Dir\bin\dotnet-restore.cmd"
# Copy in AppDeps
$env:PATH = "$Stage2Dir\bin;$StartPath"
header "Acquiring Native App Dependencies"
_cmd "$RepoRoot\scripts\build\build_appdeps.cmd ""$Stage2Dir"""
$env:PATH=$StartPath

View file

@ -0,0 +1,55 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
# Use stage1 tools
export StartPath=$PATH
export DOTNET_TOOLS=$STAGE1_DIR
export PATH=$STAGE1_DIR/bin:$PATH
# Build Stage 2
header "Building stage2 dotnet using just-built stage1 ..."
OUTPUT_DIR=$STAGE2_DIR $REPOROOT/scripts/compile/compile-stage.sh
echo "Crossgenning Roslyn compiler ..."
$REPOROOT/scripts/crossgen/crossgen_roslyn.sh "$STAGE2_DIR/bin"
# Make Stage 2 Folder Accessible
chmod -R a+r $REPOROOT
# Copy DNX in to stage2
cp -R $DNX_ROOT $STAGE2_DIR/bin/dnx
# Copy and CHMOD the dotnet-restore script
cp $REPOROOT/scripts/dotnet-restore.sh $STAGE2_DIR/bin/dotnet-restore
chmod a+x $STAGE2_DIR/bin/dotnet-restore
# No compile native support in centos yet
# https://github.com/dotnet/cli/issues/453
if [ "$OSNAME" != "centos" ]; then
# Copy in AppDeps
header "Acquiring Native App Dependencies"
DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $REPOROOT/scripts/build/build_appdeps.sh "$STAGE2_DIR/bin"
fi
# Stamp the output with the commit metadata
COMMIT=$(git rev-parse HEAD)
echo $COMMIT > $STAGE2_DIR/.version
echo $DOTNET_BUILD_VERSION >> $STAGE2_DIR/.version
export DOTNET_HOME=$STAGE2_DIR
export DOTNET_TOOLS=$STAGE2_DIR

View file

@ -0,0 +1,86 @@
#
# 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.
#
param(
[Parameter(Mandatory=$true)][string]$Tfm,
[Parameter(Mandatory=$true)][string]$Rid,
[Parameter(Mandatory=$true)][string]$Configuration,
[Parameter(Mandatory=$true)][string]$OutputDir,
[Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$HostDir)
$Projects = @(
"Microsoft.DotNet.Cli",
"Microsoft.DotNet.Tools.Builder",
"Microsoft.DotNet.Tools.Compiler",
"Microsoft.DotNet.Tools.Compiler.Csc",
"Microsoft.DotNet.Tools.Compiler.Fsc",
"Microsoft.DotNet.Tools.Compiler.Native",
"Microsoft.DotNet.Tools.New",
"Microsoft.DotNet.Tools.Pack",
"Microsoft.DotNet.Tools.Publish",
"Microsoft.DotNet.Tools.Repl",
"Microsoft.DotNet.Tools.Repl.Csi",
"Microsoft.DotNet.Tools.Resgen",
"Microsoft.DotNet.Tools.Run",
"Microsoft.DotNet.Tools.Test"
)
$BinariesForCoreHost = @(
"csi"
"csc"
"vbc"
)
$FilesToClean = @(
"README.md"
"Microsoft.DotNet.Runtime.exe"
"Microsoft.DotNet.Runtime.dll"
"Microsoft.DotNet.Runtime.deps"
"Microsoft.DotNet.Runtime.pdb"
)
if (Test-Path $OutputDir) {
del -rec -for $OutputDir
}
$RuntimeOutputDir = "$OutputDir\runtime\coreclr"
# Publish each project
$Projects | ForEach-Object {
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
exit 1
}
}
# Publish the runtime
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
Exit 1
}
# Clean up bogus additional files
$FilesToClean | ForEach-Object {
$path = Join-Path $RuntimeOutputDir $_
if (Test-Path $path) {
del -for $path
}
}
# Copy the runtime app-local for the tools
cp -rec "$RuntimeOutputDir\*" "$OutputDir\bin"
# Deploy the CLR host to the output
cp "$HostDir\corehost.exe" "$OutputDir\bin"
# corehostify externally-provided binaries (csc, vbc, etc.)
$BinariesForCoreHost | ForEach-Object {
mv $OutputDir\bin\$_.exe $OutputDir\bin\$_.dll
cp $OutputDir\bin\corehost.exe $OutputDir\bin\$_.exe
}

View file

@ -0,0 +1,94 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/../.." && pwd )"
source "$DIR/../common/_common.sh"
[ ! -z "$TFM" ] || die "Missing required environment variable TFM"
[ ! -z "$RID" ] || die "Missing required environment variable RID"
[ ! -z "$CONFIGURATION" ] || die "Missing required environment variable CONFIGURATION"
[ ! -z "$OUTPUT_DIR" ] || die "Missing required environment variable OUTPUT_DIR"
[ ! -z "$HOST_DIR" ] || die "Missing required environment variable HOST_DIR"
PROJECTS=( \
Microsoft.DotNet.Cli \
Microsoft.DotNet.Tools.Builder \
Microsoft.DotNet.Tools.Compiler \
Microsoft.DotNet.Tools.Compiler.Csc \
Microsoft.DotNet.Tools.Compiler.Fsc \
Microsoft.DotNet.Tools.Compiler.Native \
Microsoft.DotNet.Tools.New \
Microsoft.DotNet.Tools.Pack \
Microsoft.DotNet.Tools.Publish \
Microsoft.DotNet.Tools.Repl \
Microsoft.DotNet.Tools.Repl.Csi \
Microsoft.DotNet.Tools.Resgen \
Microsoft.DotNet.Tools.Run \
Microsoft.DotNet.Tools.Test \
)
BINARIES_FOR_COREHOST=( \
csi \
csc \
vbc \
)
FILES_TO_CLEAN=( \
README.md \
Microsoft.DotNet.Runtime \
Microsoft.DotNet.Runtime.dll \
Microsoft.DotNet.Runtime.deps \
Microsoft.DotNet.Runtime.pdb \
)
# Clean up output
[ -d "$OUTPUT_DIR" ] && rm -Rf "$OUTPUT_DIR"
RUNTIME_OUTPUT_DIR="$OUTPUT_DIR/runtime/coreclr"
for project in ${PROJECTS[@]}
do
echo dotnet publish --framework "$TFM" --runtime "$RID" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --framework "$TFM" --runtime "$RID" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
done
# Bring in the runtime
dotnet publish --framework "$TFM" --runtime "$RID" --output "$RUNTIME_OUTPUT_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
# Clean up bogus additional files
for file in ${FILES_TO_CLEAN[@]}
do
[ -e "$RUNTIME_OUTPUT_DIR/$file" ] && rm "$RUNTIME_OUTPUT_DIR/$file"
done
# Copy the runtime app-local for the tools
cp -R $RUNTIME_OUTPUT_DIR/* $OUTPUT_DIR/bin
# Deploy CLR host to the output
cp "$HOST_DIR/corehost" "$OUTPUT_DIR/bin"
# corehostify externally-provided binaries (csc, vbc, etc.)
for binary in ${BINARIES_FOR_COREHOST[@]}
do
cp $OUTPUT_DIR/bin/corehost $OUTPUT_DIR/bin/$binary
mv $OUTPUT_DIR/bin/${binary}.exe $OUTPUT_DIR/bin/${binary}.dll
done
cd $OUTPUT_DIR
# Fix up permissions. Sometimes they get dropped with the wrong info
find . -type f | xargs chmod 644
$REPOROOT/scripts/build/fix-mode-flags.sh

View file

@ -0,0 +1,26 @@
#
# 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.
#
param([string]$Configuration = "Debug",
[switch]$Offline)
$ErrorActionPreference="Stop"
. $PSScriptRoot\..\common\_common.ps1
# Capture PATH for later
$StartPath = $env:PATH
$StartDotNetHome = $env:DOTNET_HOME
try {
_ "$RepoRoot\scripts\compile\compile-corehost.ps1"
_ "$RepoRoot\scripts\compile\compile-stage-1.ps1"
_ "$RepoRoot\scripts\compile\compile-stage-2.ps1"
} finally {
$env:PATH = $StartPath
$env:DOTNET_HOME = $StartDotNetHome
}

23
scripts/compile/compile.sh Executable file
View file

@ -0,0 +1,23 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
$REPOROOT/scripts/compile/compile-corehost.sh
$REPOROOT/scripts/compile/compile-stage-1.sh
$REPOROOT/scripts/compile/compile-stage-2.sh

View file

@ -1,3 +1,8 @@
#
# 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.
#
$oldPath = $env:PATH $oldPath = $env:PATH
try { try {
# Put the stage2 output on the front of the path # Put the stage2 output on the front of the path

View file

@ -10,7 +10,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/.." && pwd )" REPOROOT="$( cd -P "$DIR/.." && pwd )"

View file

@ -10,11 +10,11 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source $DIR/../_common.sh source $DIR/../common/_common.sh
cd $DIR/../.. cd $DIR/../..

View file

@ -8,7 +8,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -13,7 +13,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -10,7 +10,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -0,0 +1,36 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
$DnxPackage = "dnx-coreclr-win-x64.1.0.0-rc1-update1.nupkg"
$DnxVersion = "1.0.0-rc1-16231"
$doInstall = $true
# check if the required dnx version is already downloaded
if ((Test-Path "$DnxRoot\dnx.exe")) {
$dnxOut = & "$DnxRoot\dnx.exe" --version
if ($dnxOut -Match $DnxVersion) {
Write-Host "Dnx version - $DnxVersion already downloaded."
$doInstall = $false
}
}
if ($doInstall)
{
# Download dnx to copy to stage2
Remove-Item -Recurse -Force -ErrorAction Ignore $DnxDir
mkdir -Force "$DnxDir" | Out-Null
Write-Host "Downloading Dnx version - $DnxVersion."
$DnxUrl="https://api.nuget.org/packages/$DnxPackage"
Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip"
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
[System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir")
}

71
scripts/obtain/install-dnx.sh Executable file
View file

@ -0,0 +1,71 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
say() {
printf "%b\n" "dotnet_install_dnx: $1"
}
doInstall=true
DNX_FEED="https://api.nuget.org/packages"
DNX_PACKAGE_VERSION="1.0.0-rc1-update1"
DNX_VERSION="1.0.0-rc1-16231"
if [ "$OSNAME" == "osx" ]; then
DNX_FLAVOR="dnx-coreclr-darwin-x64"
elif [ "$OSNAME" == "ubuntu" ]; then
DNX_FLAVOR="dnx-coreclr-linux-x64"
elif [ "$OSNAME" == "centos" ]; then
# No support dnx on redhat yet.
# using patched dnx
DNX_FEED="https://dotnetcli.blob.core.windows.net/dotnet/redhat_dnx"
DNX_PACKAGE_VERSION="1.0.0-rc2-15000"
DNX_VERSION="1.0.0-rc2-15000"
DNX_FLAVOR="dnx-coreclr-redhat-x64"
else
error "unknown OS: $OSNAME" 1>&2
exit 1
fi
DNX_URL="$DNX_FEED/$DNX_FLAVOR.$DNX_PACKAGE_VERSION.nupkg"
say "Preparing to install DNX to $DNX_DIR"
say "Requested Version: $DNX_VERSION"
if [ -e "$DNX_ROOT/dnx" ] ; then
dnxOut=`$DNX_ROOT/dnx --version | grep '^ Version: ' | awk '{ print $2; }'`
say "Local Version: $dnxOut"
if [ $dnxOut = $DNX_VERSION ] ; then
say "You already have the requested version."
doInstall=false
fi
else
say "Local Version: Not Installed"
fi
if [ $doInstall = true ] ; then
rm -rf $DNX_DIR
mkdir -p $DNX_DIR
curl -o $DNX_DIR/dnx.zip $DNX_URL --silent
unzip -qq $DNX_DIR/dnx.zip -d $DNX_DIR
chmod a+x $DNX_ROOT/dnu $DNX_ROOT/dnx
fi

View file

@ -0,0 +1,23 @@
#
# 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.
#
. $PSScriptRoot\..\common\_common.ps1
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
{
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
}
# Install a stage 0
header "Installing dotnet stage 0"
_ "$RepoRoot\scripts\obtain\install.ps1"
# Put stage0 on the PATH
$env:PATH = "$env:DOTNET_INSTALL_DIR\cli\bin;$env:PATH"
# Download dnx to copy to stage2
header "Downloading DNX $DnxVersion"
_ "$RepoRoot\scripts\obtain\install-dnx.ps1"

31
scripts/obtain/install-tools.sh Executable file
View file

@ -0,0 +1,31 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
[ -d $DOTNET_INSTALL_DIR ] || mkdir -p $DOTNET_INSTALL_DIR
# Ensure the latest stage0 is installed
header "Installing dotnet stage 0"
$REPOROOT/scripts/obtain/install.sh
# Put the stage0 on the PATH
export PATH=$REPOROOT/artifacts/$RID/stage0/bin:$PATH
# Download DNX to copy into stage2
header "Downloading DNX $DNX_VERSION"
$REPOROOT/scripts/obtain/install-dnx.sh

View file

@ -16,7 +16,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -12,7 +12,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -8,7 +8,7 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -0,0 +1,25 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
if [[ "$OSNAME" == "ubuntu" ]]; then
# Create Debian package
$REPOROOT/scripts/package/package-debian.sh
elif [[ "$OSNAME" == "osx" ]]; then
# Create OSX PKG
$REPOROOT/packaging/osx/package-osx.sh
fi

View file

@ -3,7 +3,7 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
. "$PSScriptRoot\..\_common.ps1" . "$PSScriptRoot\..\common\_common.ps1"
if(!(Test-Path $PackageDir)) { if(!(Test-Path $PackageDir)) {
mkdir $PackageDir | Out-Null mkdir $PackageDir | Out-Null

View file

@ -4,38 +4,44 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
set -e
SOURCE="${BASH_SOURCE[0]}" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
REPOROOT="$( cd -P "$DIR/../.." && pwd )" REPOROOT="$( cd -P "$DIR/../.." && pwd )"
source "$DIR/../_common.sh"
echo "Starting packaging"
if [ -z "$DOTNET_BUILD_VERSION" ]; then if [ -z "$DOTNET_BUILD_VERSION" ]; then
TIMESTAMP=$(date "+%Y%m%d%H%M%S") TIMESTAMP=$(date "+%Y%m%d%H%M%S")
export DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP
echo "Version: $DOTNET_BUILD_VERSION"
fi fi
COMMIT=$(git rev-parse HEAD) STAGE2_DIR=$REPOROOT/artifacts/$RID/stage2
echo $COMMIT > $STAGE2_DIR/.version
echo $DOTNET_BUILD_VERSION >> $STAGE2_DIR/.version
# Create Dnvm Package if [ ! -d "$STAGE2_DIR" ]; then
$DIR/package-dnvm.sh error "missing stage2 output in $STAGE2_DIR" 1>&2
exit
if [[ "$OSNAME" == "ubuntu" ]]; then
# Create Debian package
$DIR/package-debian.sh
elif [[ "$OSNAME" == "osx" ]]; then
# Create OSX PKG
$DIR/../../packaging/osx/package-osx.sh
fi fi
PACKAGE_DIR=$REPOROOT/artifacts/packages/dnvm
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
PACKAGE_SHORT_NAME=dotnet-${OSNAME}-x64.${DOTNET_BUILD_VERSION}
PACKAGE_NAME=$PACKAGE_DIR/${PACKAGE_SHORT_NAME}.tar.gz
cd $STAGE2_DIR
header "Packaging $PACKAGE_SHORT_NAME"
# Tar up the stage2 artifacts
# We need both "*" and ".version" to ensure we pick up that file
tar -czf $PACKAGE_NAME * .version
info "Packaged stage2 to $PACKAGE_NAME"
$DIR/../publish/publish.sh $PACKAGE_NAME

View file

@ -4,7 +4,7 @@
# #
param( param(
[string]$file = $(throw "Specify the full path to the file to be uploaded") [Parameter(Mandatory=$true)][string]$file
) )
function CheckRequiredVariables function CheckRequiredVariables

View file

@ -16,12 +16,12 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$SCRIPT_DIR/../.." && pwd )" REPOROOT="$( cd -P "$SCRIPT_DIR/../.." && pwd )"
source "$SCRIPT_DIR/../_common.sh" source "$SCRIPT_DIR/../common/_common.sh"
UPLOAD_FILE=$1 UPLOAD_FILE=$1
UPLOAD_JSON_FILE="package_upload.json" UPLOAD_JSON_FILE="package_upload.json"

View file

@ -0,0 +1,11 @@
#
# 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.
#
if (!(Get-Command -ErrorAction SilentlyContinue cmake)) {
throw @"
cmake is required to build the native host 'corehost'
Download it from https://www.cmake.org
"@
}

12
scripts/test/check-prereqs.sh Executable file
View file

@ -0,0 +1,12 @@
#!/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.
#
if ! type -p cmake >/dev/null; then
error "cmake is required to build the native host 'corehost'"
error "OS X w/Homebrew: 'brew install cmake'"
error "Ubuntu: 'sudo apt-get install cmake'"
exit 1
fi

View file

@ -3,7 +3,7 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
. "$PSScriptRoot\..\_common.ps1" . "$PSScriptRoot\..\common\_common.ps1"
$TestBinRoot = "$RepoRoot\artifacts\tests" $TestBinRoot = "$RepoRoot\artifacts\tests"

View file

@ -10,12 +10,11 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../_common.sh" source "$DIR/../common/_common.sh"
TestBinRoot="$REPOROOT/artifacts/tests" TestBinRoot="$REPOROOT/artifacts/tests"

View file

@ -0,0 +1,15 @@
#
# 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.
#
. "$PSScriptRoot\..\common\_common.ps1"
# Run Validation for Project.json dependencies
dotnet publish $RepoRoot\tools\MultiProjectValidator -o $Stage2Dir\..\tools
& "$Stage2Dir\..\tools\pjvalidate" "$RepoRoot\src"
# TODO For release builds, this should be uncommented and fail.
# if (!$?) {
# Write-Host "Project Validation Failed"
# Exit 1
# }

View file

@ -0,0 +1,24 @@
#!/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
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
# Run Validation for Project.json dependencies
dotnet publish "$REPOROOT/tools/MultiProjectValidator" -o "$STAGE2_DIR/../tools"
#TODO for release builds this should fail
set +e
"$STAGE2_DIR/../tools/pjvalidate" "$REPOROOT/src"
set -e

View file

@ -1,3 +1,8 @@
#
# 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.
#
# Remove the stage2 output from the path # Remove the stage2 output from the path
$splat = $env:PATH.Split(";") $splat = $env:PATH.Split(";")
$stripped = @($splat | where { $_ -notlike "*artifacts\win7-x64\stage2*" }) $stripped = @($splat | where { $_ -notlike "*artifacts\win7-x64\stage2*" })

View file

@ -1,3 +1,8 @@
#
# 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.
#
# Put the stage2 output on the front of the path # Put the stage2 output on the front of the path
$stage2 = "$PSScriptRoot\..\artifacts\win7-x64\stage2\bin" $stage2 = "$PSScriptRoot\..\artifacts\win7-x64\stage2\bin"
if (Test-Path $stage2) { if (Test-Path $stage2) {

View file

@ -1,4 +1,4 @@
{ {
"name": "dotnet-run", "name": "dotnet-run",
"version": "1.0.0-*", "version": "1.0.0-*",
"compilationOptions": { "compilationOptions": {