Skip to content

Commit

Permalink
Added git branch and commit NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Haplois committed Jan 25, 2021
1 parent 872ba54 commit 6cbe2c8
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 31 deletions.
32 changes: 28 additions & 4 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ Param(

$ErrorActionPreference = "Stop"

#
# Git Branch
#
$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 { }


#
# Variables
#
Expand Down Expand Up @@ -87,7 +110,7 @@ Write-Verbose "Setup dotnet configuration."
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
# Dotnet build doesn't support --packages yet. See https://github.com/dotnet/cli/issues/2712
$env:NUGET_PACKAGES = $env:TP_PACKAGES_DIR
$env:NUGET_EXE_Version = "3.4.3"
$env:NUGET_EXE_Version = "5.8.1"
$env:DOTNET_CLI_VERSION = "6.0.100-alpha.1.21067.8"
# $env:DOTNET_RUNTIME_VERSION = "LATEST"
$env:VSWHERE_VERSION = "2.0.2"
Expand Down Expand Up @@ -738,8 +761,7 @@ function Create-VsixPackage
}
Copy-Item -Recurse $comComponentsDirectoryTIA\* $legacyTestImpactComComponentsDir -Force

$fileToCopy = Join-Path $env:TP_PACKAGE_PROJ_DIR "ThirdPartyNotices.txt"
Copy-Item $fileToCopy $packageDir -Force
Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "ThirdPartyNotices.txt") $packageDir -Force

Write-Verbose "Locating MSBuild install path..."
$msbuildPath = Locate-MSBuildPath
Expand Down Expand Up @@ -773,6 +795,8 @@ function Create-NugetPackages
Write-Log "Create-NugetPackages: Started."
$stagingDir = Join-Path $env:TP_OUT_DIR $TPB_Configuration
$packageOutputDir = $TPB_PackageOutDir

Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "Icon.png") $stagingDir -Force

if (-not (Test-Path $packageOutputDir)) {
New-Item $packageOutputDir -type directory -Force
Expand Down Expand Up @@ -835,7 +859,7 @@ function Create-NugetPackages
}

Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version $additionalArgs"
& $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version`;JsonNetVersion=$JsonNetVersion`;Runtime=$TPB_TargetRuntime`;NetCoreTargetFramework=$TPB_TargetFrameworkCore20`;FakesPackageDir=$FakesPackageDir`;NetStandard10Framework=$TPB_TargetFrameworkNS10`;NetStandard13Framework=$TPB_TargetFrameworkNS13`;NetStandard20Framework=$TPB_TargetFrameworkNS20`;Uap10Framework=$testhostUapPackageDir $additionalArgs
& $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version`;JsonNetVersion=$JsonNetVersion`;Runtime=$TPB_TargetRuntime`;NetCoreTargetFramework=$TPB_TargetFrameworkCore20`;FakesPackageDir=$FakesPackageDir`;NetStandard10Framework=$TPB_TargetFrameworkNS10`;NetStandard13Framework=$TPB_TargetFrameworkNS13`;NetStandard20Framework=$TPB_TargetFrameworkNS20`;Uap10Framework=$testhostUapPackageDir`;BranchName=$TPB_BRANCH`;CommitId=$TPB_COMMIT $additionalArgs

Set-ScriptFailedOnError
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function create_package()
# Copy over empty and third patry notice file
cp "$TP_PACKAGE_NUSPEC_DIR/_._" $stagingDir
cp "$TP_PACKAGE_NUSPEC_DIR/../ThirdPartyNotices.txt" $stagingDir

cp "$TP_PACKAGE_NUSPEC_DIR/../Icon.png" $stagingDir

for i in ${projectFiles[@]}; do
log "$dotnet pack --no-build $stagingDir/${i} -o $packageOutputDir -p:Version=$TPB_Version" \
Expand Down
22 changes: 11 additions & 11 deletions scripts/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ function Unzip
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}


