Skip to content
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
6 changes: 4 additions & 2 deletions DotnetRuntimeMetadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"sdk": {
"channel": "release/6.0.1xx-preview4",
"channel": "6.0.1xx-preview4",
"quality": "signed",
"qualityFallback": "daily",
"packageVersionPattern": "6.0.0-preview.4",
"sdkImageVersion": "6.0.100",
"nextChannel": "6.0.1xx-preview5/daily"
"nextChannel": "6.0.1xx-preview6"
},
"internalfeed" : {
"url": null
Expand Down
22 changes: 18 additions & 4 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Set-StrictMode -Version 3.0
$script:TestModulePathSeparator = [System.IO.Path]::PathSeparator
$script:Options = $null

$dotnetCLIChannel = $(Get-Content $PSScriptRoot/DotnetRuntimeMetadata.json | ConvertFrom-Json).Sdk.Channel
$dotnetMetadata = Get-Content $PSScriptRoot/DotnetRuntimeMetadata.json | ConvertFrom-Json
$dotnetCLIChannel = $dotnetMetadata.Sdk.Channel
$dotnetCLIQuality = $dotnetMetadata.Sdk.Quality
$dotnetCLIRequiredVersion = $(Get-Content $PSScriptRoot/global.json | ConvertFrom-Json).Sdk.Version

# Track if tags have been sync'ed
Expand Down Expand Up @@ -1694,6 +1696,7 @@ function Install-Dotnet {
param(
[string]$Channel = $dotnetCLIChannel,
[string]$Version = $dotnetCLIRequiredVersion,
[string]$Quality = $dotnetCLIQuality,
[switch]$NoSudo,
[string]$InstallDir,
[string]$AzureFeed,
Expand Down Expand Up @@ -1737,7 +1740,12 @@ function Install-Dotnet {
throw "./$installScript was 0 length"
}

$bashArgs = @("./$installScript", '-c', $Channel, '-v', $Version)
if ($Version) {
$bashArgs = @("./$installScript", '-v', $Version, '-q', $Quality)
}
elseif ($Channel) {
$bashArgs = @("./$installScript", '-c', $Channel, '-q', $Quality)
}

if ($InstallDir) {
$bashArgs += @('-i', $InstallDir)
Expand All @@ -1756,7 +1764,7 @@ function Install-Dotnet {
if (-not $environment.IsCoreCLR) {
$installArgs = @{
Channel = $Channel
Version = $Version
Quality = $Quality
}

if ($InstallDir) {
Expand All @@ -1777,7 +1785,13 @@ function Install-Dotnet {
$fullPSPath = Join-Path -Path $env:windir -ChildPath "System32\WindowsPowerShell\v1.0\powershell.exe"
$fullDotnetInstallPath = Join-Path -Path $PWD.Path -ChildPath $installScript
Start-NativeExecution {
$psArgs = @('-NoLogo', '-NoProfile', '-File', $fullDotnetInstallPath, '-Channel', $Channel, '-Version', $Version)

if ($Version) {
$psArgs = @('-NoLogo', '-NoProfile', '-File', $fullDotnetInstallPath, '-Version', $Version, '-Quality', $Quality)
}
elseif ($Channel) {
$psArgs = @('-NoLogo', '-NoProfile', '-File', $fullDotnetInstallPath, '-Channel', $Channel, '-Quality', $Quality)
}

if ($InstallDir) {
$psArgs += @('-InstallDir', $InstallDir)
Expand Down
54 changes: 40 additions & 14 deletions tools/UpdateDotnetRuntime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function Update-PackageVersion {
$paths = @(
"$PSScriptRoot/packaging/projects/reference/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj"
"$PSScriptRoot/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj"
"$PSScriptRoot/packaging/projects/reference/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj"
"$PSScriptRoot/../src/"
"$PSScriptRoot/../test/tools/"
)
Expand Down Expand Up @@ -154,10 +155,13 @@ function Update-CsprojFile([string] $path, $values) {
}

function Get-DotnetUpdate {
$dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json"
$metataJson = (Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json)
$nextChannel = $metataJson.sdk.nextChannel
$feedUrl = $metataJson.internalfeed.url
param (
$channel,
$quality,
$qualityFallback,
$feedUrl,
$sdkImageVersion
)

if ($SDKVersionOverride) {
return @{
Expand All @@ -169,7 +173,24 @@ function Get-DotnetUpdate {
}

try {
$latestSDKversion = [System.Management.Automation.SemanticVersion] (Invoke-RestMethod -Uri "http://aka.ms/dotnet/$nextChannel/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() })

$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$quality/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $quality

if (-not $latestSDKVersionString.StartsWith($sdkImageVersion))
{
# we did not get a version number so fall back to daily
$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$qualityFallback/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $qualityFallback

if (-not $latestSDKVersionString.StartsWith($sdkImageVersion))
{
throw "No build found!"
}
}

$latestSDKversion = [System.Management.Automation.SemanticVersion] $latestSDKVersionString

$currentVersion = [System.Management.Automation.SemanticVersion] (( Get-Content -Path "$PSScriptRoot/../global.json" -Raw | ConvertFrom-Json).sdk.version)

if ($latestSDKversion -gt $currentVersion) {
Expand All @@ -191,6 +212,7 @@ function Get-DotnetUpdate {
NewVersion = $newVersion
Message = $Message
FeedUrl = $feedUrl
Quality = $selectedQuality
}
}

Expand All @@ -203,15 +225,18 @@ function Update-DevContainer {
$devContainerDocker | Out-File -FilePath $dockerFilePath -Force
}

$dotnetUpdate = Get-DotnetUpdate
$dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json"
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json
$channel = $dotnetMetadataJson.sdk.channel
$nextChannel = $dotnetMetadataJson.sdk.nextChannel
$quality = $dotnetMetadataJson.sdk.quality
$qualityFallback = $dotnetMetadataJson.sdk.qualityFallback
$sdkImageVersion = $dotnetMetadataJson.sdk.sdkImageVersion
$internalfeed = $dotnetMetadataJson.internalfeed.url

if ($dotnetUpdate.ShouldUpdate) {
$dotnetUpdate = Get-DotnetUpdate -channel $nextChannel -quality $quality -feedUrl $internalfeed -qualityFallback $qualityFallback -sdkImageVersion $sdkImageVersion

$dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json"
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json

# Channel is like: $Channel = "5.0.1xx-preview2"
$Channel = $dotnetMetadataJson.sdk.channel
if ($dotnetUpdate.ShouldUpdate) {

Import-Module "$PSScriptRoot/../build.psm1" -Force

Expand Down Expand Up @@ -243,13 +268,14 @@ if ($dotnetUpdate.ShouldUpdate) {

## Install latest version from the channel

$sdkQuality = $dotnetUpdate.Quality
$sdkVersion = if ($SDKVersionOverride) { $SDKVersionOverride } else { $dotnetUpdate.NewVersion }

if (-not $RuntimeSourceFeed) {
Install-Dotnet -Channel "$Channel" -Version $sdkVersion
Install-Dotnet -Version $sdkVersion -Quality $sdkQuality -Channel $null
}
else {
Install-Dotnet -Channel "$Channel" -Version $sdkVersion -AzureFeed $RuntimeSourceFeed -FeedCredential $RuntimeSourceFeedKey
Install-Dotnet -Version $sdkVersion -Quality $sdkQuality -AzureFeed $RuntimeSourceFeed -FeedCredential $RuntimeSourceFeedKey -Channel $null
}

Write-Verbose -Message "Installing .NET SDK completed." -Verbose
Expand Down