build: strip priconfig packaging node before msix pri generation
This commit is contained in:
1 parent
8a4b97eb84
commit
74df91c06b
2 files changed
+76
-7
No files matched your search
@@ -110,7 +110,19 @@ jobs:
|
||||
iscc "/DPublishDir=%CD%\build\bin" "/DOutputDir=%CD%\pack\inno" build\inno-metadata\scwpic.iss || goto :error
|
||||
echo ::endgroup::
|
||||
echo ::group::===== App MSIX Pack =====
|
||||
:: TODO
|
||||
mkdir pack\msix\staging
|
||||
robocopy build\msix-metadata pack\msix\staging AppxManifest.xml
|
||||
if ErrorLevel 8 goto :error
|
||||
robocopy build\msix-metadata\Strings pack\msix\staging\Strings /E
|
||||
if ErrorLevel 8 goto :error
|
||||
robocopy dist\winmsix-icons pack\msix\staging\Assets /E
|
||||
if ErrorLevel 8 goto :error
|
||||
robocopy build\bin pack\msix\staging\MyApp /E
|
||||
if ErrorLevel 8 goto :error
|
||||
MakePri.exe createconfig /cf pack\msix\priconfig.xml /dq en-US /o || goto :error
|
||||
pwsh -NoProfile -ExecutionPolicy Bypass -File dist\strip-priconfig-packaging-node.ps1 -Path pack\msix\priconfig.xml -Verbose || goto :error
|
||||
MakePri.exe new /pr pack\msix\staging /cf pack\msix\priconfig.xml /mn pack\msix\staging\AppxManifest.xml /of pack\msix\staging\resources.pri /o || goto :error
|
||||
MakeAppx.exe pack /l /o /v /d pack\msix\staging /p pack\msix\scwpic.msix || goto :error
|
||||
echo ::endgroup::
|
||||
exit /B 0
|
||||
:error
|
||||
@@ -120,10 +132,9 @@ jobs:
|
||||
name: "scwpic-windows-msvc${{ matrix.vs }}-qt${{ matrix.qt_ver }}-cmake-setup"
|
||||
path: pack/inno/scwpic-setup.exe
|
||||
archive: false
|
||||
# TODO: Enable when start to support MSIX pack.
|
||||
# - uses: actions/upload-artifact@v7
|
||||
# with:
|
||||
# name: "scwpic-windows-msvc${{ matrix.vs }}-qt${{ matrix.qt_ver }}-cmake"
|
||||
# path: pack/msix/scwpic.msix
|
||||
# archive: false
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: "scwpic-windows-msvc${{ matrix.vs }}-qt${{ matrix.qt_ver }}-cmake"
|
||||
path: pack/msix/scwpic.msix
|
||||
archive: false
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
# Strip the PRI split configuration from a MakePri-generated priconfig.xml.
|
||||
#
|
||||
# `MakePri.exe createconfig` emits a <packaging> section telling `MakePri.exe new` to
|
||||
# split resource candidates into separate resource packages (resources.language-*.pri,
|
||||
# resources.scale-*.pri, ...), leaving the main resources.pri with default-context
|
||||
# candidates only. A monolithic MSIX package loads nothing but the resources.pri at its
|
||||
# package root, so any split dimension - autoResourcePackage qualifiers (Language, Scale,
|
||||
# DXFeatureLevel, ...) as well as manual resourcePackage entries - would strip its
|
||||
# candidates from the shipped package, e.g. every non-default UI language would silently
|
||||
# fall back to the source language.
|
||||
#
|
||||
# This script therefore removes the whole <packaging> element. The schema declares it
|
||||
# optional, and leaving an empty one behind would make MakePri warn about a missing
|
||||
# packaging mode. The file is rewritten in place as UTF-8 without BOM.
|
||||
#
|
||||
# Usage (the Windows CI calls it between `MakePri.exe createconfig` and `MakePri.exe new`):
|
||||
# pwsh -NoProfile -ExecutionPolicy Bypass -File strip-priconfig-packaging-node.ps1 -Path priconfig.xml -Verbose
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
# Path to the priconfig.xml generated by `MakePri.exe createconfig`.
|
||||
[Parameter(Mandatory = $true, Position = 0)]
|
||||
[string]$Path
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
throw "priconfig file not found: $Path"
|
||||
}
|
||||
|
||||
# priconfig.xml declares no XML namespace, so plain XPath is sufficient here.
|
||||
$document = [System.Xml.XmlDocument]::new()
|
||||
$document.Load($Path)
|
||||
|
||||
$packaging = $document.SelectSingleNode('/resources/packaging')
|
||||
if ($null -eq $packaging) {
|
||||
Write-Verbose "No <packaging> element found; the config already yields a single monolithic PRI."
|
||||
} else {
|
||||
# Report every split directive we are about to drop, for build log auditing.
|
||||
foreach ($node in @($packaging.SelectNodes('autoResourcePackage | resourcePackage'))) {
|
||||
$name = $node.GetAttribute('qualifier')
|
||||
if (-not $name) { $name = $node.GetAttribute('name') }
|
||||
Write-Verbose "Dropping split directive <$($node.Name)> '$name'."
|
||||
}
|
||||
[void]$packaging.ParentNode.RemoveChild($packaging)
|
||||
}
|
||||
|
||||
# Rewrite in place: UTF-8 without BOM (XmlDocument.Save(string) would emit one) and tab
|
||||
# indentation, matching what createconfig itself emits.
|
||||
$settings = [System.Xml.XmlWriterSettings]::new()
|
||||
$settings.Indent = $true
|
||||
$settings.IndentChars = "`t"
|
||||
$settings.Encoding = [System.Text.UTF8Encoding]::new($false)
|
||||
$writer = [System.Xml.XmlWriter]::Create($Path, $settings)
|
||||
try {
|
||||
$document.Save($writer)
|
||||
} finally {
|
||||
$writer.Close()
|
||||
}
|
||||
Reference in new issue
Block a user