Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ function New-PSSignedBuildZip
$name = split-path -Path $BuildPath -Leaf
$zipLocationPath = Join-Path -Path $DestinationFolder -ChildPath "$name-signed.zip"
Compress-Archive -Path $BuildPath\* -DestinationPath $zipLocationPath
Write-Host "##vso[artifact.upload containerfolder=results;artifactname=$name]$zipLocationPath"
if ($VstsVariableName)
{
# set VSTS variable with path to package files
Expand Down
72 changes: 72 additions & 0 deletions tools/releaseBuild/generatePackgeSigning.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
param(
[Parameter(Mandatory)]
[string] $Path,
[string[]] $AuthenticodeDualFiles,
[string[]] $AuthenticodeFiles
)

if ((!$AuthenticodeDualFiles -or $AuthenticodeDualFiles.Count -eq 0) -and (!$AuthenticodeFiles -or $AuthenticodeFiles.Count -eq 0))
{
throw "At least one file must be specified"
}

function New-Attribute
{
param(
[Parameter(Mandatory)]
[string]$Name,
[Parameter(Mandatory)]
[object]$Value,
[Parameter(Mandatory)]
[System.Xml.XmlElement]$Element
)

$attribute = $signingXml.CreateAttribute($Name)
$attribute.Value = $value
$null = $fileElement.Attributes.Append($attribute)
}

function New-FileElement
{
param(
[Parameter(Mandatory)]
[string]$File,
[Parameter(Mandatory)]
[string]$SignType,
[Parameter(Mandatory)]
[System.Xml.XmlDocument]$XmlDoc,
[Parameter(Mandatory)]
[System.Xml.XmlElement]$Job
)

if(Test-Path -Path $file)
{
$name = Split-Path -Leaf -Path $File
$null = $fileElement = $XmlDoc.CreateElement("file")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the $null = part still necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope... Will mered and fix later.

New-Attribute -Name 'src' -value $file -Element $fileElement
New-Attribute -Name 'signType' -value $SignType -Element $fileElement
New-Attribute -Name 'dest' -value "__OUTPATHROOT__\$name" -Element $fileElement
$null = $job.AppendChild($fileElement)
}
else
{
Write-Warning -Message "Skipping $SignType; $File because it does not exist"
}
}

[xml]$signingXml = get-content (Join-Path -Path $PSScriptRoot -ChildPath 'packagesigning.xml')
$job = $signingXml.SignConfigXML.job

foreach($file in $AuthenticodeDualFiles)
{
New-FileElement -File $file -SignType 'AuthenticodeDual' -XmlDoc $signingXml -Job $job
}

foreach($file in $AuthenticodeFiles)
{
New-FileElement -File $file -SignType 'Authenticode' -XmlDoc $signingXml -Job $job
}

$signingXml.Save($path)
$updateScriptPath = Join-Path -Path $PSScriptRoot -ChildPath 'updateSigning.ps1'
& $updateScriptPath -SigningXmlPath $path
6 changes: 6 additions & 0 deletions tools/releaseBuild/packagesigning.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- template used by generatePackageSigning.ps1 -->
<SignConfigXML>
<job platform="" configuration="" dest="__OUTPATHROOT__\signed" jobname="PowerShell Packages" approvers="vigarg;gstolt">
</job>
</SignConfigXML>
4 changes: 3 additions & 1 deletion tools/releaseBuild/updateSigning.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
param(
[string] $SigningXmlPath = (Join-Path -Path $PSScriptRoot -ChildPath 'signing.xml')
)
# Script for use in VSTS to update signing.xml

# Parse the signing xml
$signingXmlPath = Join-Path -Path $PSScriptRoot -ChildPath 'signing.xml'
$signingXml = [xml](Get-Content $signingXmlPath)

# Get any variables to updating 'signType' in the XML
Expand Down