summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UpdateDependencies.ps1157
-rw-r--r--UpdatePublishedVersions.ps1138
-rw-r--r--dependencies.props94
-rw-r--r--dir.props6
-rw-r--r--tests/build.proj19
-rw-r--r--tests/dir.props36
6 files changed, 112 insertions, 338 deletions
diff --git a/UpdateDependencies.ps1 b/UpdateDependencies.ps1
deleted file mode 100644
index 51f24c5c14..0000000000
--- a/UpdateDependencies.ps1
+++ /dev/null
@@ -1,157 +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 dir.props with the current version of CoreCLR
-# dependencies, and then creates a Pull Request for the change.
-
-param(
- [Parameter(Mandatory=$true)][string]$GitHubUser,
- [Parameter(Mandatory=$true)][string]$GitHubEmail,
- [Parameter(Mandatory=$true)][string]$GitHubPassword,
- [Parameter(Mandatory=$true)][string]$VersionFileUrl,
- [string[]]$DirPropsVersionElements = 'CoreClrExpectedPrerelease',
- [string]$GitHubUpstreamOwner='dotnet',
- [string]$GitHubOriginOwner=$GitHubUser,
- [string]$GitHubProject='coreclr',
- [string]$GitHubUpstreamBranch='master',
- # a semi-colon delimited list of GitHub users to notify on the PR
- [string]$GitHubPullRequestNotifications='')
-
-$LatestVersion = Invoke-WebRequest $VersionFileUrl -UseBasicParsing
-$LatestVersion = $LatestVersion.ToString().Trim()
-
-if ($DirPropsVersionElements -contains 'CoreClrExpectedPrerelease')
-{
- # Also get list of all package versions, relative to the given prerelease version url.
- $LatestPackagesListUrl = $VersionFileUrl -Replace 'Latest.txt', 'Latest_Packages.txt'
- $LatestPackagesList = Invoke-WebRequest $LatestPackagesListUrl -UseBasicParsing
- $LatestCoreCLRPackage = $LatestPackagesList -split "`n" | ?{ $_.StartsWith('Microsoft.NETCore.Runtime.CoreCLR') }
- $LatestCoreCLRVersion = ($LatestCoreCLRPackage -split ' ')[1].Trim()
-}
-
-
-# Make a nicely formatted string of the dir props version elements. Short names, joined by commas.
-$DirPropsVersionNames = ($DirPropsVersionElements | %{ $_ -replace 'ExpectedPrerelease', '' }) -join ', '
-
-# Updates the dir.props file with the latest build number
-function UpdateValidDependencyVersionsFile
-{
- if (!$LatestVersion)
- {
- Write-Error "Unable to find latest dependency version at $VersionFileUrl ($DirPropsVersionNames)"
- return $false
- }
-
- $DirPropsPaths = @("$PSScriptRoot\dir.props", "$PSScriptRoot\tests\dir.props")
-
- $DirPropsPaths | %{
- $DirPropsContent = Get-Content $_ | %{
- $line = $_
-
- $DirPropsVersionElements | %{
- $line = $line -replace `
- "<$_>.*</$_>", `
- "<$_>$LatestVersion</$_>"
- }
-
- if ($LatestCoreCLRVersion)
- {
- $line = $line -replace `
- "<CoreClrPackageVersion>.*<", `
- "<CoreClrPackageVersion>$LatestCoreCLRVersion<"
- }
-
- $line
- }
- Set-Content $_ $DirPropsContent
- }
-
- return $true
-}
-
-# Updates all the project.json files with out of date version numbers
-function RunUpdatePackageDependencyVersions
-{
- cmd /c $PSScriptRoot\build-test.cmd updateinvalidpackages | Out-Host
-
- return $LASTEXITCODE -eq 0
-}
-
-# Creates a Pull Request for the updated version numbers
-function CreatePullRequest
-{
- $GitStatus = git status --porcelain
- if ([string]::IsNullOrWhiteSpace($GitStatus))
- {
- Write-Warning "Dependencies are currently up to date"
- return $true
- }
-
- $CommitMessage = "Updating $DirPropsVersionNames dependencies to $LatestVersion"
-
- $env:GIT_COMMITTER_NAME = $GitHubUser
- $env:GIT_COMMITTER_EMAIL = $GitHubEmail
- git commit -a -m "$CommitMessage" --author "$GitHubUser <$GitHubEmail>" | Out-Host
-
- $RemoteUrl = "github.com/$GitHubOriginOwner/$GitHubProject.git"
- $RemoteBranchName = "UpdateDependencies$([DateTime]::UtcNow.ToString('yyyyMMddhhmmss'))"
- $RefSpec = "HEAD:refs/heads/$RemoteBranchName"
-
- Write-Host "git push https://$RemoteUrl $RefSpec"
- # pipe this to null so the password secret isn't in the logs
- git push "https://$($GitHubUser):$GitHubPassword@$RemoteUrl" $RefSpec 2>&1 | Out-Null
-
- if ($GitHubPullRequestNotifications)
- {
- $PRNotifications = $GitHubPullRequestNotifications.Split(';', [StringSplitOptions]::RemoveEmptyEntries) -join ' @'
- $PRBody = "/cc @$PRNotifications"
- }
- else
- {
- $PRBody = ''
- }
-
- $CreatePRBody = @"
- {
- "title": "$CommitMessage",
- "body": "$PRBody",
- "head": "$($GitHubOriginOwner):$RemoteBranchName",
- "base": "$GitHubUpstreamBranch"
- }
-"@
-
- $CreatePRHeaders = @{'Accept'='application/vnd.github.v3+json'; 'Authorization'="token $GitHubPassword"}
-
- try
- {
- Invoke-WebRequest https://api.github.com/repos/$GitHubUpstreamOwner/$GitHubProject/pulls -UseBasicParsing -Method Post -Body $CreatePRBody -Headers $CreatePRHeaders
- }
- catch
- {
- Write-Error $_.ToString()
- return $false
- }
-
- return $true
-}
-
-if (!(UpdateValidDependencyVersionsFile))
-{
- Exit -1
-}
-
-if (!(RunUpdatePackageDependencyVersions))
-{
- Exit -1
-}
-
-if (!(CreatePullRequest))
-{
- Exit -1
-}
-
-Write-Host -ForegroundColor Green "Successfully updated dependencies from the latest build numbers"
-
-exit $LastExitCode
diff --git a/UpdatePublishedVersions.ps1 b/UpdatePublishedVersions.ps1
index 5de7c17bfb..4c9bd85966 100644
--- a/UpdatePublishedVersions.ps1
+++ b/UpdatePublishedVersions.ps1
@@ -14,131 +14,13 @@ param(
[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,
- # Print out the new file contents, but don't change the versions repository.
- [switch]$dryRun)
-
-function ConvertPathTo-Package([string]$path)
-{
- # Find the package ID and version using a regex. This matches the semantic version
- # and assumes everything to the left is the id or a path to the package directory.
- $matched = $path -match '^(.*\\)?(.*?)\.(([0-9]+\.)?[0-9]+\.[0-9]+(-([A-z0-9-]+))?)\.(symbols\.)?nupkg$'
- if ($matched)
- {
- $packageInfo = @{
- Path = $path
- Name = $matches[2]
- Version = $matches[3]
- Prerelease = $matches[6]
- }
- $packageInfo.NameVersion = "$($packageInfo.Name) $($packageInfo.Version)"
- return $packageInfo
- }
- else
- {
- throw "Couldn't find name and version from path $path."
- }
-}
-
-# Updates a GitHub file with the specified file contents
-function Update-GitHub-File(
- [string]$user = $gitHubUser,
- [string]$email = $gitHubEmail,
- [string]$authToken = $gitHubAuthToken,
- [string]$owner = $versionsRepoOwner,
- [string]$repo = $versionsRepo,
- [string]$path,
- [string]$newFileContent,
- [string]$commitMessage)
-{
- function message([string]$message)
- {
- Write-Host -ForegroundColor Green "*** $message ***"
- }
-
- $headers = @{
- 'Accept' = 'application/vnd.github.v3+json'
- 'Authorization' = "token $authToken"
- }
-
- $fileUrl = "https://api.github.com/repos/$owner/$repo/contents/$path"
-
- message "Getting the `"sha`" of the current contents of file '$owner/$repo/$path'"
-
- $currentFile = Invoke-WebRequest $fileUrl -UseBasicParsing -Headers $headers
- $currentSha = (ConvertFrom-Json $currentFile.Content).sha
-
- message "Got `"sha`" value of '$currentSha'"
-
- message "Request to update file '$owner/$repo/$path' contents to:"
- Write-Host $newFileContent
-
- if ($dryRun)
- {
- message 'Not sending request: dry run.'
- return
- }
-
- # Base64 encode the string
- function ToBase64([string]$value)
- {
- return [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($value))
- }
-
- $updateFileBody =
-@"
-{
- "message": "$commitMessage",
- "committer": {
- "name": "$user",
- "email": "$email"
- },
- "content": "$(ToBase64 $newFileContent)",
- "sha": "$currentSha"
-}
-"@
-
- message 'Sending request...'
- $putResponse = Invoke-WebRequest $fileUrl -UseBasicParsing -Method PUT -Body $updateFileBody -Headers $headers
-
- if ($putResponse.StatusCode -ge 200 -and $putResponse.StatusCode -lt 300)
- {
- message 'Successfully updated the file'
- }
-}
-
-# Store result of Get-ChildItem before piping to ConvertPathTo-Package. When directly piping, exceptions are ignored.
-$packagePaths = Get-ChildItem $nupkgPath
-$packages = $packagePaths | %{ ConvertPathTo-Package $_ }
-
-$prereleaseVersion = ''
-foreach ($package in $packages)
-{
- if ($package.Prerelease)
- {
- $prereleaseVersion = $package.Prerelease
- break
- }
-}
-
-if (!$prereleaseVersion)
-{
- throw "Could not find a Prerelease version in '$newPackages'"
-}
-
-$versionFilePath = "$versionsRepoPath/Latest.txt"
-$versionFileContent = "$prereleaseVersion`n"
-
-Update-GitHub-File `
- -path $versionFilePath `
- -newFileContent $versionFileContent `
- -commitMessage "Update '$versionFilePath' with $prereleaseVersion"
-
-$packageInfoFilePath = "$versionsRepoPath/Latest_Packages.txt"
-$packageInfoFileContent = ($packages | %{ $_.NameVersion } | Sort-Object) -join "`r`n"
-
-Update-GitHub-File `
- -path $packageInfoFilePath `
- -newFileContent $packageInfoFileContent `
- -commitMessage "Adding package info to '$packageInfoFilePath' for $prereleaseVersion"
- \ No newline at end of file
+ [Parameter(Mandatory=$true)][string]$nupkgPath)
+
+& "$PSScriptRoot\run.cmd" build -- tests\build.proj /t:UpdatePublishedVersions `
+ /p:GitHubUser="$gitHubUser" `
+ /p:GitHubEmail="$gitHubEmail" `
+ /p:GitHubAuthToken="$gitHubAuthToken" `
+ /p:VersionsRepoOwner="$versionsRepoOwner" `
+ /p:VersionsRepo="$versionsRepo" `
+ /p:VersionsRepoPath="$versionsRepoPath" `
+ /p:ShippedNuGetPackageGlobPath="$nupkgPath"
diff --git a/dependencies.props b/dependencies.props
new file mode 100644
index 0000000000..5464e95ccd
--- /dev/null
+++ b/dependencies.props
@@ -0,0 +1,94 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
+ <PropertyGroup>
+ <CoreFxCurrentRef>afe7fab6bb2a2cd82d381eab880d290b23ed5214</CoreFxCurrentRef>
+ <CoreClrCurrentRef>5adc811e2d62ae1543bc3e88748476d088532d2a</CoreClrCurrentRef>
+ <ExternalCurrentRef>039e8532657c2599e2f8baf2c3dcd95265f28645</ExternalCurrentRef>
+ </PropertyGroup>
+
+ <!-- Auto-upgraded properties for each build info dependency. -->
+ <PropertyGroup>
+ <CoreFxExpectedPrerelease>beta-24328-05</CoreFxExpectedPrerelease>
+ <ExternalExpectedPrerelease>beta-24417-00</ExternalExpectedPrerelease>
+ </PropertyGroup>
+
+ <!-- Full package version strings that are used in other parts of the build. -->
+ <PropertyGroup>
+ <CoreClrPackageVersion>1.0.4-beta-24325-02</CoreClrPackageVersion>
+ <XunitPackageVersion>2.1.0</XunitPackageVersion>
+ </PropertyGroup>
+
+ <!-- Package dependency verification/auto-upgrade configuration. -->
+ <PropertyGroup>
+ <BaseDotNetBuildInfo>build-info/dotnet/</BaseDotNetBuildInfo>
+ <DependencyBranch>master</DependencyBranch>
+ <CurrentRefXmlPath>$(MSBuildThisFileFullPath)</CurrentRefXmlPath>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <RemoteDependencyBuildInfo Include="CoreFx">
+ <BuildInfoPath>$(BaseDotNetBuildInfo)corefx/$(DependencyBranch)</BuildInfoPath>
+ <CurrentRef>$(CoreFxCurrentRef)</CurrentRef>
+ </RemoteDependencyBuildInfo>
+ <RemoteDependencyBuildInfo Include="CoreClr">
+ <BuildInfoPath>$(BaseDotNetBuildInfo)coreclr/$(DependencyBranch)</BuildInfoPath>
+ <CurrentRef>$(CoreClrCurrentRef)</CurrentRef>
+ </RemoteDependencyBuildInfo>
+ <RemoteDependencyBuildInfo Include="External">
+ <BuildInfoPath>$(BaseDotNetBuildInfo)projectk-tfs/$(DependencyBranch)</BuildInfoPath>
+ <CurrentRef>$(ExternalCurrentRef)</CurrentRef>
+ </RemoteDependencyBuildInfo>
+
+ <DependencyBuildInfo Include="@(RemoteDependencyBuildInfo)">
+ <RawVersionsBaseUrl>https://raw.githubusercontent.com/dotnet/versions</RawVersionsBaseUrl>
+ </DependencyBuildInfo>
+
+ <XmlUpdateStep Include="CoreFx">
+ <Path>$(MSBuildThisFileFullPath)</Path>
+ <ElementName>CoreFxExpectedPrerelease</ElementName>
+ <BuildInfoName>CoreFx</BuildInfoName>
+ </XmlUpdateStep>
+ <XmlUpdateStep Include="CoreClr">
+ <Path>$(MSBuildThisFileFullPath)</Path>
+ <ElementName>CoreClrPackageVersion</ElementName>
+ <PackageId>Microsoft.NETCore.Runtime.CoreCLR</PackageId>
+ </XmlUpdateStep>
+ <XmlUpdateStep Include="External">
+ <Path>$(MSBuildThisFileFullPath)</Path>
+ <ElementName>ExternalExpectedPrerelease</ElementName>
+ <BuildInfoName>External</BuildInfoName>
+ </XmlUpdateStep>
+ </ItemGroup>
+
+ <!-- Set up dependencies on packages that aren't found in a BuildInfo. -->
+ <ItemGroup>
+ <XUnitDependency Include="xunit"/>
+ <XUnitDependency Include="xunit.assert"/>
+ <XUnitDependency Include="xunit.core"/>
+ <XUnitDependency Include="xunit.runner.console"/>
+ <XUnitDependency Include="xunit.runner.msbuild"/>
+ <XUnitDependency Include="xunit.runner.utility"/>
+ <StaticDependency Include="@(XUnitDependency)">
+ <Version>$(XunitPackageVersion)</Version>
+ </StaticDependency>
+
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.analysis" />
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.analysis.cli" />
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.metrics" />
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.run.core" />
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.runner.cli" />
+ <XunitPerformanceDependency Include="Microsoft.DotNet.xunit.performance.runner.Windows" />
+ <StaticDependency Include="@(XunitPerformanceDependency)">
+ <Version>1.0.0-alpha-build0035</Version>
+ </StaticDependency>
+
+ <StaticDependency Include="xunit.console.netcore">
+ <Version>1.0.2-prerelease-00101</Version>
+ </StaticDependency>
+
+ <DependencyBuildInfo Include="@(StaticDependency)">
+ <PackageId>%(Identity)</PackageId>
+ <UpdateStableVersions>true</UpdateStableVersions>
+ </DependencyBuildInfo>
+ </ItemGroup>
+</Project>
diff --git a/dir.props b/dir.props
index 7f164fd160..e5cac55a8f 100644
--- a/dir.props
+++ b/dir.props
@@ -134,6 +134,9 @@
</PropertyGroup>
+ <!-- Provides properties for dependency versions and configures dependency verification/auto-upgrade. -->
+ <Import Project="$(ProjectDir)dependencies.props" />
+
<!-- Packaging properties -->
<PropertyGroup>
<PreReleaseLabel>beta</PreReleaseLabel>
@@ -149,9 +152,6 @@
<ProjectUrl>https://dot.net</ProjectUrl>
- <!-- PreReleaseSuffix for packages published from closed build (e.g. CoreCLR for Arm32, APISet, etc) -->
- <ExternalExpectedPrerelease>beta-24417-00</ExternalExpectedPrerelease>
-
<!-- On Windows, MSbuild still runs against Desktop FX while it runs on .NET Core on non-Windows. this requires
pulling in different packaging dependencies.
-->
diff --git a/tests/build.proj b/tests/build.proj
index 70029f19e3..6d5e456dbb 100644
--- a/tests/build.proj
+++ b/tests/build.proj
@@ -2,6 +2,8 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="dir.props" />
+ <Import Project="$(ToolsDir)VersionTools.targets" Condition="Exists('$(ToolsDir)VersionTools.targets')" />
+
<ItemGroup>
<Project Include="src\dirs.proj" />
</ItemGroup>
@@ -12,13 +14,12 @@
<PropertyGroup>
<TraversalBuildDependsOn>
- ValidateAllProjectDependencies;
BatchRestorePackages;
$(TraversalBuildDependsOn);
</TraversalBuildDependsOn>
</PropertyGroup>
- <Target Name="BatchRestorePackages">
+ <Target Name="BatchRestorePackages" DependsOnTargets="VerifyDependencies">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages..." />
<!-- restore all project.jsons in one pass for perf & to avoid concurrency problems -->
@@ -31,20 +32,6 @@
<!-- Task from buildtools that validates dependencies contained in project.json files. -->
<UsingTask TaskName="ValidateProjectDependencyVersions" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
- <Target Name="ValidateAllProjectDependencies"
- Condition="'$(ValidatePackageVersions)'=='true' and '@(ProjectJsonFiles)'!=''">
- <ValidateProjectDependencyVersions ProjectJsons="@(ProjectJsonFiles)"
- ProhibitFloatingDependencies="$(ProhibitFloatingDependencies)"
- ValidationPatterns="@(ValidationPattern)" />
- </Target>
-
- <Target Name="UpdateInvalidPackageVersions">
- <ValidateProjectDependencyVersions ProjectJsons="@(ProjectJsonFiles)"
- ProhibitFloatingDependencies="$(ProhibitFloatingDependencies)"
- ValidationPatterns="@(ValidationPattern)"
- UpdateInvalidDependencies="true" />
- </Target>
-
<!-- Tasks from buildtools for easy project.json dependency updates -->
<UsingTask TaskName="UpdatePackageDependencyVersion" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
diff --git a/tests/dir.props b/tests/dir.props
index 178c9fab58..8d7c8b82a6 100644
--- a/tests/dir.props
+++ b/tests/dir.props
@@ -21,11 +21,6 @@
<BuildToolsTargets45>true</BuildToolsTargets45>
</PropertyGroup>
- <!-- Make the stable version of xunit that the tests depend on available to both the project.json generation and the validation task. -->
- <PropertyGroup>
- <XunitPackageVersion>2.1.0</XunitPackageVersion>
- </PropertyGroup>
-
<!-- Common repo directories -->
<PropertyGroup>
<CopyNuGetImplementations Condition="'$(CopyNuGetImplementations)'==''">false</CopyNuGetImplementations>
@@ -38,35 +33,8 @@
<SkipImportILTargets>true</SkipImportILTargets>
</PropertyGroup>
- <!-- Package dependency validation -->
- <PropertyGroup>
- <ValidatePackageVersions>true</ValidatePackageVersions>
- <ProhibitFloatingDependencies>true</ProhibitFloatingDependencies>
-
- <CoreFxExpectedPrerelease>beta-24328-05</CoreFxExpectedPrerelease>
- <CoreClrPackageVersion>1.0.4-beta-24325-02</CoreClrPackageVersion>
-
- <CoreFxVersionsIdentityRegex>^(?i)((System\..*)|(Microsoft\.CSharp)|(Microsoft\.NETCore.*)|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))(?&lt;!TestData)$</CoreFxVersionsIdentityRegex>
- </PropertyGroup>
-
- <ItemGroup>
- <ValidationPattern Include="CoreFxVersions">
- <IdentityRegex>$(CoreFxVersionsIdentityRegex)</IdentityRegex>
- <ExpectedPrerelease>$(CoreFxExpectedPrerelease)</ExpectedPrerelease>
- </ValidationPattern>
- <ValidationPattern Include="XunitPackageVersions">
- <IdentityRegex>^(?i)(xunit(\.assert|\.core|\.runner\.(utility|msbuild))?)$</IdentityRegex>
- <ExpectedVersion>$(XunitPackageVersion)</ExpectedVersion>
- </ValidationPattern>
- <ValidationPattern Include="XunitConsoleVersion">
- <IdentityRegex>^(?i)(xunit\.console\.netcore)$</IdentityRegex>
- <ExpectedVersion>1.0.2-prerelease-00101</ExpectedVersion>
- </ValidationPattern>
- <ValidationPattern Include="XunitPerformanceVersion">
- <IdentityRegex>^(?i)Microsoft\.DotNet\.xunit\.performance.*$</IdentityRegex>
- <ExpectedVersion>1.0.0-alpha-build0035</ExpectedVersion>
- </ValidationPattern>
- </ItemGroup>
+ <!-- Provides properties for dependency versions and configures dependency verification/auto-upgrade. -->
+ <Import Project="$(ProjectDir)..\dependencies.props" />
<!-- Common nuget properties -->
<PropertyGroup>