Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f80354d
Merge pull request #1875 from tannergooding/release/2.0.0
tannergooding Jan 20, 2018
d4e753f
Merge pull request #1877 from tannergooding/release/2.1
tannergooding Jan 20, 2018
0dba224
Merge release/2.0.0 to release/2.1 (#1888)
dotnet-bot Jan 23, 2018
f3eacd6
Merge release/2.0.0 to release/2.1 (#1890)
dotnet-bot Jan 24, 2018
195044c
Enabling performance tests (#1796)
Jan 24, 2018
71207a4
Enabling performance tests (#1796) (#1914)
dotnet-bot Jan 30, 2018
baea3c7
Enabling performance tests (#1796) (#1937)
dotnet-bot Feb 7, 2018
424efdb
Run restore and create build log by default from build.cmd and build.sh
dsplaisted Feb 9, 2018
a714bcc
Merge pull request #1943 from dsplaisted/build-script-defaults
dsplaisted Feb 9, 2018
00325a3
Cherry-pick fix for -dogfood option from PR #1820
nguerrera Dec 18, 2017
6876e0c
Create scripts to set up build and test environments
dsplaisted Feb 9, 2018
6387389
Allow artifacts directory to be overridden with DOTNET_SDK_ARTIFACTS_…
dsplaisted Feb 9, 2018
6229c70
Support launching a process in the dogfood context when -dogfood is s…
dsplaisted Feb 9, 2018
7cec5e7
Remove CreateTestEnvScript in favor of -dogfood option
dsplaisted Feb 9, 2018
0148435
Match dogfood behavior of build.ps1 in build.sh
dsplaisted Feb 10, 2018
85bdc89
Merge pull request #1944 from dsplaisted/env-scripts
dsplaisted Feb 12, 2018
6c29759
Merge pull request #1954 from dotnet/release/2.0.0
dsplaisted Feb 12, 2018
e00bcbd
Merging 'build/build.ps1' and 'sdk.sln'
Feb 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
</PropertyGroup>

<PropertyGroup>
<ArtifactsDir>$(DOTNET_SDK_ARTIFACTS_DIR)</ArtifactsDir>
<ArtifactsDir Condition="'$(ArtifactsDir)' == ''">$(RepoRoot)artifacts\</ArtifactsDir>
<ArtifactsDir>$([MSBuild]::EnsureTrailingSlash($(ArtifactsDir)))</ArtifactsDir>
<DOTNET_INSTALL_DIR Condition="'$(DOTNET_INSTALL_DIR)' == ''">$(RepoRoot)artifacts\.dotnet\$(DotNetCliVersion)\</DOTNET_INSTALL_DIR>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -NoLogo -NoProfile -ExecutionPolicy ByPass %~dp0build\build.ps1 -build %*
powershell -NoLogo -NoProfile -ExecutionPolicy ByPass %~dp0build\build.ps1 -build -restore -log %*
exit /b %ErrorLevel%
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

. "$ScriptRoot/build/build.sh" --build $@
. "$ScriptRoot/build/build.sh" --build --restore --log $@
52 changes: 47 additions & 5 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function Print-Usage() {
Write-Host ""
Write-Host "Advanced settings:"
Write-Host " -dogfood Setup a dogfood environment using the local build"
Write-Host " This ignores any actions (such as -build or -restore) that were specified"
Write-Host " If any additional arguments are specified, they will be interpreted as a"
Write-Host " command to be run in the dogfood context. If no additional arguments are"
Write-Host " specified, then the value of the DOTNET_SDK_DOGFOOD_SHELL environment, if"
Write-Host " it is set, will be used."
Write-Host " -solution <value> Path to solution to build"
Write-Host " -ci Set when running on CI server"
Write-Host " -log Enable logging (by default on CI)"
Expand Down Expand Up @@ -68,11 +73,11 @@ function GetVersionsPropsVersion([string[]] $Name) {
}

function InstallDotNetCli {
$DotNetCliVersion = GetVersionsPropsVersion -Name "DotNetCliVersion"
$script:DotNetCliVersion = GetVersionsPropsVersion -Name "DotNetCliVersion"
$DotNetInstallVerbosity = ""

if (!$env:DOTNET_INSTALL_DIR) {
$env:DOTNET_INSTALL_DIR = Join-Path $RepoRoot "artifacts\.dotnet\$DotNetCliVersion"
$env:DOTNET_INSTALL_DIR = Join-Path $ArtifactsDir ".dotnet\$DotNetCliVersion"
}

$DotNetRoot = $env:DOTNET_INSTALL_DIR
Expand All @@ -84,7 +89,7 @@ function InstallDotNetCli {
$env:MSBuildSDKsPath = Join-Path $ArtifactsConfigurationDir "bin\Sdks"
$env:DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR = $env:MSBuildSDKsPath
$env:NETCoreSdkBundledVersionsProps = Join-Path $DotNetRoot "sdk\$DotNetCliVersion\Microsoft.NETCoreSdk.BundledVersions.props"
$env:MicrosoftNETBuildExtensionsTargets = Join-Path $env:MSBuildSDKsPath "Microsoft.NET.Build.Extensions\msbuildExtensions\Microsoft.Common.Targets\ImportAfter\Microsoft.NET.Build.Extensions.targets"
$env:MicrosoftNETBuildExtensionsTargets = Join-Path $env:MSBuildSDKsPath "Microsoft.NET.Build.Extensions\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.targets"
}

if (!(Test-Path $DotNetInstallScript)) {
Expand Down Expand Up @@ -158,7 +163,7 @@ function InstallDotNetCli {
}

function InstallNuGet {
$NugetInstallDir = Join-Path $RepoRoot "artifacts\.nuget"
$NugetInstallDir = Join-Path $ArtifactsDir ".nuget"
$NugetExe = Join-Path $NugetInstallDir "nuget.exe"

if (!(Test-Path -Path $NugetExe)) {
Expand Down Expand Up @@ -213,6 +218,7 @@ function LocateVisualStudio {
function Build {
InstallDotNetCli
InstallNuget
CreateBuildEnvScript
$RepoToolsetBuildProj = InstallRepoToolset

if ($prepareMachine) {
Expand All @@ -232,6 +238,20 @@ function Build {
$env:DOTNET_SDK_TEST_MSBUILD_PATH = Join-Path $env:VSInstallDir "MSBuild\15.0\Bin\msbuild.exe"
}

if ($dogfood)
{
if ($properties -eq $null -and $env:DOTNET_SDK_DOGFOOD_SHELL -ne $null)
{
$properties = , $env:DOTNET_SDK_DOGFOOD_SHELL
}
if ($properties -ne $null)
{
$Host.UI.RawUI.WindowTitle = "SDK Test ($RepoRoot) ($configuration)"
& $properties[0] $properties[1..($properties.Length-1)]
}
exit 0
}

if ($ci -or $log) {
Create-Directory $LogDir
$logCmd = "/bl:" + (Join-Path $LogDir "Build.binlog")
Expand All @@ -256,13 +276,35 @@ function Stop-Processes() {
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process
}

function CreateBuildEnvScript()
{
Create-Directory $ArtifactsDir
$scriptPath = Join-Path $ArtifactsDir "sdk-build-env.bat"
$scriptContents = @"
@echo off
title SDK Build ($RepoRoot)
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_MULTILEVEL_LOOKUP=0

set PATH=$env:DOTNET_INSTALL_DIR;%PATH%
set NUGET_PACKAGES=$env:NUGET_PACKAGES
"@

Out-File -FilePath $scriptPath -InputObject $scriptContents -Encoding ASCII
}

if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
Print-Usage
exit 0
}

$RepoRoot = Join-Path $PSScriptRoot ".."
$ArtifactsDir = Join-Path $RepoRoot "artifacts"
$RepoRoot = [System.IO.Path]::GetFullPath($RepoRoot);

$ArtifactsDir = $env:DOTNET_SDK_ARTIFACTS_DIR
if (!($ArtifactsDir)) {
$ArtifactsDir = Join-Path $RepoRoot "artifacts"
}
$ArtifactsConfigurationDir = Join-Path $ArtifactsDir $configuration
$LogDir = Join-Path $ArtifactsConfigurationDir "log"
$VersionsProps = Join-Path $PSScriptRoot "Versions.props"
Expand Down
59 changes: 39 additions & 20 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ while [[ $# > 0 ]]; do
echo ""
echo "Advanced settings:"
echo " --dogfood Setup a dogfood environment using the local build"
echo " For this to have an effect, you will need to source the build script."
echo " If this option is specified, any actions (such as --build or --restore)"
echo " will be ignored."
echo " --solution <value> Path to solution to build"
echo " --ci Set when running on CI server"
echo " --log Enable logging (by default on CI)"
Expand Down Expand Up @@ -130,7 +133,7 @@ function InstallDotNetCli {

if [ -z "$DOTNET_INSTALL_DIR" ]
then
export DOTNET_INSTALL_DIR="$RepoRoot/artifacts/.dotnet/$DotNetCliVersion"
export DOTNET_INSTALL_DIR="$ArtifactsDir/.dotnet/$DotNetCliVersion"
fi

DotNetRoot=$DOTNET_INSTALL_DIR
Expand Down Expand Up @@ -275,26 +278,29 @@ function Build {
fi
fi

if $ci || $log
if [ $dogfood != true ]
then
CreateDirectory $LogDir
logCmd="/bl:$LogDir/Build.binlog"
else
logCmd=""
fi
if $ci || $log
then
CreateDirectory $LogDir
logCmd="/bl:$LogDir/Build.binlog"
else
logCmd=""
fi

if [ -z $solution ]
then
solution="$RepoRoot/sdk.sln"
fi
if [ -z $solution ]
then
solution="$RepoRoot/sdk.sln"
fi

dotnet msbuild $RepoToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity $logCmd /p:Configuration=$configuration /p:SolutionPath=$solution /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties
LASTEXITCODE=$?
dotnet msbuild $RepoToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity $logCmd /p:Configuration=$configuration /p:SolutionPath=$solution /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties
LASTEXITCODE=$?

if [ $LASTEXITCODE != 0 ]
then
echo "Failed to build $RepoToolsetBuildProj"
return $LASTEXITCODE
if [ $LASTEXITCODE != 0 ]
then
echo "Failed to build $RepoToolsetBuildProj"
return $LASTEXITCODE
fi
fi
}

Expand All @@ -313,15 +319,22 @@ done
ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

RepoRoot="$ScriptRoot/.."
ArtifactsDir="$RepoRoot/artifacts"
if [ -z $DOTNET_SDK_ARTIFACTS_DIR ]
then
ArtifactsDir="$RepoRoot/artifacts"
else
ArtifactsDir="$DOTNET_SDK_ARTIFACTS_DIR"
fi


ArtifactsConfigurationDir="$ArtifactsDir/$configuration"
LogDir="$ArtifactsConfigurationDir/log"
VersionsProps="$ScriptRoot/Versions.props"

# HOME may not be defined in some scenarios, but it is required by NuGet
if [ -z $HOME ]
then
export HOME="$RepoRoot/artifacts/.home/"
export HOME="$ArtifactsDir/.home/"
CreateDirectory "$HOME"
fi

Expand Down Expand Up @@ -349,4 +362,10 @@ then
StopProcesses
fi

exit $LASTEXITCODE
# The script should be sourced if using --dogfood, which means in that case we don't want to exit
if [ $dogfood = true ]
then
return $LASTEXITCODE
else
exit $LASTEXITCODE
fi
9 changes: 8 additions & 1 deletion sdk.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
VisualStudioVersion = 15.0.27101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{50A89C27-BA35-44B2-AC57-E54551791C64}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -111,6 +111,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Clean.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Pack.Tests", "src\Tests\Microsoft.NET.Pack.Tests\Microsoft.NET.Pack.Tests.csproj", "{8746DC05-3035-4F24-9F2C-BAAAB5B50FD3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Perf.Tests", "src\Tests\Microsoft.NET.Perf.Tests\Microsoft.NET.Perf.Tests.csproj", "{AFB72217-54A0-4E76-870A-42718B8E0AE5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Publish.Tests", "src\Tests\Microsoft.NET.Publish.Tests\Microsoft.NET.Publish.Tests.csproj", "{5B3E6EC9-AD8D-4F68-A9F8-C60CF11F4753}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.NET.Rebuild.Tests", "src\Tests\Microsoft.NET.Rebuild.Tests\Microsoft.NET.Rebuild.Tests.csproj", "{8283544E-9704-40C5-BEC2-2781413AA3CF}"
Expand Down Expand Up @@ -168,6 +170,10 @@ Global
{CAF71BDC-7B7D-4A43-AB8C-E440A1E4F108}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAF71BDC-7B7D-4A43-AB8C-E440A1E4F108}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAF71BDC-7B7D-4A43-AB8C-E440A1E4F108}.Release|Any CPU.Build.0 = Release|Any CPU
{AFB72217-54A0-4E76-870A-42718B8E0AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFB72217-54A0-4E76-870A-42718B8E0AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFB72217-54A0-4E76-870A-42718B8E0AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFB72217-54A0-4E76-870A-42718B8E0AE5}.Release|Any CPU.Build.0 = Release|Any CPU
{6F72FAA2-4E46-4382-940A-4F0290E070E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F72FAA2-4E46-4382-940A-4F0290E070E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F72FAA2-4E46-4382-940A-4F0290E070E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -202,6 +208,7 @@ Global
{112668D7-322D-4F83-A6CE-B814C25AD3BF} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{CAF71BDC-7B7D-4A43-AB8C-E440A1E4F108} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{7C6A88D0-DBCC-4933-A92D-A0AC133DD5FC} = {5293658E-96D2-421F-A789-D0B6BA129570}
{AFB72217-54A0-4E76-870A-42718B8E0AE5} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{6F72FAA2-4E46-4382-940A-4F0290E070E2} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{5CBFF0EE-71EA-49CC-8369-34A9A62C8116} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{8283544E-9704-40C5-BEC2-2781413AA3CF} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths">
<PropertyGroup>
<_NugetBuildTasksPackPath>$(NuGetPackageRoot)nuget.build.tasks.pack\$(NuGetBuildTasksPackVersion)</_NugetBuildTasksPackPath>
<_Stage0SdksFolder>$(DOTNET_INSTALL_DIR)\sdk\$(DotNetCliVersion)\Sdks</_Stage0SdksFolder>
</PropertyGroup>
<ItemGroup>
<LayoutFile Include="@(None)" Condition="'%(None.PackagePath)' != ''">
Expand All @@ -81,6 +82,16 @@
<LayoutFile Include="@(PackFile)">
<TargetPath>..\NuGet.Build.Tasks.Pack\%(PackFile.RecursiveDir)%(PackFile.Filename)%(PackFile.Extension)</TargetPath>
</LayoutFile>

<!-- Include some of the Sdks from the Stage 0 CLI for performance tests-->
<Stage0SdkFile Include="$(_Stage0SdksFolder)\FSharp.NET.Sdk\**" SdkName="FSharp.NET.Sdk" />
<Stage0SdkFile Include="$(_Stage0SdksFolder)\Microsoft.NET.Sdk.Publish\**" SdkName="Microsoft.NET.Sdk.Publish" />
<Stage0SdkFile Include="$(_Stage0SdksFolder)\Microsoft.NET.Sdk.Web\**" SdkName="Microsoft.NET.Sdk.Web" />
<Stage0SdkFile Include="$(_Stage0SdksFolder)\Microsoft.NET.Sdk.Web.ProjectSystem\**" SdkName="Microsoft.NET.Sdk.Web.ProjectSystem"/>
<LayoutFile Include="@(Stage0SdkFile)">
<TargetPath>..\%(Stage0SdkFile.SdkName)\%(Stage0SdkFile.RecursiveDir)%(Stage0SdkFile.Filename)%(Stage0SdkFile.Extension)</TargetPath>
</LayoutFile>

</ItemGroup>
</Target>

Expand Down
14 changes: 13 additions & 1 deletion src/Tests/Common/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using Microsoft.NET.TestFramework;

class Program
partial class Program
{
public static int Main(string[] args)
{
Expand All @@ -20,13 +20,25 @@ public static int Main(string[] args)
newArgs.Insert(0, typeof(Program).Assembly.Location);
}

if (!showHelp)
{
BeforeTestRun(newArgs);
}

int returnCode = Xunit.ConsoleClient.Program.Main(newArgs.ToArray());

if (showHelp)
{
TestCommandLine.ShowHelp();
}
else
{
AfterTestRun();
}

return returnCode;
}

static partial void BeforeTestRun(List<string> args);
static partial void AfterTestRun();
}
Loading