Fix update versions logic (dotnet/coreclr#26768)
authorSven Boemer <sbomer@gmail.com>
Wed, 18 Sep 2019 22:25:05 +0000 (15:25 -0700)
committerGitHub <noreply@github.com>
Wed, 18 Sep 2019 22:25:05 +0000 (15:25 -0700)
* Fix update versions logic

After https://github.com/dotnet/coreclr/pull/26108, this was broken
because the Tools.proj was never restored on the agent running the
finalize-publish job. This fixes the script to do a restore, and adds
a missing import.

* Remove UpdatePublishedVersions.ps1 and add darc dependency

Commit migrated from https://github.com/dotnet/coreclr/commit/9be00be2ad5586d93864a77ef4c706fc9be89467

eng/finalize-publish.yml
eng/updateversions.proj
src/coreclr/UpdatePublishedVersions.ps1 [deleted file]

index 2590052..1afd8bd 100644 (file)
@@ -49,16 +49,17 @@ jobs:
         Write-Host "For Build.SourceBranch $branch, FullBranchName is $branchName"
         Write-Host "##vso[task.setvariable variable=FullBranchName;]$branchName"
         ls -R ${{ parameters.artifactsDir }}/nuget/*.nupkg
-        $(Build.SourcesDirectory)/UpdatePublishedVersions.ps1 `
-        -gitHubUser ${{ parameters.gitHubUser }} `
-        -gitHubEmail ${{ parameters.gitHubEmail }} `
-        -gitHubAuthToken ${{ parameters.gitHubAuthToken }} `
-        -versionsRepoOwner ${{ parameters.versionsRepoOwner }} `
-        -versionsRepo ${{ parameters.versionsRepo }} `
-        -versionsRepoPath build-info/dotnet/coreclr/$branchName `
-        -nupkgPath ${{ parameters.artifactsDir }}/nuget/*.nupkg
+        & $(Build.SourcesDirectory)/eng/common/build.ps1 -restore -build -ci `
+        -projects "$(Build.SourcesDirectory)/eng/updateversions.proj" `
+        /p:GitHubUser="${{ parameters.gitHubUser }}" `
+        /p:GitHubEmail="${{ parameters.gitHubEmail }}" `
+        /p:GitHubAuthToken="${{ parameters.gitHubAuthToken }}" `
+        /p:VersionsRepoOwner="${{ parameters.versionsRepoOwner }}" `
+        /p:VersionsRepo="${{ parameters.versionsRepo }}" `
+        /p:VersionsRepoPath="build-info/dotnet/coreclr/$branchName" `
+        /p:ShippedNuGetPackageGlobPath="${{ parameters.artifactsDir }}/nuget/*.nupkg"
 
-      displayName: Run UpdatePublishedVersions.ps1
+      displayName: Update dotnet/versions
 
     - task: CopyFiles@2
       displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs
index 8914252..cae0812 100644 (file)
@@ -6,6 +6,10 @@
 
   <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
 
-  <Import Project="$(NuGetPackageRoot)\microsoft.dotnet.versiontools.tasks\$(MicrosoftDotNetVersionToolsTasksPackageVersion)\build\Microsoft.DotNet.VersionTools.Tasks.targets" />
+  <Import Project="$(NuGetPackageRoot)\microsoft.dotnet.versiontools.tasks\$(MicrosoftDotNetVersionToolsTasksVersion)\build\Microsoft.DotNet.VersionTools.Tasks.props" />
+
+  <Import Project="$(NuGetPackageRoot)\microsoft.dotnet.versiontools.tasks\$(MicrosoftDotNetVersionToolsTasksVersion)\build\Microsoft.DotNet.VersionTools.Tasks.targets" />
+
+  <Target Name="Build" DependsOnTargets="UpdatePublishedVersions" />
 
 </Project>
diff --git a/src/coreclr/UpdatePublishedVersions.ps1 b/src/coreclr/UpdatePublishedVersions.ps1
deleted file mode 100644 (file)
index a69ebdc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (c) .NET Foundation and contributors. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
-# This script updates the dotnet/versions repository based on a set of packages. It directly
-# commits the changes using GitHub APIs.
-
-param(
-    [Parameter(Mandatory=$true)][string]$gitHubUser,
-    [Parameter(Mandatory=$true)][string]$gitHubEmail,
-    [Parameter(Mandatory=$true)][string]$gitHubAuthToken,
-    [Parameter(Mandatory=$true)][string]$versionsRepoOwner,
-    [Parameter(Mandatory=$true)][string]$versionsRepo,
-    [Parameter(Mandatory=$true)][string]$versionsRepoPath,
-    # A pattern matching all packages in the set that the versions repository should be set to.
-    [Parameter(Mandatory=$true)][string]$nupkgPath)
-
-& "$PSScriptRoot\dotnet.cmd" msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false `
-    /p:RestoreDefaultOptimizationDataPackage=false `
-    /p:PortableBuild=true `
-    /p:UsePartialNGENOptimization=false `
-    /maxcpucount `
-    "$PSScriptRoot\eng\updateversions.proj" /t:UpdatePublishedVersions `
-    /p:GitHubUser="$gitHubUser" `
-    /p:GitHubEmail="$gitHubEmail" `
-    /p:GitHubAuthToken="$gitHubAuthToken" `
-    /p:VersionsRepoOwner="$versionsRepoOwner" `
-    /p:VersionsRepo="$versionsRepo" `
-    /p:VersionsRepoPath="$versionsRepoPath" `
-    /p:ShippedNuGetPackageGlobPath="$nupkgPath"