Skip to content

Commit

Permalink
#371 Add .NET 5 SDK to build automation tooling.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstone committed Nov 14, 2020
1 parent 22f969e commit bc71e6c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
66 changes: 66 additions & 0 deletions cicd/modules/AutomationTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ $InstallScriptUriForNuGet = "https://dist.nuget.org/win-x86-commandline/v5.1.0/$
# Chocolatey package names
$ChoclateyPackageNameForCodecov = "codecov";
$ChoclateyPackageNameForDocFx = "docfx";
$ChoclateyPackageNameForDotNet5Sdk = "dotnet-5.0-sdk";
$ChoclateyPackageNameForDotNetCoreSdk = "dotnetcore-sdk";
$ChoclateyPackageNameForHub = "hub";
$ChoclateyPackageNameForLeanify = "leanify";
Expand Down Expand Up @@ -67,6 +68,7 @@ $CommandNameForOpenSsl = "openssl";
$SuppressChocolatey = $false;
$SuppressCodecov = $false;
$SuppressDocFx = $false;
$SuppressDotNet5Sdk = $false;
$SuppressDotNetCoreSdk = $false;
$SuppressHtmlMinifier = $false;
$SuppressHub = $true;
Expand Down Expand Up @@ -112,6 +114,15 @@ Function GetDocFxInstallationStatus
Return (GetChocolateyInstallationStatus) -and (choco list -lo | Where-Object { $_.ToLower().StartsWith("$ChoclateyPackageNameForDocFx") });
}

<#
.Synopsis
Returns a boolean value indicating whether or not the .NET 5 SDK is installed in the current environment.
#>
Function GetDotNet5SdkInstallationStatus
{
Return (GetChocolateyInstallationStatus) -and (choco list -lo | Where-Object { $_.ToLower().StartsWith("$ChoclateyPackageNameForDotNet5Sdk") });
}

<#
.Synopsis
Returns a boolean value indicating whether or not the .NET Core SDK is installed in the current environment.
Expand Down Expand Up @@ -239,6 +250,7 @@ Function InstallAllAutomationTools
InstallPackageManagers;
InstallCodecov;
InstallDocFx;
InstallDotNet5Sdk;
InstallDotNetCoreSdk;
InstallHtmlMinifier;
InstallHub;
Expand Down Expand Up @@ -323,6 +335,28 @@ Function InstallDocFx
ComposeFinish "Finished installing DocFX.";
}

<#
.Synopsis
Installs the .NET 5 SDK in the current environment.
#>
Function InstallDotNet5Sdk
{
If ($SuppressDotNet5Sdk -eq $true)
{
ComposeNormal "Suppressing installation of the .NET 5 SDK.";
Return;
}
ElseIf (GetDotNet5SdkInstallationStatus)
{
ComposeNormal "The .NET 5 SDK is already installed.";
Return;
}

ComposeStart "Installing the .NET 5 SDK.";
UseChocolateyToInstall -PackageName "$ChoclateyPackageNameForDotNet5Sdk";
ComposeFinish "Finished installing the .NET 5 SDK.";
}

<#
.Synopsis
Installs the .NET Core SDK in the current environment.
Expand Down Expand Up @@ -780,6 +814,18 @@ Function RestoreDocFx
ComposeFinish "Finished restoring DocFX.";
}

<#
.Synopsis
Uninstalls, if necessary, and installs the .NET 5 SDK in the current environment.
#>
Function RestoreDotNet5Sdk
{
ComposeStart "Restoring the .NET 5 SDK.";
UninstallDotNet5Sdk;
InstallDotNet5Sdk;
ComposeFinish "Finished restoring the .NET 5 SDK.";
}

<#
.Synopsis
Uninstalls, if necessary, and installs the .NET Core SDK in the current environment.
Expand Down Expand Up @@ -945,6 +991,7 @@ Function UninstallAllAutomationTools
ComposeStart "Uninstalling all automation tools.";
UninstallCodecov;
UninstallDocFx;
UninstallDotNet5Sdk;
UninstallDotNetCoreSdk;
UninstallHtmlMinifier;
UninstallHub;
Expand Down Expand Up @@ -997,6 +1044,25 @@ Function UninstallDocFx
}
}

<#
.Synopsis
Uninstalls the .NET 5 SDK in the current environment.
#>
Function UninstallDotNet5Sdk
{
If ($SuppressDotNet5Sdk -eq $true)
{
ComposeNormal "Suppressing uninstallation of the .NET 5 SDK.";
Return;
}
ElseIf (GetDotNet5SdkInstallationStatus)
{
ComposeStart "Uninstalling the .NET 5 SDK.";
UseChocolateyToUninstall -PackageName "$ChoclateyPackageNameForDotNet5Sdk";
ComposeFinish "Finished uninstalling the .NET 5 SDK.";
}
}

<#
.Synopsis
Uninstalls the .NET Core SDK in the current environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private static void PerformUsingPrimitive(Action<Action<Action>> perform)
var syncRoot = new Object();
perform((operation) =>
{
#pragma warning disable PH_P006
Monitor.Enter(syncRoot);
#pragma warning restore PH_P006

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void OperationLatency_ShouldBeLow()
{
// Arrange.
var mode = ConcurrencyControlMode.Unconstrained;
var latencyThresholdInTicks = 987;
var latencyThresholdInTicks = 2584;

// Assert.
ConcurrencyControlTests.OperationLatency_ShouldBeLow(mode, PerformUsingPrimitive, latencyThresholdInTicks);
Expand Down

0 comments on commit bc71e6c

Please sign in to comment.