diff --git a/TestAssets/Microsoft.TestPlatform.AdapterUtilities.dll b/TestAssets/Microsoft.TestPlatform.AdapterUtilities.dll deleted file mode 100644 index d3cade32a3..0000000000 Binary files a/TestAssets/Microsoft.TestPlatform.AdapterUtilities.dll and /dev/null differ diff --git a/eng/Versions.props b/eng/Versions.props index eb52eaddac..0e36d9567f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,8 +2,8 @@ - 6.0.0 - beta + 2.2.9 + preview false 17.1.0-preview-20211118-01 diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index 857377a9f5..e532fe1d69 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -77,6 +77,23 @@ $TFB_Full = $Full $TFB_Official = $Official $TFB_UpdateXlf = $UpdateXlf $TFB_IsLocalizedBuild = $IsLocalizedBuild -or $TFB_Official +$TPB_BRANCH = "LOCALBRANCH" +$TPB_COMMIT = "LOCALBUILD" +try { + $TPB_BRANCH = $env:BUILD_SOURCEBRANCH -replace "^refs/heads/" + if ([string]::IsNullOrWhiteSpace($TPB_BRANCH)) { + $TPB_BRANCH = git -C "." rev-parse --abbrev-ref HEAD + } +} +catch { } + +try { + $TPB_COMMIT = $env:BUILD_SOURCEVERSION + if ([string]::IsNullOrWhiteSpace($TPB_COMMIT)) { + $TPB_COMMIT = git -C "." rev-parse HEAD + } +} +catch { } $TFB_Solutions = @( "TestFx.sln" @@ -272,8 +289,8 @@ function Create-NugetPackages { $version = $version + "-" + $versionSuffix } - Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version``;Srcroot=$env:TF_SRC_DIR``;Packagesroot=$env:TF_PACKAGES_DIR``;TestPlatformVersion=$TestPlatformVersion``;NOWARN=`"NU5127,NU5128,NU5129`"" - & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version`;Srcroot=$env:TF_SRC_DIR`;Packagesroot=$env:TF_PACKAGES_DIR`;TestPlatformVersion=$TestPlatformVersion`;NOWARN="NU5127,NU5128,NU5129" + Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version``;Srcroot=$env:TF_SRC_DIR``;Packagesroot=$env:TF_PACKAGES_DIR``;TestPlatformVersion=$TestPlatformVersion``;NOWARN=`"NU5127,NU5128,NU5129`"``;BranchName=$TPB_BRANCH``;CommitId=$TPB_COMMIT" + & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version`;Srcroot=$env:TF_SRC_DIR`;Packagesroot=$env:TF_PACKAGES_DIR`;TestPlatformVersion=$TestPlatformVersion`;NOWARN="NU5127,NU5128,NU5129"`;BranchName=$TPB_BRANCH`;CommitId=$TPB_COMMIT if ($lastExitCode -ne 0) { throw "Nuget pack failed with an exit code of '$lastExitCode'." } diff --git a/scripts/SetBuildNumber.ps1 b/scripts/SetBuildNumber.ps1 deleted file mode 100644 index 97252bef6f..0000000000 --- a/scripts/SetBuildNumber.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -# Script to set the build number for official builds. -# We follow the following algorithm to set the build number: -# 1. We get the delta in terms of months from the first release date to the current UTC time. -# 2. We get the current day of the month.
-# 3. We also get the revision number for the current build. -# 4. The build number is
. - -[CmdletBinding(PositionalBinding=$false)] -Param( - [Parameter(Mandatory=$true)] - [Alias("bn")] - [System.String] $DefinitionBuildNumber -) - -$TFB_DefinitionBuildNumber = $DefinitionBuildNumber -$TFB_FirstReleaseDate = [DateTime](Get-Date -Year 2016 -Month 05 -Day 01) - -function Set_BuildNumber() -{ - $currentDate = [System.DateTime]::UTCNow - - # The default build number would be of the format $(date:yyyymmdd)$(rev:.rr) - $revisionNumber = $TFB_DefinitionBuildNumber.Split(".")[1] - - $monthDiff = ($currentDate.Month - $TFB_FirstReleaseDate.Month) + 12*($currentDate.Year - $TFB_FirstReleaseDate.Year) - $buildNumber = $monthDiff.ToString() + $currentDate.ToString("dd") + "." + $revisionNumber - Write-Verbose("Build number used: " + $buildNumber) - - # This sets the build number. - Write-Host("##vso[task.setvariable variable=BuildVersionSuffix]$buildNumber") -} - -Set_BuildNumber diff --git a/scripts/vsts-prebuild.ps1 b/scripts/vsts-prebuild.ps1 new file mode 100644 index 0000000000..a552919d83 --- /dev/null +++ b/scripts/vsts-prebuild.ps1 @@ -0,0 +1,66 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. + +# Sets variables which are used across the build tasks. + +param ( + [Parameter(Mandatory)] + [string] $IsRtmBuild +) + +$TPB_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName +$TPB_ENG_DIR = Join-Path $TPB_ROOT_DIR "eng" +$TPB_VERSION_PREFIX = ([xml](Get-Content $TPB_ENG_DIR\Versions.props)).Project.PropertyGroup.VersionPrefix +$TPB_RELEASE_VERSION_LABEL = ([xml](Get-Content $TPB_ENG_DIR\Versions.props)).Project.PropertyGroup.PreReleaseVersionLabel +$TPB_BUILD_NUMBER = IF ($env:BUILD_BUILDNUMBER -ne $null) { $env:BUILD_BUILDNUMBER -replace "\.", "-" } ELSE { "LOCAL" } +$TPB_NUGET_VERSION_SUFFIX = "$TPB_RELEASE_VERSION_LABEL-$TPB_BUILD_NUMBER" +$TPB_PACKAGE_VERSION = "$TPB_VERSION_PREFIX-$TPB_NUGET_VERSION_SUFFIX" +$TPB_BUILD_VERSION_SUFFIX = "0.0" +$TFB_FIRST_RELEASE_DATE = [DateTime](Get-Date -Year 2016 -Month 05 -Day 01) +$TPB_BRANCH = "LOCALBRANCH" +try { + $TPB_BRANCH = $env:BUILD_SOURCEBRANCH -replace "^refs/heads/" + if ([string]::IsNullOrWhiteSpace($TPB_BRANCH)) { + $TPB_BRANCH = git -C "." rev-parse --abbrev-ref HEAD + } +} +catch { } + +# Set TPB_BUILD_VERSION_SUFFIX +if($TPB_BUILD_NUMBER -ne "LOCAL") +{ + $currentDate = [System.DateTime]::UTCNow + + # The default build number would be of the format $(date:yyyymmdd)$(rev:-rr) + $revisionNumber = $TPB_BUILD_NUMBER.Split("-")[1] + + $monthDiff = ($currentDate.Month - $TFB_FIRST_RELEASE_DATE.Month) + 12*($currentDate.Year - $TFB_FIRST_RELEASE_DATE.Year) + $TPB_BUILD_VERSION_SUFFIX = $monthDiff.ToString() + $currentDate.ToString("dd") + "." + $revisionNumber +} + +# Set RTM configuration +if ($IsRtmBuild -eq "true") { + $TPB_PACKAGE_VERSION = "$TPB_VERSION_PREFIX" + $TPB_NUGET_VERSION_SUFFIX = "''" +} + +# Dump variables +Get-ChildItem variable:TP* | Format-Table + +# Validate RTM config +if ($IsRtmBuild -eq "true" -and (-not $TPB_BRANCH.StartsWith("rel/"))) { + throw "An RTM build can only be started from a release branch, ``$TPB_BRANCH`` is invalid!" +} + +if ($IsRtmBuild -eq "true" -and ($TPB_RELEASE_VERSION_LABEL -ne "release" -and $TPB_RELEASE_VERSION_LABEL -ne "servicing")) { + throw "An RTM build cannot be based on a ``$TPB_RELEASE_VERSION_LABEL`` build!" +} + +# Publish CI variables +Write-Host "##vso[task.setvariable variable=TestAdapterNugetVersion;]$TPB_VERSION_PREFIX" +Write-Host "##vso[task.setvariable variable=TestFrameworkNugetVersion;]$TPB_VERSION_PREFIX" +Write-Host "##vso[task.setvariable variable=NugetVersionSuffix;]$TPB_NUGET_VERSION_SUFFIX" + +Write-Host "##vso[task.setvariable variable=BuildVersionPrefix;]14.0" +Write-Host("##vso[task.setvariable variable=BuildVersionSuffix]$TPB_BUILD_VERSION_SUFFIX") +Write-Host "##vso[task.setvariable variable=PackageVersion;]$TPB_PACKAGE_VERSION" \ No newline at end of file diff --git a/src/Package/MSTest.Internal.TestFx.Documentation.nuspec b/src/Package/MSTest.Internal.TestFx.Documentation.nuspec index e9d521e80d..730e214e56 100644 --- a/src/Package/MSTest.Internal.TestFx.Documentation.nuspec +++ b/src/Package/MSTest.Internal.TestFx.Documentation.nuspec @@ -16,6 +16,10 @@ Icon.png © Microsoft Corporation. All rights reserved. MSTest TestFramework MSTestV2 + diff --git a/src/Package/MSTest.TestAdapter.nuspec b/src/Package/MSTest.TestAdapter.nuspec index 98bae47865..bcfc2dc1a3 100644 --- a/src/Package/MSTest.TestAdapter.nuspec +++ b/src/Package/MSTest.TestAdapter.nuspec @@ -23,6 +23,10 @@ Icon.png © Microsoft Corporation. All rights reserved. MSTest TestFramework TestAdapter VisualStudio Unittest MSTestV2 Microsoft + diff --git a/src/Package/MSTest.TestAdapter.symbols.nuspec b/src/Package/MSTest.TestAdapter.symbols.nuspec index d5f3940e22..7daa72ffa9 100644 --- a/src/Package/MSTest.TestAdapter.symbols.nuspec +++ b/src/Package/MSTest.TestAdapter.symbols.nuspec @@ -23,6 +23,11 @@ Icon.png © Microsoft Corporation. All rights reserved. MSTest TestFramework TestAdapter VisualStudio Unittest MSTestV2 Microsoft + + diff --git a/src/Package/MSTest.TestFramework.nuspec b/src/Package/MSTest.TestFramework.nuspec index a071a50440..ca53c5a3c8 100644 --- a/src/Package/MSTest.TestFramework.nuspec +++ b/src/Package/MSTest.TestFramework.nuspec @@ -26,6 +26,10 @@ Icon.png © Microsoft Corporation. All rights reserved. MSTest TestFramework Unittest MSTestV2 Microsoft Test Testing TDD Framework + diff --git a/src/Package/MSTest.TestFramework.symbols.nuspec b/src/Package/MSTest.TestFramework.symbols.nuspec index 4b28269ceb..e3813dd0a2 100644 --- a/src/Package/MSTest.TestFramework.symbols.nuspec +++ b/src/Package/MSTest.TestFramework.symbols.nuspec @@ -25,6 +25,10 @@ Icon.png © Microsoft Corporation. All rights reserved. MSTest TestFramework Unittest MSTestV2 Microsoft Test Testing TDD Framework +