Родитель
8a957275b6
Коммит
8b7545c2b6
|
@ -390,7 +390,7 @@ namespace WixToolset.Core.Burn
|
|||
// Generate the core-defined BA manifest tables...
|
||||
string baManifestPath;
|
||||
{
|
||||
var command = new CreateBootstrapperApplicationManifestCommand(section, bundleSymbol, orderedFacades, uxPayloadIndex, packagesPayloads, this.IntermediateFolder, this.InternalBurnBackendHelper);
|
||||
var command = new CreateBootstrapperApplicationManifestCommand(section, bundleSymbol, orderedFacades, uxPayloadIndex, payloadSymbols, packagesPayloads, this.IntermediateFolder, this.InternalBurnBackendHelper);
|
||||
command.Execute();
|
||||
|
||||
var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow;
|
||||
|
|
|
@ -15,12 +15,13 @@ namespace WixToolset.Core.Burn.Bundles
|
|||
|
||||
internal class CreateBootstrapperApplicationManifestCommand
|
||||
{
|
||||
public CreateBootstrapperApplicationManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable<PackageFacade> chainPackages, int lastUXPayloadIndex, Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> packagesPayloads, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper)
|
||||
public CreateBootstrapperApplicationManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable<PackageFacade> chainPackages, int lastUXPayloadIndex, Dictionary<string, WixBundlePayloadSymbol> payloadSymbols, Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> packagesPayloads, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper)
|
||||
{
|
||||
this.Section = section;
|
||||
this.BundleSymbol = bundleSymbol;
|
||||
this.ChainPackages = chainPackages;
|
||||
this.LastUXPayloadIndex = lastUXPayloadIndex;
|
||||
this.Payloads = payloadSymbols;
|
||||
this.PackagesPayloads = packagesPayloads;
|
||||
this.IntermediateFolder = intermediateFolder;
|
||||
this.InternalBurnBackendHelper = internalBurnBackendHelper;
|
||||
|
@ -36,6 +37,8 @@ namespace WixToolset.Core.Burn.Bundles
|
|||
|
||||
private int LastUXPayloadIndex { get; }
|
||||
|
||||
private Dictionary<string, WixBundlePayloadSymbol> Payloads { get; }
|
||||
|
||||
private Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> PackagesPayloads { get; }
|
||||
|
||||
private string IntermediateFolder { get; }
|
||||
|
@ -216,7 +219,6 @@ namespace WixToolset.Core.Burn.Bundles
|
|||
|
||||
private void WritePayloadInfo(XmlTextWriter writer)
|
||||
{
|
||||
// TODO: check v3 - should this be only include package payloads or include all non-UX container payloads?
|
||||
foreach (var kvp in this.PackagesPayloads.OrderBy(kvp => kvp.Key, StringComparer.Ordinal))
|
||||
{
|
||||
var packageId = kvp.Key;
|
||||
|
@ -224,30 +226,41 @@ namespace WixToolset.Core.Burn.Bundles
|
|||
|
||||
foreach (var payloadSymbol in payloadsById.Values.OrderBy(p => p.Id.Id, StringComparer.Ordinal))
|
||||
{
|
||||
writer.WriteStartElement("WixPayloadProperties");
|
||||
|
||||
writer.WriteAttributeString("Package", packageId);
|
||||
|
||||
writer.WriteAttributeString("Payload", payloadSymbol.Id.Id);
|
||||
|
||||
if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef))
|
||||
{
|
||||
writer.WriteAttributeString("Container", payloadSymbol.ContainerRef);
|
||||
}
|
||||
|
||||
writer.WriteAttributeString("Name", payloadSymbol.Name);
|
||||
writer.WriteAttributeString("Size", payloadSymbol.FileSize.Value.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
if (!String.IsNullOrEmpty(payloadSymbol.DownloadUrl))
|
||||
{
|
||||
writer.WriteAttributeString("DownloadUrl", payloadSymbol.DownloadUrl);
|
||||
}
|
||||
|
||||
writer.WriteAttributeString("LayoutOnly", payloadSymbol.LayoutOnly ? "yes" : "no");
|
||||
|
||||
writer.WriteEndElement();
|
||||
this.WritePayloadInfo(writer, payloadSymbol, packageId);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var payloadSymbol in this.Payloads.Values.Where(p => p.LayoutOnly).OrderBy(p => p.Id.Id, StringComparer.Ordinal))
|
||||
{
|
||||
this.WritePayloadInfo(writer, payloadSymbol, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void WritePayloadInfo(XmlTextWriter writer, WixBundlePayloadSymbol payloadSymbol, string packageId)
|
||||
{
|
||||
writer.WriteStartElement("WixPayloadProperties");
|
||||
|
||||
if (!String.IsNullOrEmpty(packageId))
|
||||
{
|
||||
writer.WriteAttributeString("Package", packageId);
|
||||
}
|
||||
|
||||
writer.WriteAttributeString("Payload", payloadSymbol.Id.Id);
|
||||
|
||||
if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef))
|
||||
{
|
||||
writer.WriteAttributeString("Container", payloadSymbol.ContainerRef);
|
||||
}
|
||||
|
||||
writer.WriteAttributeString("Name", payloadSymbol.Name);
|
||||
writer.WriteAttributeString("Size", payloadSymbol.FileSize.Value.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
if (!String.IsNullOrEmpty(payloadSymbol.DownloadUrl))
|
||||
{
|
||||
writer.WriteAttributeString("DownloadUrl", payloadSymbol.DownloadUrl);
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private WixBundlePayloadSymbol CreateBootstrapperApplicationManifestPayloadRow(string baManifestPath)
|
||||
|
|
|
@ -131,10 +131,10 @@ namespace WixToolsetTest.CoreIntegration
|
|||
{ "WixPayloadProperties", new List<string> { "Size" } },
|
||||
};
|
||||
Assert.Equal(4, payloadElements.Count);
|
||||
Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[0].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='credwiz.exe' Container='WixAttachedContainer' Name='credwiz.exe' Size='*' LayoutOnly='no' />", payloadElements[1].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[2].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='cscript.exe' Container='WixAttachedContainer' Name='cscript.exe' Size='*' LayoutOnly='no' />", payloadElements[3].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' />", payloadElements[0].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='credwiz.exe' Container='WixAttachedContainer' Name='credwiz.exe' Size='*' />", payloadElements[1].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' />", payloadElements[2].GetTestXml(ignoreAttributesByElementName));
|
||||
Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='cscript.exe' Container='WixAttachedContainer' Name='cscript.exe' Size='*' />", payloadElements[3].GetTestXml(ignoreAttributesByElementName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,6 +254,61 @@ namespace WixToolsetTest.CoreIntegration
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PopulatesBAManifestWithLayoutOnlyPayloads()
|
||||
{
|
||||
var folder = TestData.Get(@"TestData");
|
||||
|
||||
using (var fs = new DisposableFileSystem())
|
||||
{
|
||||
var baseFolder = fs.GetFolder();
|
||||
var intermediateFolder = Path.Combine(baseFolder, "obj");
|
||||
var binFolder = Path.Combine(baseFolder, "bin");
|
||||
var bundlePath = Path.Combine(binFolder, "test.exe");
|
||||
var baFolderPath = Path.Combine(baseFolder, "ba");
|
||||
var extractFolderPath = Path.Combine(baseFolder, "extract");
|
||||
|
||||
this.BuildMsis(folder, intermediateFolder, binFolder);
|
||||
|
||||
var result = WixRunner.Execute(false, new[]
|
||||
{
|
||||
"build",
|
||||
Path.Combine(folder, "Container", "LayoutPayloadInContainer.wxs"),
|
||||
"-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
|
||||
"-bindpath", binFolder,
|
||||
"-intermediateFolder", intermediateFolder,
|
||||
"-o", bundlePath
|
||||
});
|
||||
|
||||
WixAssert.CompareLineByLine(new string[]
|
||||
{
|
||||
"The layout-only Payload 'SharedPayload' is being added to Container 'FirstX64'. It will not be extracted during layout.",
|
||||
}, result.Messages.Select(m => m.ToString()).ToArray());
|
||||
result.AssertSuccess();
|
||||
|
||||
Assert.True(File.Exists(bundlePath));
|
||||
|
||||
var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
|
||||
extractResult.AssertSuccess();
|
||||
|
||||
var ignoreAttributesByElementName = new Dictionary<string, List<string>>
|
||||
{
|
||||
{ "WixPayloadProperties", new List<string> { "Size" } },
|
||||
};
|
||||
var payloads = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPayloadProperties")
|
||||
.Cast<XmlElement>()
|
||||
.Select(e => e.GetTestXml(ignoreAttributesByElementName))
|
||||
.ToArray();
|
||||
WixAssert.CompareLineByLine(new string[]
|
||||
{
|
||||
"<WixPayloadProperties Package='FirstX64.msi' Payload='FirstX64.msi' Container='FirstX64' Name='FirstX64.msi' Size='*' />",
|
||||
"<WixPayloadProperties Package='FirstX64.msi' Payload='SharedPayload' Container='FirstX64' Name='LayoutPayloadInContainer.wxs' Size='*' />",
|
||||
"<WixPayloadProperties Package='FirstX64.msi' Payload='fC0n41rZK8oW3JK8LzHu6AT3CjdQ' Container='FirstX64' Name='PFiles\\MsiPackage\\test.txt' Size='*' />",
|
||||
"<WixPayloadProperties Payload='SharedPayload' Container='FirstX64' Name='LayoutPayloadInContainer.wxs' Size='*' />",
|
||||
}, payloads);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildMsis(string folder, string intermediateFolder, string binFolder)
|
||||
{
|
||||
var result = WixRunner.Execute(new[]
|
||||
|
|
Загрузка…
Ссылка в новой задаче