function Verify-Nuget-Packages($packageDirectory, $version)
{
Write-Log "Starting Verify-Nuget-Packages."
$expectedNumOfFiles = @{
"Microsoft.CodeCoverage" = 59;
"Microsoft.NET.Test.Sdk" = 18;
"Microsoft.TestPlatform" = 513;
"Microsoft.TestPlatform.Build" = 19;
"Microsoft.TestPlatform.CLI" = 379;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 33;
"Microsoft.TestPlatform.ObjectModel" = 178;
"Microsoft.TestPlatform.Portable" = 568;
"Microsoft.TestPlatform.TestHost" = 212;
"Microsoft.TestPlatform.TranslationLayer" = 121}
"Microsoft.CodeCoverage" = 60;
"Microsoft.NET.Test.Sdk" = 26;
"Microsoft.TestPlatform" = 514;
"Microsoft.TestPlatform.Build" = 20;
"Microsoft.TestPlatform.CLI" = 380;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 34;
"Microsoft.TestPlatform.ObjectModel" = 179;
"Microsoft.TestPlatform.Portable" = 569;
"Microsoft.TestPlatform.TestHost" = 213;
"Microsoft.TestPlatform.TranslationLayer" = 122;
}

$nugetPackages = Get-ChildItem -Filter "*$version*.nupkg" $packageDirectory | % { $_.FullName }

Expand Down
Binary file added src/package/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/package/external/external.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' ">
<!-- This csproj restore external tools required for build process -->
<PackageReference Include="NuGet.CommandLine">
<Version>3.4.3</Version>
<Version>5.8.1</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="fmdev.xlftool">
Expand Down
13 changes: 12 additions & 1 deletion src/package/nuspec/Microsoft.CodeCoverage.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.CodeCoverage</id>
<version>$Version$</version>
Expand All @@ -10,12 +10,23 @@
<description>Microsoft.CodeCoverage package brings infra for collecting code coverage from vstest.console.exe and "dotnet test".</description>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing codecoverage code-coverage</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />

<dependencies>
<group targetFramework="net45"></group>
<group targetFramework="netcoreapp1.0"></group>
</dependencies>
</metadata>

<files>
<file src="Icon.png" target="" />

<file src="Microsoft.CodeCoverage.props" target="build\netstandard1.0\" />
<file src="Microsoft.CodeCoverage.targets" target="build\netstandard1.0\" />
Expand Down
17 changes: 16 additions & 1 deletion src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.NET.Test.Sdk</id>
<version>$Version$</version>
Expand All @@ -9,10 +9,15 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<description>The MSbuild targets and properties for building .NET test projects.</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />
<dependencies>
<group targetFramework="uap10.0">
<dependency id="System.ComponentModel.Primitives" version="[4.1.0, )" />
Expand All @@ -30,22 +35,32 @@
<dependency id="Microsoft.TestPlatform.TestHost" version="$Version$" />
<dependency id="Microsoft.CodeCoverage" version="$Version$" />
</group>
<group targetFramework="net40"></group>
<group targetFramework="net45">
<!-- TestHost gets shipped with vstest.console -->
<dependency id="Microsoft.CodeCoverage" version="$Version$" />
</group>
</dependencies>
</metadata>
<files>
<file src="Icon.png" target="" />

<file src="netcoreapp\*" target="build\netcoreapp1.0\" />
<file src="netcoreapp\*" target="build\netcoreapp2.1\" />
<file src="netfx\*" target="build\net40\" />
<file src="netfx\*" target="build\net45\" />

<file src="Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\netcoreapp1.0\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\netcoreapp2.1\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\net40\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\net45\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\uap10.0\" />

<file src="_._" target="lib/netcoreapp1.0" />
<file src="_._" target="lib/netcoreapp2.1" />
<file src="_._" target="lib/net40" />
<file src="_._" target="lib/net45" />
<file src="_._" target="lib/uap10.0" />
</files>
</package>
9 changes: 8 additions & 1 deletion src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform.Portable</id>
<version>15.0.0</version>
Expand All @@ -11,11 +11,18 @@
<summary>This package contains a subset of binaries for the Visual Studio Test Platform (vstest). vstest provides a modern, cross platform testing engine that also powers the testing on .NET Core. Supports the following popular test frameworks - MSTest v2, xUnit and Nunit with support for extensibility.</summary>
<licenseUrl>https://www.visualstudio.com/microsoft-visual-studio-test-platform</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />
</metadata>
<files>
<file src="Icon.png" target="" />

