Skip to content

Commit

Permalink
Fix NuGet package compliance issues (PowerShell#13045)
Browse files Browse the repository at this point in the history
# Conflicts:
#	tools/packaging/packaging.psm1
  • Loading branch information
adityapatwardhan authored and TravisEz13 committed Mar 11, 2022
1 parent 7892808 commit 2e3aad6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ $packagingStrings = Import-PowerShellDataFile "$PSScriptRoot\packaging.strings.p
Import-Module "$PSScriptRoot\..\Xml" -ErrorAction Stop -Force
$DebianDistributions = @("ubuntu.16.04", "ubuntu.18.04", "ubuntu.20.04", "debian.9", "debian.10", "debian.11")
$RedhatDistributions = @("rhel.7","centos.8")
$script:iconFileName = "Powershell_black_64.png"
$script:iconPath = Join-Path -path $PSScriptRoot -ChildPath "../../assets/$iconFileName" -Resolve

function Start-PSPackage {
[CmdletBinding(DefaultParameterSetName='Version',SupportsShouldProcess=$true)]
Expand Down Expand Up @@ -2170,7 +2172,7 @@ function New-NuSpec {
throw "New-NuSpec can be only executed on Windows platform."
}

$nuspecTemplate = $packagingStrings.NuspecTemplate -f $PackageId,$PackageVersion
$nuspecTemplate = $packagingStrings.NuspecTemplate -f $PackageId,$PackageVersion,$iconFileName
$nuspecObj = [xml] $nuspecTemplate

if ( ($null -ne $Dependency) -and $Dependency.Count -gt 0 ) {
Expand Down Expand Up @@ -3750,6 +3752,9 @@ function New-GlobalToolNupkg
$packageInfo | ForEach-Object {
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp3.1/any") -ItemType Directory

# Add the icon file to the package
Copy-Item -Path $iconPath -Destination "$($_.RootFolder)/$iconFileName" -Verbose

$packageType = $_.Type

switch ($packageType)
Expand Down Expand Up @@ -3836,7 +3841,7 @@ function New-GlobalToolNupkg
}

$packageName = $_.PackageName
$nuSpec = $packagingStrings.GlobalToolNuSpec -f $packageName, $PackageVersion
$nuSpec = $packagingStrings.GlobalToolNuSpec -f $packageName, $PackageVersion, $iconFileName
$nuSpec | Out-File -FilePath (Join-Path $_.RootFolder "$packageName.nuspec") -Encoding ascii
$toolSettings | Out-File -FilePath (Join-Path $ridFolder "DotnetToolSettings.xml") -Encoding ascii

Expand Down
8 changes: 4 additions & 4 deletions tools/packaging/packaging.strings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ open {0}
<version>{1}</version>
<authors>Microsoft</authors>
<owners>Microsoft,PowerShell</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Runtime for hosting PowerShell</description>
<projectUrl>https://github.com/PowerShell/PowerShell</projectUrl>
<iconUrl>https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_black_64.png?raw=true</iconUrl>
<licenseUrl>https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt</licenseUrl>
<icon>{2}</icon>
<license type="expression">MIT</license>
<tags>PowerShell</tags>
<language>en-US</language>
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
Expand Down Expand Up @@ -169,7 +169,7 @@ open {0}
<authors>Microsoft</authors>
<owners>Microsoft,PowerShell</owners>
<projectUrl>https://github.com/PowerShell/PowerShell</projectUrl>
<iconUrl>https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_black_64.png?raw=true</iconUrl>
<icon>{2}</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>PowerShell global tool</description>
<license type="expression">MIT</license>
Expand Down

0 comments on commit 2e3aad6

Please sign in to comment.