Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release/2.0.0 into release/2.1 #1954

Merged
merged 11 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -16,6 +16,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 $@
53 changes: 47 additions & 6 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,8 +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:CustomAfterMicrosoftCommonTargets = Join-Path $env:MSBuildSDKsPath "Microsoft.NET.Build.Extensions\msbuildExtensions-ver\Microsoft.Common.Targets\ImportAfter\Microsoft.NET.Build.Extensions.targets"
$env:MicrosoftNETBuildExtensionsTargets = $env:CustomAfterMicrosoftCommonTargets
$env:MicrosoftNETBuildExtensionsTargets = Join-Path $env:MSBuildSDKsPath "Microsoft.NET.Build.Extensions\msbuildExtensions\Microsoft\Microoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.targets"
}

if (!(Test-Path $DotNetInstallScript)) {
Expand Down Expand Up @@ -146,7 +150,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 @@ -201,6 +205,7 @@ function LocateVisualStudio {
function Build {
InstallDotNetCli
InstallNuget
CreateBuildEnvScript
$RepoToolsetBuildProj = InstallRepoToolset

if ($prepareMachine) {
Expand All @@ -220,6 +225,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 @@ -244,13 +263,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 @@ -259,26 +262,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 @@ -297,15 +303,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 @@ -333,4 +346,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 @@ -110,6 +110,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Build.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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Restore.Tests", "src\Tests\Microsoft.NET.Restore.Tests\Microsoft.NET.Restore.Tests.csproj", "{112668D7-322D-4F83-A6CE-B814C25AD3BF}"
Expand Down Expand Up @@ -163,6 +165,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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -185,6 +191,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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB8F26CE-4DE6-433F-B32A-79183020BBD6}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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 @@ -88,6 +89,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