mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove appx packaging related script (#4376)
This commit is contained in:
committed by
Dongbo Wang
parent
e64e68bcdc
commit
256ce72ed1
-111
@@ -2168,117 +2168,6 @@ function New-MSIPackage
|
||||
$msiLocationPath
|
||||
}
|
||||
|
||||
# Function to create an Appx package compatible with Windows 8.1 and above
|
||||
function New-AppxPackage
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
|
||||
# Name of the Package
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageName = 'PowerShell',
|
||||
|
||||
# Suffix of the Name
|
||||
[string] $PackageNameSuffix,
|
||||
|
||||
# Version of the Package
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageVersion,
|
||||
|
||||
# Source Path to the Binplaced Files
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageSourcePath,
|
||||
|
||||
# Path to Assets folder containing Appx specific artifacts
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $AssetsPath
|
||||
)
|
||||
|
||||
$PackageSemanticVersion = Get-PackageSemanticVersion -Version $PackageVersion
|
||||
|
||||
$PackageVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $PackageVersion
|
||||
Write-Verbose "Package Version is $PackageVersion"
|
||||
|
||||
$win10sdkBinPath = Get-Win10SDKBinDir
|
||||
|
||||
Write-Verbose "Ensure Win10 SDK is present on the machine @ $win10sdkBinPath"
|
||||
if (-not (Test-Win10SDK)) {
|
||||
throw "Install Win10 SDK prior to running this script - https://go.microsoft.com/fwlink/p/?LinkID=698771"
|
||||
}
|
||||
|
||||
Write-Verbose "Ensure Source Path is valid - $PackageSourcePath"
|
||||
if (-not (Test-Path $PackageSourcePath)) {
|
||||
throw "Invalid PackageSourcePath - $PackageSourcePath"
|
||||
}
|
||||
|
||||
Write-Verbose "Ensure Assets Path is valid - $AssetsPath"
|
||||
if (-not (Test-Path $AssetsPath)) {
|
||||
throw "Invalid AssetsPath - $AssetsPath"
|
||||
}
|
||||
|
||||
Write-Verbose "Initialize MakeAppx executable path"
|
||||
$makeappxExePath = Join-Path $win10sdkBinPath "MakeAppx.exe"
|
||||
|
||||
$appxManifest = @"
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
|
||||
<Identity Name="Microsoft.PowerShell" ProcessorArchitecture="x64" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="#VERSION#" />
|
||||
<Properties>
|
||||
<DisplayName>PowerShell</DisplayName>
|
||||
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
|
||||
<Logo>#LOGO#</Logo>
|
||||
</Properties>
|
||||
<Resources>
|
||||
<Resource Language="en-us" />
|
||||
</Resources>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14257.0" MaxVersionTested="12.0.0.0" />
|
||||
<TargetDeviceFamily Name="Windows.Server" MinVersion="10.0.14257.0" MaxVersionTested="12.0.0.0" />
|
||||
</Dependencies>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
<Applications>
|
||||
<Application Id="PowerShell" Executable="powershell.exe" EntryPoint="Windows.FullTrustApplication">
|
||||
<uap:VisualElements DisplayName="PowerShell" Description="PowerShell for every system" BackgroundColor="transparent" Square150x150Logo="#SQUARE150x150LOGO#" Square44x44Logo="#SQUARE44x44LOGO#">
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
||||
"@
|
||||
|
||||
$appxManifest = $appxManifest.Replace('#VERSION#', $PackageVersion)
|
||||
$appxManifest = $appxManifest.Replace('#LOGO#', 'Assets\Powershell_256.png')
|
||||
$appxManifest = $appxManifest.Replace('#SQUARE150x150LOGO#', 'Assets\Powershell_256.png')
|
||||
$appxManifest = $appxManifest.Replace('#SQUARE44x44LOGO#', 'Assets\Powershell_48.png')
|
||||
|
||||
Write-Verbose "Place Appx Manifest in $PackageSourcePath"
|
||||
$appxManifest | Out-File "$PackageSourcePath\AppxManifest.xml" -Force
|
||||
|
||||
$assetsInSourcePath = Join-Path $PackageSourcePath 'Assets'
|
||||
New-Item $assetsInSourcePath -type directory -Force | Out-Null
|
||||
|
||||
Write-Verbose "Place AppxManifest dependencies such as images to $assetsInSourcePath"
|
||||
Copy-Item "$AssetsPath\*.png" $assetsInSourcePath -Force
|
||||
|
||||
$appxPackageName = $PackageName + "-" + $PackageSemanticVersion
|
||||
if ($PackageNameSuffix) {
|
||||
$appxPackageName = $appxPackageName, $PackageNameSuffix -join "-"
|
||||
}
|
||||
$appxLocationPath = "$pwd\$appxPackageName.appx"
|
||||
Write-Verbose "Calling MakeAppx from $makeappxExePath to create the package @ $appxLocationPath"
|
||||
& $makeappxExePath pack /o /v /d $PackageSourcePath /p $appxLocationPath | Write-Verbose
|
||||
|
||||
Write-Verbose "Clean-up Appx artifacts and Assets from $SourcePath"
|
||||
Remove-Item $assetsInSourcePath -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item "$PackageSourcePath\AppxManifest.xml" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Verbose "You can find the APPX @ $appxLocationPath" -Verbose
|
||||
$appxLocationPath
|
||||
}
|
||||
|
||||
function Start-CrossGen {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
@@ -19,7 +19,7 @@ function Start-PSPackage {
|
||||
[string]$Name = "powershell",
|
||||
|
||||
# Ubuntu, CentOS, Fedora, OS X, and Windows packages are supported
|
||||
[ValidateSet("deb", "osxpkg", "rpm", "msi", "appx", "zip", "AppImage", "nupkg")]
|
||||
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg")]
|
||||
[string[]]$Type,
|
||||
|
||||
# Generate windows downlevel package
|
||||
@@ -144,16 +144,6 @@ function Start-PSPackage {
|
||||
New-MSIPackage @Arguments
|
||||
}
|
||||
}
|
||||
"appx" {
|
||||
$Arguments = @{
|
||||
PackageNameSuffix = $NameSuffix
|
||||
PackageSourcePath = $Source
|
||||
PackageVersion = $Version
|
||||
AssetsPath = "$PSScriptRoot\..\..\assets"
|
||||
Force = $Force
|
||||
}
|
||||
New-AppxPackage @Arguments
|
||||
}
|
||||
"AppImage" {
|
||||
if ($Environment.IsUbuntu14) {
|
||||
$null = Start-NativeExecution { bash -iex "$PSScriptRoot/../appimage.sh" }
|
||||
|
||||
Reference in New Issue
Block a user