-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding the sign proj for signing nuget packages. * Adding the verify script * Using Locate-Nuget to locate nuget.exe
- Loading branch information
1 parent
ae4e6d8
commit cc25e88
Showing
3 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright (c) Microsoft. All rights reserved. | ||
# Build script for Test Platform. | ||
|
||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory=$false)] | ||
[ValidateSet("Debug", "Release")] | ||
[Alias("c")] | ||
[System.String] $Configuration = "Debug" | ||
) | ||
|
||
. $PSScriptRoot\common.lib.ps1 | ||
|
||
# | ||
# Variables | ||
# | ||
$rootDirectory = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName | ||
|
||
# | ||
# Signing configuration | ||
# | ||
Write-Verbose "Setup build configuration." | ||
$TPB_Configuration = $Configuration | ||
|
||
function Verify-NugetPackages | ||
{ | ||
Write-Log "Verify-NugetPackages: Start" | ||
|
||
$nugetInstallPath = Locate-NuGet | ||
|
||
Write-Log "Using nuget.exe installed at $nugetInstallPath" | ||
|
||
$artifactsDirectory = Join-Path $rootDirectory "artifacts" | ||
$artifactsConfigDirectory = Join-Path $artifactsDirectory $TPB_Configuration | ||
$packagesDirectory = Join-Path $artifactsConfigDirectory "MSTestPackages" | ||
Get-ChildItem -Filter *.nupkg $packagesDirectory | % { | ||
& $nugetInstallPath verify -signature -CertificateFingerprint 3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE $_.FullName | ||
} | ||
|
||
Write-Log "Verify-NugetPackages: Complete" | ||
} | ||
|
||
function Write-Log ([string] $message) | ||
{ | ||
$currentColor = $Host.UI.RawUI.ForegroundColor | ||
$Host.UI.RawUI.ForegroundColor = "Green" | ||
if ($message) | ||
{ | ||
Write-Output "... $message" | ||
} | ||
$Host.UI.RawUI.ForegroundColor = $currentColor | ||
} | ||
|
||
Verify-NugetPackages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="SignNugetPackages" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<SignType Condition="'$(SignType)' == ''">Test</SignType> | ||
<MicrobuildVersion>0.2.0</MicrobuildVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<RootDirectory>$(MSBuildThisFileDirectory)..\..\..\</RootDirectory> | ||
<BuildConfiguration Condition="'$(BuildConfiguration)' == ''">Release</BuildConfiguration> | ||
<NugetPkgDirectory Condition="'$(NugetPkgDirectory)' == ''">$(RootDirectory)artifacts\$(BuildConfiguration)\MSTestPackages</NugetPkgDirectory> | ||
<IntermediatesDirectory Condition="'$(IntermediatesDirectory)' == ''">$(RootDirectory)artifacts\obj\$(BuildConfiguration)\MSTestPackages</IntermediatesDirectory> | ||
</PropertyGroup> | ||
|
||
<ImportGroup> | ||
<Import Project="$(RootDirectory)\packages\Microbuild.Core.$(MicrobuildVersion)\build\Microbuild.Core.props" /> | ||
<Import Project="$(RootDirectory)\packages\Microbuild.Core.$(MicrobuildVersion)\build\Microbuild.Core.targets" /> | ||
</ImportGroup> | ||
|
||
<Target Name="SignNugetPackages"> | ||
<ItemGroup> | ||
<FilesToSign Include="$(NugetPkgDirectory)/*.nupkg"> | ||
<Authenticode>NuGet</Authenticode> | ||
</FilesToSign> | ||
</ItemGroup> | ||
|
||
<Message Text="Signing using authenticode certificate '%(FilesToSign.Authenticode)' for @(FilesToSign)"/> | ||
<SignFiles Files="@(FilesToSign)" | ||
BinariesDirectory="$(NugetPkgDirectory)" | ||
IntermediatesDirectory="$(IntermediatesDirectory)" | ||
Type="$(SignType)" /> | ||
</Target> | ||
</Project> |