Skip to content

Commit

Permalink
Merge branch 'main' into microbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Feb 17, 2023
2 parents 0fc6c4f + b579c7c commit 4ed8e23
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*.sh eol=lf
*.ps1 eol=lf

# The macOS codesign tool is extremely picky, and requires LF line endings.
*.plist eol=lf

###############################################################################
# Set default behavior for command prompt diff.
#
Expand Down
14 changes: 12 additions & 2 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
Install the MicroBuild SBOM plugin.
.PARAMETER AccessToken
An optional access token for authenticating to Azure Artifacts authenticated feeds.
.PARAMETER Interactive
Runs NuGet restore in interactive mode. This can turn authentication failures into authentication challenges.
#>
[CmdletBinding(SupportsShouldProcess = $true)]
Param (
Expand All @@ -67,7 +69,9 @@ Param (
[Parameter()]
[switch]$SBOM,
[Parameter()]
[string]$AccessToken
[string]$AccessToken,
[Parameter()]
[switch]$Interactive
)

$EnvVars = @{}
Expand Down Expand Up @@ -99,8 +103,14 @@ try {
$HeaderColor = 'Green'

if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) {
$RestoreArguments = @()
if ($Interactive)
{
$RestoreArguments += '--interactive'
}

Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor
dotnet restore
dotnet restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring packages."
}
Expand Down
7 changes: 3 additions & 4 deletions tools/Install-DotNetSdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,18 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
}

Function Get-InstallerExe(
$Version,
[Version]$Version,
$Architecture,
[ValidateSet('Sdk','Runtime','WindowsDesktop')]
[string]$sku
) {
# Get the latest/actual version for the specified one
$TypedVersion = [Version]$Version
if ($TypedVersion.Build -eq -1) {
if ($Version.Build -eq -1) {
$versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing)
$Version = $versionInfo[-1]
}

$majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)"
$majorMinor = "$($Version.Major).$($Version.Minor)"
$ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json"
if (!(Test-Path $ReleasesFile)) {
Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null
Expand Down

0 comments on commit 4ed8e23

Please sign in to comment.