<!-- Add a third party notice file -->
<file src="ThirdPartyNotices.txt" target="" />

Expand Down
9 changes: 8 additions & 1 deletion src/package/nuspec/Microsoft.TestPlatform.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform</id>
<version>15.0.0</version>
Expand All @@ -11,11 +11,18 @@
<summary>This package contains the full set of binaries for the Visual Studio Test Platform (vstest). It provides a modern, cross platform testing engine that powers the testing on .NET Core as well. It integrates with popular test frameworks like MSTest(v1 and v2), xUnit and Nunit with support for extensibility. </summary>
<licenseUrl>https://www.visualstudio.com/microsoft-visual-studio-test-platform</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />
</metadata>
<files>
<file src="Icon.png" target="" />

<!-- Add a third party notice file -->
<file src="ThirdPartyNotices.txt" target="" />

Expand Down
13 changes: 12 additions & 1 deletion src/package/nuspec/TestPlatform.Build.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform.Build</id>
<version>15.0.0</version>
Expand All @@ -10,11 +10,22 @@
<description>Build tasks and targets for running tests with Test Platform</description>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />

<dependencies>
<group targetFramework="netstandard2.0"></group>
</dependencies>
</metadata>
<files>
<file src="Icon.png" target="" />

<file src="Microsoft.TestPlatform.Build\netstandard2.0\Microsoft.TestPlatform.targets" target="runtimes\any\native" />

<!-- Add localized resources -->
Expand Down
10 changes: 9 additions & 1 deletion src/package/nuspec/TestPlatform.CLI.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform.CLI</id>
<version>15.0.0</version>
Expand All @@ -10,14 +10,22 @@
<description>The cross platform Microsoft Test Platform.</description>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />

<contentFiles>
<files include="**/*.*" copyToOutput="true" flatten="false" buildAction="None" />
</contentFiles>
</metadata>
<files>
<file src="Icon.png" target="" />

<!-- Add a third party notice file -->
<file src="ThirdPartyNotices.txt" target="" />

Expand Down
10 changes: 9 additions & 1 deletion src/package/nuspec/TestPlatform.Extensions.TrxLogger.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform.Extensions.TrxLogger</id>
<version>15.0.0</version>
Expand All @@ -10,9 +10,15 @@
<description>C# SDK for the test platform protocol. This SDK can be used in IDE or Editors to use test platform for discovery and execution of tests.</description>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />

<dependencies>
<group targetFramework="net451">
<dependency id="Newtonsoft.Json" version="$JsonNetVersion$"/>
Expand All @@ -33,6 +39,8 @@
</frameworkAssemblies>
</metadata>
<files>
<file src="Icon.png" target="" />

<!-- Add a third party notice file -->
<file src="ThirdPartyNotices.txt" target="" />
<file src="net451\$Runtime$\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll" target="lib\net451\" />
Expand Down
10 changes: 9 additions & 1 deletion src/package/nuspec/TestPlatform.ObjectModel.nuspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package >
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.TestPlatform.ObjectModel</id>
<version>15.0.0</version>
Expand All @@ -10,9 +10,15 @@
<description>The Microsoft Test Platform Object Model.</description>
<licenseUrl>http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>Icon.png</icon>
<projectUrl>https://github.com/microsoft/vstest/</projectUrl>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>vstest visual-studio unittest testplatform mstest microsoft test testing</tags>
<repository type="git"
url="https://github.com/microsoft/vstest"
branch="$BranchName$"
commit="$CommitId$" />

<dependencies>
<group targetFramework="net45">
<dependency id="System.Reflection.Metadata" version="[1.6.0, )" />
Expand Down Expand Up @@ -76,6 +82,8 @@
</frameworkAssemblies>
</metadata>
<files>
<file src="Icon.png" target="" />

<!-- net45 -->
<file src="net45\$Runtime$\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll" target="lib\net45\" />
<file src="net45\$Runtime$\Microsoft.TestPlatform.CoreUtilities.dll" target="lib\net45\" />
Expand Down
Loading

0 comments on commit 6cbe2c8

Please sign in to comment.