Skip to content

Commit

Permalink
Merge pull request #32 from AArnott/master
Browse files Browse the repository at this point in the history
Merge master to microbuild
  • Loading branch information
AArnott committed Dec 12, 2019
2 parents 15d4f2d + 21c8e26 commit 1bc59d6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions azure-pipelines/Get-TempToolsPath.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if ($env:AGENT_TOOLSDIRECTORY) {
$path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools"
if ($env:AGENT_TEMPDIRECTORY) {
$path = "$env:AGENT_TEMPDIRECTORY\$env:BUILD_BUILDID"
} elseif ($env:localappdata) {
$path = "$env:localappdata\vs-platform\tools"
$path = "$env:localappdata\gitrepos\tools"
} else {
$path = "$PSScriptRoot\..\obj\tools"
}
Expand Down
6 changes: 1 addition & 5 deletions azure-pipelines/Get-nbgv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ if ($existingTool) {
return $existingTool.Path
}

if ($env:AGENT_TEMPDIRECTORY) {
$toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID"
} else {
$toolInstallDir = "$PSScriptRoot/../obj/tools"
}
$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1"

$toolPath = "$toolInstallDir/nbgv"
if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null }
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/install-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
steps:

- powershell: |
.\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }}
.\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites
dotnet --info
displayName: Install prerequisites

Expand Down
14 changes: 10 additions & 4 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
.SYNOPSIS
Installs dependencies required to build and test the projects in this repository.
.DESCRIPTION
This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location,
unless `-InstallLocality machine` is specified.
This MAY not require elevation, as the SDK and runtimes are installed to a per-user location,
unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location.
See detailed help on that switch for more information.
.PARAMETER InstallLocality
A value indicating whether dependencies should be installed locally to the repo or at a per-user location.
Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache.
Expand All @@ -14,6 +15,9 @@ Per-repo can lead to file locking issues when dotnet.exe is left running as a bu
Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it.
.PARAMETER NoPrerequisites
Skips the installation of prerequisite software (e.g. SDKs, tools).
.PARAMETER UpgradePrerequisites
Takes time to install prerequisites even if they are already present in case they need to be upgraded.
No effect if -NoPrerequisites is specified.
.PARAMETER NoRestore
Skips the package restore step.
.PARAMETER Signing
Expand All @@ -37,6 +41,8 @@ Param (
[Parameter()]
[switch]$NoPrerequisites,
[Parameter()]
[switch]$UpgradePrerequisites,
[Parameter()]
[switch]$NoRestore,
[Parameter()]
[switch]$Signing,
Expand All @@ -51,7 +57,7 @@ Param (
)

if (!$NoPrerequisites) {
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality
}

Expand All @@ -63,7 +69,7 @@ Push-Location $PSScriptRoot
try {
$HeaderColor = 'Green'

if (!$NoRestore) {
if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) {
Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor
dotnet restore src
if ($lastexitcode -ne 0) {
Expand Down
6 changes: 5 additions & 1 deletion tools/Install-NuGetCredProvider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
from https://github.com/microsoft/artifacts-credprovider
to assist in authenticating to Azure Artifact feeds in interactive development
or unattended build agents.
.PARAMETER Force
Forces install of the CredProvider plugin even if one already exists. This is useful to upgrade an older version.
.PARAMETER AccessToken
An optional access token for authenticating to Azure Artifacts authenticated feeds.
#>
[CmdletBinding()]
Param (
[Parameter()]
[switch]$Force,
[Parameter()]
[string]$AccessToken
)
Expand All @@ -35,7 +39,7 @@ if ($IsMacOS -or $IsLinux) {
chmod u+x $installerScript
}

& $installerScript
& $installerScript -Force:$Force

if ($AccessToken) {
$endpoints = @()
Expand Down

0 comments on commit 1bc59d6

Please sign in to comment.