diff options
author | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:48:35 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:53:29 -0700 |
commit | 9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5 (patch) | |
tree | ebf26d0e37244f3014e0c4924a29af7f7e56e2f2 /src | |
parent | 87580cbe111a8df836231a0192dee674cf482f08 (diff) | |
download | wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.gz wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.bz2 wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.zip |
Update to WixOutput file structure to fix embedded file handling
Diffstat (limited to 'src')
21 files changed, 243 insertions, 140 deletions
diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 6b4b9d68..c2164744 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | |||
@@ -462,7 +462,7 @@ namespace WixToolset.Core.Burn | |||
462 | this.TrackedFiles = trackedFiles; | 462 | this.TrackedFiles = trackedFiles; |
463 | 463 | ||
464 | // TODO: Eventually this gets removed | 464 | // TODO: Eventually this gets removed |
465 | var intermediate = new Intermediate(this.Output.Id, new[] { section }, this.Output.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase), this.Output.EmbedFilePaths); | 465 | var intermediate = new Intermediate(this.Output.Id, new[] { section }, this.Output.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); |
466 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); | 466 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); |
467 | intermediate.Save(trackIntermediate.Path); | 467 | intermediate.Save(trackIntermediate.Path); |
468 | trackedFiles.Add(trackIntermediate); | 468 | trackedFiles.Add(trackIntermediate); |
diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs index 0560e336..17251143 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs | |||
@@ -56,7 +56,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
56 | // Embedded files (aka: files from binary .wixlibs) are not content files (because they are hidden | 56 | // Embedded files (aka: files from binary .wixlibs) are not content files (because they are hidden |
57 | // in the .wixlib). | 57 | // in the .wixlib). |
58 | var sourceFile = payload.SourceFile; | 58 | var sourceFile = payload.SourceFile; |
59 | payload.ContentFile = !sourceFile.EmbeddedFileIndex.HasValue; | 59 | payload.ContentFile = !sourceFile.Embed; |
60 | 60 | ||
61 | this.UpdatePayloadPackagingType(payload); | 61 | this.UpdatePayloadPackagingType(payload); |
62 | 62 | ||
diff --git a/src/WixToolset.Core.TestPackage/WixRunner.cs b/src/WixToolset.Core.TestPackage/WixRunner.cs index ab5045fa..d2202328 100644 --- a/src/WixToolset.Core.TestPackage/WixRunner.cs +++ b/src/WixToolset.Core.TestPackage/WixRunner.cs | |||
@@ -16,7 +16,7 @@ namespace WixToolset.Core.TestPackage | |||
16 | return Execute(args, serviceProvider, out messages); | 16 | return Execute(args, serviceProvider, out messages); |
17 | } | 17 | } |
18 | 18 | ||
19 | public static WixRunnerResult Execute(string[] args) | 19 | public static WixRunnerResult Execute(params string[] args) |
20 | { | 20 | { |
21 | var serviceProvider = new WixToolsetServiceProvider(); | 21 | var serviceProvider = new WixToolsetServiceProvider(); |
22 | var exitCode = Execute(args, serviceProvider, out var messages); | 22 | var exitCode = Execute(args, serviceProvider, out var messages); |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 411f64bf..3e4806a7 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
@@ -17,11 +17,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
17 | /// <summary> | 17 | /// <summary> |
18 | /// Binds a databse. | 18 | /// Binds a databse. |
19 | /// </summary> | 19 | /// </summary> |
20 | internal class BindDatabaseCommand | 20 | internal class BindDatabaseCommand : IDisposable |
21 | { | 21 | { |
22 | // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. | 22 | // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. |
23 | internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); | 23 | internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); |
24 | 24 | ||
25 | private bool disposed; | ||
26 | |||
25 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) | 27 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) |
26 | { | 28 | { |
27 | this.ServiceProvider = context.ServiceProvider; | 29 | this.ServiceProvider = context.ServiceProvider; |
@@ -92,7 +94,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
92 | 94 | ||
93 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } | 95 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } |
94 | 96 | ||
95 | public Pdb Pdb { get; private set; } | 97 | public WixOutput Wixout { get; private set; } |
96 | 98 | ||
97 | public void Execute() | 99 | public void Execute() |
98 | { | 100 | { |
@@ -524,29 +526,41 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
524 | trackedFiles.AddRange(command.TrackedFiles); | 526 | trackedFiles.AddRange(command.TrackedFiles); |
525 | } | 527 | } |
526 | 528 | ||
527 | this.Pdb = new Pdb { Output = output }; | 529 | this.Wixout = this.CreateWixout(trackedFiles, this.Intermediate, output); |
528 | |||
529 | if (!String.IsNullOrEmpty(this.OutputPdbPath)) | ||
530 | { | ||
531 | var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); | ||
532 | trackedFiles.Add(trackPdb); | ||
533 | |||
534 | this.Pdb.Save(trackPdb.Path); | ||
535 | } | ||
536 | 530 | ||
537 | this.FileTransfers = fileTransfers; | 531 | this.FileTransfers = fileTransfers; |
538 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). | 532 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). |
539 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.File.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); | 533 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.File.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); |
540 | this.TrackedFiles = trackedFiles; | 534 | this.TrackedFiles = trackedFiles; |
541 | 535 | ||
542 | // TODO: Eventually this gets removed | 536 | // TODO: Eventually this gets removed |
543 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase), this.Intermediate.EmbedFilePaths); | 537 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); |
544 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); | 538 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); |
545 | intermediate.Save(trackIntermediate.Path); | 539 | intermediate.Save(trackIntermediate.Path); |
546 | trackedFiles.Add(trackIntermediate); | 540 | trackedFiles.Add(trackIntermediate); |
541 | } | ||
547 | 542 | ||
548 | //transfer = this.BackendHelper.CreateFileTransfer(intermediatePath, Path.ChangeExtension(this.OutputPath, "wir"), true, FileTransferType.Built); | 543 | private WixOutput CreateWixout(List<ITrackedFile> trackedFiles, Intermediate intermediate, Output output) |
549 | //fileTransfers.Add(transfer); | 544 | { |
545 | WixOutput wixout; | ||
546 | |||
547 | if (String.IsNullOrEmpty(this.OutputPdbPath)) | ||
548 | { | ||
549 | wixout = WixOutput.Create(); | ||
550 | } | ||
551 | else | ||
552 | { | ||
553 | var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); | ||
554 | trackedFiles.Add(trackPdb); | ||
555 | |||
556 | wixout = WixOutput.Create(trackPdb.Path); | ||
557 | } | ||
558 | |||
559 | intermediate.Save(wixout); | ||
560 | |||
561 | output.Save(wixout); | ||
562 | |||
563 | return wixout; | ||
550 | } | 564 | } |
551 | 565 | ||
552 | #if TODO_FINISH_PATCH | 566 | #if TODO_FINISH_PATCH |
@@ -934,5 +948,27 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
934 | 948 | ||
935 | return command.GeneratedTemporaryFiles; | 949 | return command.GeneratedTemporaryFiles; |
936 | } | 950 | } |
951 | |||
952 | #region IDisposable Support | ||
953 | |||
954 | public void Dispose() | ||
955 | { | ||
956 | this.Dispose(true); | ||
957 | } | ||
958 | |||
959 | protected virtual void Dispose(bool disposing) | ||
960 | { | ||
961 | if (!this.disposed) | ||
962 | { | ||
963 | if (disposing) | ||
964 | { | ||
965 | this.Wixout?.Dispose(); | ||
966 | } | ||
967 | |||
968 | this.disposed = true; | ||
969 | } | ||
970 | } | ||
971 | |||
972 | #endregion | ||
937 | } | 973 | } |
938 | } | 974 | } |
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs index 2ebb3f13..5cd7204a 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core.WindowsInstaller | 3 | namespace WixToolset.Core.WindowsInstaller |
4 | { | 4 | { |
5 | using System; | ||
6 | using WixToolset.Core.WindowsInstaller.Bind; | 5 | using WixToolset.Core.WindowsInstaller.Bind; |
7 | using WixToolset.Core.WindowsInstaller.Inscribe; | 6 | using WixToolset.Core.WindowsInstaller.Inscribe; |
8 | using WixToolset.Core.WindowsInstaller.Unbind; | 7 | using WixToolset.Core.WindowsInstaller.Unbind; |
@@ -26,18 +25,21 @@ namespace WixToolset.Core.WindowsInstaller | |||
26 | 25 | ||
27 | var validator = Validator.CreateFromContext(context, "darice.cub"); | 26 | var validator = Validator.CreateFromContext(context, "darice.cub"); |
28 | 27 | ||
29 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 28 | using (var command = new BindDatabaseCommand(context, backendExtensions, validator)) |
30 | command.Execute(); | 29 | { |
30 | command.Execute(); | ||
31 | 31 | ||
32 | var result = context.ServiceProvider.GetService<IBindResult>(); | 32 | var result = context.ServiceProvider.GetService<IBindResult>(); |
33 | result.FileTransfers = command.FileTransfers; | 33 | result.FileTransfers = command.FileTransfers; |
34 | result.TrackedFiles = command.TrackedFiles; | 34 | result.TrackedFiles = command.TrackedFiles; |
35 | 35 | ||
36 | foreach (var extension in backendExtensions) | 36 | foreach (var extension in backendExtensions) |
37 | { | 37 | { |
38 | extension.PostBackendBind(result, command.Pdb); | 38 | extension.PostBackendBind(result, command.Wixout); |
39 | } | ||
40 | |||
41 | return result; | ||
39 | } | 42 | } |
40 | return result; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | public IDecompileResult Decompile(IDecompileContext context) | 45 | public IDecompileResult Decompile(IDecompileContext context) |
diff --git a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs index d5281759..f048b4e2 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core.WindowsInstaller | 3 | namespace WixToolset.Core.WindowsInstaller |
4 | { | 4 | { |
5 | using System; | ||
6 | using WixToolset.Core.WindowsInstaller.Bind; | 5 | using WixToolset.Core.WindowsInstaller.Bind; |
7 | using WixToolset.Core.WindowsInstaller.Unbind; | 6 | using WixToolset.Core.WindowsInstaller.Unbind; |
8 | using WixToolset.Data; | 7 | using WixToolset.Data; |
@@ -25,24 +24,21 @@ namespace WixToolset.Core.WindowsInstaller | |||
25 | 24 | ||
26 | var validator = Validator.CreateFromContext(context, "mergemod.cub"); | 25 | var validator = Validator.CreateFromContext(context, "mergemod.cub"); |
27 | 26 | ||
28 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 27 | using (var command = new BindDatabaseCommand(context, backendExtensions, validator)) |
29 | command.Execute(); | 28 | { |
29 | command.Execute(); | ||
30 | 30 | ||
31 | var result = context.ServiceProvider.GetService<IBindResult>(); | 31 | var result = context.ServiceProvider.GetService<IBindResult>(); |
32 | result.FileTransfers = command.FileTransfers; | 32 | result.FileTransfers = command.FileTransfers; |
33 | result.TrackedFiles = command.TrackedFiles; | 33 | result.TrackedFiles = command.TrackedFiles; |
34 | 34 | ||
35 | foreach (var extension in backendExtensions) | 35 | foreach (var extension in backendExtensions) |
36 | { | 36 | { |
37 | extension.PostBackendBind(result, command.Pdb); | 37 | extension.PostBackendBind(result, command.Wixout); |
38 | } | 38 | } |
39 | 39 | ||
40 | if (!String.IsNullOrEmpty(context.OutputPdbPath)) | 40 | return result; |
41 | { | ||
42 | command.Pdb?.Save(context.OutputPdbPath); | ||
43 | } | 41 | } |
44 | |||
45 | return result; | ||
46 | } | 42 | } |
47 | 43 | ||
48 | public IDecompileResult Decompile(IDecompileContext context) | 44 | public IDecompileResult Decompile(IDecompileContext context) |
@@ -67,10 +63,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
67 | return result; | 63 | return result; |
68 | } | 64 | } |
69 | 65 | ||
70 | public bool Inscribe(IInscribeContext context) | 66 | public bool Inscribe(IInscribeContext context) => false; |
71 | { | ||
72 | return false; | ||
73 | } | ||
74 | 67 | ||
75 | public Intermediate Unbind(IUnbindContext context) | 68 | public Intermediate Unbind(IUnbindContext context) |
76 | { | 69 | { |
diff --git a/src/WixToolset.Core/Bind/ExpectedExtractFile.cs b/src/WixToolset.Core/Bind/ExpectedExtractFile.cs index afad12fc..b27cdfee 100644 --- a/src/WixToolset.Core/Bind/ExpectedExtractFile.cs +++ b/src/WixToolset.Core/Bind/ExpectedExtractFile.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Core.Bind | 3 | namespace WixToolset.Core.Bind |
4 | { | 4 | { |
@@ -9,7 +9,7 @@ namespace WixToolset.Core.Bind | |||
9 | { | 9 | { |
10 | public Uri Uri { get; set; } | 10 | public Uri Uri { get; set; } |
11 | 11 | ||
12 | public int EmbeddedFileIndex { get; set; } | 12 | public string EmbeddedFileId { get; set; } |
13 | 13 | ||
14 | public string OutputPath { get; set; } | 14 | public string OutputPath { get; set; } |
15 | } | 15 | } |
diff --git a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs index 644e5c63..35c8a2f0 100644 --- a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs +++ b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs | |||
@@ -15,7 +15,7 @@ namespace WixToolset.Core.Bind | |||
15 | /// </summary> | 15 | /// </summary> |
16 | internal class ExtractEmbeddedFiles | 16 | internal class ExtractEmbeddedFiles |
17 | { | 17 | { |
18 | private Dictionary<Uri, SortedList<int, string>> filesWithEmbeddedFiles = new Dictionary<Uri, SortedList<int, string>>(); | 18 | private readonly Dictionary<Uri, SortedList<string, string>> filesWithEmbeddedFiles = new Dictionary<Uri, SortedList<string, string>>(); |
19 | 19 | ||
20 | public IEnumerable<Uri> Uris => this.filesWithEmbeddedFiles.Keys; | 20 | public IEnumerable<Uri> Uris => this.filesWithEmbeddedFiles.Keys; |
21 | 21 | ||
@@ -23,28 +23,28 @@ namespace WixToolset.Core.Bind | |||
23 | /// Adds an embedded file index to track and returns the path where the embedded file will be extracted. Duplicates will return the same extract path. | 23 | /// Adds an embedded file index to track and returns the path where the embedded file will be extracted. Duplicates will return the same extract path. |
24 | /// </summary> | 24 | /// </summary> |
25 | /// <param name="uri">Uri to file containing the embedded files.</param> | 25 | /// <param name="uri">Uri to file containing the embedded files.</param> |
26 | /// <param name="embeddedFileIndex">Index of the embedded file to extract.</param> | 26 | /// <param name="embeddedFileId">Id of the embedded file to extract.</param> |
27 | /// <param name="tempPath">Path where temporary files should be placed.</param> | 27 | /// <param name="extractFolder">Folder where extracted files should be placed.</param> |
28 | /// <returns>The extract path for the embedded file.</returns> | 28 | /// <returns>The extract path for the embedded file.</returns> |
29 | public string AddEmbeddedFileIndex(Uri uri, int embeddedFileIndex, string tempPath) | 29 | public string AddEmbeddedFileToExtract(Uri uri, string embeddedFileId, string extractFolder) |
30 | { | 30 | { |
31 | // If the uri to the file that contains the embedded file does not already have embedded files | 31 | // If the uri to the file that contains the embedded file does not already have embedded files |
32 | // being extracted, create the dictionary to track that. | 32 | // being extracted, create the dictionary to track that. |
33 | if (!this.filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) | 33 | if (!this.filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) |
34 | { | 34 | { |
35 | extracts = new SortedList<int, string>(); | 35 | extracts = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase); |
36 | this.filesWithEmbeddedFiles.Add(uri, extracts); | 36 | this.filesWithEmbeddedFiles.Add(uri, extracts); |
37 | } | 37 | } |
38 | 38 | ||
39 | // If the embedded file is not already tracked in the dictionary of extracts, add it. | 39 | // If the embedded file is not already tracked in the dictionary of extracts, add it. |
40 | if (!extracts.TryGetValue(embeddedFileIndex, out var extractPath)) | 40 | if (!extracts.TryGetValue(embeddedFileId, out var extractPath)) |
41 | { | 41 | { |
42 | string localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); | 42 | var localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); |
43 | string unique = this.HashUri(uri.AbsoluteUri); | 43 | var unique = this.HashUri(uri.AbsoluteUri); |
44 | string extractedName = String.Format(CultureInfo.InvariantCulture, @"{0}_{1}\{2}", localFileNameWithoutExtension, unique, embeddedFileIndex); | 44 | var extractedName = String.Format(CultureInfo.InvariantCulture, @"{0}_{1}\{2}", localFileNameWithoutExtension, unique, embeddedFileId); |
45 | 45 | ||
46 | extractPath = Path.Combine(tempPath, extractedName); | 46 | extractPath = Path.GetFullPath(Path.Combine(extractFolder, extractedName)); |
47 | extracts.Add(embeddedFileIndex, extractPath); | 47 | extracts.Add(embeddedFileId, extractPath); |
48 | } | 48 | } |
49 | 49 | ||
50 | return extractPath; | 50 | return extractPath; |
@@ -52,35 +52,39 @@ namespace WixToolset.Core.Bind | |||
52 | 52 | ||
53 | public IEnumerable<ExpectedExtractFile> GetExpectedEmbeddedFiles() | 53 | public IEnumerable<ExpectedExtractFile> GetExpectedEmbeddedFiles() |
54 | { | 54 | { |
55 | var files = new List<ExpectedExtractFile>(); | ||
56 | |||
55 | foreach (var uriWithExtracts in this.filesWithEmbeddedFiles) | 57 | foreach (var uriWithExtracts in this.filesWithEmbeddedFiles) |
56 | { | 58 | { |
57 | foreach (var extracts in uriWithExtracts.Value) | 59 | foreach (var extracts in uriWithExtracts.Value) |
58 | { | 60 | { |
59 | yield return new ExpectedExtractFile | 61 | files.Add(new ExpectedExtractFile |
60 | { | 62 | { |
61 | Uri = uriWithExtracts.Key, | 63 | Uri = uriWithExtracts.Key, |
62 | EmbeddedFileIndex = extracts.Key, | 64 | EmbeddedFileId = extracts.Key, |
63 | OutputPath = extracts.Value, | 65 | OutputPath = extracts.Value, |
64 | }; | 66 | }); |
65 | } | 67 | } |
66 | } | 68 | } |
69 | |||
70 | return files; | ||
67 | } | 71 | } |
68 | 72 | ||
69 | public IEnumerable<ExpectedExtractFile> GetExtractFilesForUri(Uri uri) | 73 | public IEnumerable<ExpectedExtractFile> GetExtractFilesForUri(Uri uri) |
70 | { | 74 | { |
71 | if (!this.filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) | 75 | if (!this.filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) |
72 | { | 76 | { |
73 | extracts = new SortedList<int, string>(); | 77 | extracts = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase); |
74 | } | 78 | } |
75 | 79 | ||
76 | return extracts.Select(e => new ExpectedExtractFile() { Uri = uri, EmbeddedFileIndex = e.Key, OutputPath = e.Value }); | 80 | return extracts.Select(e => new ExpectedExtractFile { Uri = uri, EmbeddedFileId = e.Key, OutputPath = e.Value }); |
77 | } | 81 | } |
78 | 82 | ||
79 | private string HashUri(string uri) | 83 | private string HashUri(string uri) |
80 | { | 84 | { |
81 | using (SHA1 sha1 = new SHA1CryptoServiceProvider()) | 85 | using (SHA1 sha1 = new SHA1CryptoServiceProvider()) |
82 | { | 86 | { |
83 | byte[] hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(uri)); | 87 | var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(uri)); |
84 | return Convert.ToBase64String(hash).TrimEnd('=').Replace('+', '-').Replace('/', '_'); | 88 | return Convert.ToBase64String(hash).TrimEnd('=').Replace('+', '-').Replace('/', '_'); |
85 | } | 89 | } |
86 | } | 90 | } |
diff --git a/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs b/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs index d82609db..683c3c50 100644 --- a/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs +++ b/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs | |||
@@ -2,10 +2,9 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core.Bind | 3 | namespace WixToolset.Core.Bind |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
6 | using System.IO; | ||
7 | using System.Linq; | 7 | using System.Linq; |
8 | using System.Reflection; | ||
9 | using WixToolset.Data; | 8 | using WixToolset.Data; |
10 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
11 | 10 | ||
@@ -26,41 +25,18 @@ namespace WixToolset.Core.Bind | |||
26 | { | 25 | { |
27 | var baseUri = expectedEmbeddedFileByUri.Key; | 26 | var baseUri = expectedEmbeddedFileByUri.Key; |
28 | 27 | ||
29 | Stream stream = null; | 28 | using (var wixout = WixOutput.Read(baseUri)) |
30 | try | ||
31 | { | 29 | { |
32 | // If the embedded files are stored in an assembly resource stream (usually | 30 | var uniqueIds = new SortedSet<string>(StringComparer.OrdinalIgnoreCase); |
33 | // a .wixlib embedded in a WixExtension). | ||
34 | if ("embeddedresource" == baseUri.Scheme) | ||
35 | { | ||
36 | var assemblyPath = Path.GetFullPath(baseUri.LocalPath); | ||
37 | var resourceName = baseUri.Fragment.TrimStart('#'); | ||
38 | |||
39 | var assembly = Assembly.LoadFile(assemblyPath); | ||
40 | stream = assembly.GetManifestResourceStream(resourceName); | ||
41 | } | ||
42 | else // normal file (usually a binary .wixlib on disk). | ||
43 | { | ||
44 | stream = File.OpenRead(baseUri.LocalPath); | ||
45 | } | ||
46 | 31 | ||
47 | using (var fs = FileStructure.Read(stream)) | 32 | foreach (var embeddedFile in expectedEmbeddedFileByUri) |
48 | { | 33 | { |
49 | var uniqueIndicies = new SortedSet<int>(); | 34 | if (uniqueIds.Add(embeddedFile.EmbeddedFileId)) |
50 | |||
51 | foreach (var embeddedFile in expectedEmbeddedFileByUri) | ||
52 | { | 35 | { |
53 | if (uniqueIndicies.Add(embeddedFile.EmbeddedFileIndex)) | 36 | wixout.ExtractEmbeddedFile(embeddedFile.EmbeddedFileId, embeddedFile.OutputPath); |
54 | { | ||
55 | fs.ExtractEmbeddedFile(embeddedFile.EmbeddedFileIndex, embeddedFile.OutputPath); | ||
56 | } | ||
57 | } | 37 | } |
58 | } | 38 | } |
59 | } | 39 | } |
60 | finally | ||
61 | { | ||
62 | stream?.Close(); | ||
63 | } | ||
64 | } | 40 | } |
65 | } | 41 | } |
66 | } | 42 | } |
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index 2c213402..19a26915 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | |||
@@ -98,9 +98,9 @@ namespace WixToolset.Core.Bind | |||
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | // File is embedded and path to it was not modified above. | 100 | // File is embedded and path to it was not modified above. |
101 | if (objectField.EmbeddedFileIndex.HasValue && isDefault) | 101 | if (isDefault && objectField.Embed) |
102 | { | 102 | { |
103 | var extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileIndex(objectField.BaseUri, objectField.EmbeddedFileIndex.Value, this.IntermediateFolder); | 103 | var extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileToExtract(objectField.BaseUri, objectField.Path, this.IntermediateFolder); |
104 | 104 | ||
105 | // Set the path to the embedded file once where it will be extracted. | 105 | // Set the path to the embedded file once where it will be extracted. |
106 | field.Set(extractPath); | 106 | field.Set(extractPath); |
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 972258fe..5ee60984 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -100,29 +100,38 @@ namespace WixToolset.Core.CommandLine | |||
100 | 100 | ||
101 | if (this.OutputType == OutputType.Library) | 101 | if (this.OutputType == OutputType.Library) |
102 | { | 102 | { |
103 | var wixlib = this.LibraryPhase(wixobjs, wxls, this.commandLine.BindFiles, this.commandLine.BindPaths); | 103 | using (new IntermediateFieldContext("wix.lib")) |
104 | |||
105 | if (!this.Messaging.EncounteredError) | ||
106 | { | 104 | { |
107 | wixlib.Save(this.commandLine.OutputFile); | 105 | var wixlib = this.LibraryPhase(wixobjs, wxls, this.commandLine.BindFiles, this.commandLine.BindPaths); |
106 | |||
107 | if (!this.Messaging.EncounteredError) | ||
108 | { | ||
109 | wixlib.Save(this.commandLine.OutputFile); | ||
110 | } | ||
108 | } | 111 | } |
109 | } | 112 | } |
110 | else | 113 | else |
111 | { | 114 | { |
112 | if (wixipl == null) | 115 | using (new IntermediateFieldContext("wix.link")) |
113 | { | ||
114 | wixipl = this.LinkPhase(wixobjs, this.commandLine.LibraryFilePaths, creator); | ||
115 | } | ||
116 | |||
117 | if (!this.Messaging.EncounteredError) | ||
118 | { | 116 | { |
119 | if (this.OutputType == OutputType.IntermediatePostLink) | 117 | if (wixipl == null) |
120 | { | 118 | { |
121 | wixipl.Save(this.commandLine.OutputFile); | 119 | wixipl = this.LinkPhase(wixobjs, this.commandLine.LibraryFilePaths, creator); |
122 | } | 120 | } |
123 | else | 121 | |
122 | if (!this.Messaging.EncounteredError) | ||
124 | { | 123 | { |
125 | this.BindPhase(wixipl, wxls, filterCultures, this.commandLine.CabCachePath, this.commandLine.BindPaths, this.commandLine.BurnStubPath); | 124 | if (this.OutputType == OutputType.IntermediatePostLink) |
125 | { | ||
126 | wixipl.Save(this.commandLine.OutputFile); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | using (new IntermediateFieldContext("wix.bind")) | ||
131 | { | ||
132 | this.BindPhase(wixipl, wxls, filterCultures, this.commandLine.CabCachePath, this.commandLine.BindPaths, this.commandLine.BurnStubPath); | ||
133 | } | ||
134 | } | ||
126 | } | 135 | } |
127 | } | 136 | } |
128 | } | 137 | } |
@@ -469,6 +478,7 @@ namespace WixToolset.Core.CommandLine | |||
469 | break; | 478 | break; |
470 | } | 479 | } |
471 | 480 | ||
481 | case "bf": | ||
472 | case "bindfiles": | 482 | case "bindfiles": |
473 | this.BindFiles = true; | 483 | this.BindFiles = true; |
474 | return true; | 484 | return true; |
diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs index 3c1810ac..5c0fb302 100644 --- a/src/WixToolset.Core/Librarian.cs +++ b/src/WixToolset.Core/Librarian.cs | |||
@@ -56,14 +56,14 @@ namespace WixToolset.Core | |||
56 | return null; | 56 | return null; |
57 | } | 57 | } |
58 | 58 | ||
59 | var embedFilePaths = this.ResolveFilePathsToEmbed(context, sections); | 59 | this.ResolveFilePathsToEmbed(context, sections); |
60 | 60 | ||
61 | foreach (var section in sections) | 61 | foreach (var section in sections) |
62 | { | 62 | { |
63 | section.LibraryId = context.LibraryId; | 63 | section.LibraryId = context.LibraryId; |
64 | } | 64 | } |
65 | 65 | ||
66 | library = new Intermediate(context.LibraryId, sections, localizationsByCulture, embedFilePaths); | 66 | library = new Intermediate(context.LibraryId, sections, localizationsByCulture); |
67 | 67 | ||
68 | this.Validate(library); | 68 | this.Validate(library); |
69 | } | 69 | } |
@@ -78,10 +78,8 @@ namespace WixToolset.Core | |||
78 | return this.Messaging.EncounteredError ? null : library; | 78 | return this.Messaging.EncounteredError ? null : library; |
79 | } | 79 | } |
80 | 80 | ||
81 | private List<string> ResolveFilePathsToEmbed(ILibraryContext context, IEnumerable<IntermediateSection> sections) | 81 | private void ResolveFilePathsToEmbed(ILibraryContext context, IEnumerable<IntermediateSection> sections) |
82 | { | 82 | { |
83 | var embedFilePaths = new List<string>(); | ||
84 | |||
85 | // Resolve paths to files that are to be embedded in the library. | 83 | // Resolve paths to files that are to be embedded in the library. |
86 | if (context.BindFiles) | 84 | if (context.BindFiles) |
87 | { | 85 | { |
@@ -104,9 +102,7 @@ namespace WixToolset.Core | |||
104 | if (!String.IsNullOrEmpty(file)) | 102 | if (!String.IsNullOrEmpty(file)) |
105 | { | 103 | { |
106 | // File was successfully resolved so track the embedded index as the embedded file index. | 104 | // File was successfully resolved so track the embedded index as the embedded file index. |
107 | field.Set(new IntermediateFieldPathValue { EmbeddedFileIndex = embedFilePaths.Count }); | 105 | field.Set(new IntermediateFieldPathValue { Embed = true, Path = file }); |
108 | |||
109 | embedFilePaths.Add(file); | ||
110 | } | 106 | } |
111 | else | 107 | else |
112 | { | 108 | { |
@@ -116,8 +112,6 @@ namespace WixToolset.Core | |||
116 | } | 112 | } |
117 | } | 113 | } |
118 | } | 114 | } |
119 | |||
120 | return embedFilePaths; | ||
121 | } | 115 | } |
122 | 116 | ||
123 | private void Validate(Intermediate library) | 117 | private void Validate(Intermediate library) |
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index 81696840..6ef252b7 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
@@ -564,7 +564,7 @@ namespace WixToolset.Core | |||
564 | var collate = new CollateLocalizationsCommand(this.Messaging, localizations); | 564 | var collate = new CollateLocalizationsCommand(this.Messaging, localizations); |
565 | var localizationsByCulture = collate.Execute(); | 565 | var localizationsByCulture = collate.Execute(); |
566 | 566 | ||
567 | intermediate = new Intermediate(resolvedSection.Id, new[] { resolvedSection }, localizationsByCulture, null); | 567 | intermediate = new Intermediate(resolvedSection.Id, new[] { resolvedSection }, localizationsByCulture); |
568 | 568 | ||
569 | #if MOVE_TO_BACKEND | 569 | #if MOVE_TO_BACKEND |
570 | this.CheckOutputConsistency(output); | 570 | this.CheckOutputConsistency(output); |
diff --git a/src/test/Example.Extension/Data/example.wir b/src/test/Example.Extension/Data/example.wir index 8e32f901..d1ee8b90 100644 --- a/src/test/Example.Extension/Data/example.wir +++ b/src/test/Example.Extension/Data/example.wir | |||
Binary files differ | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index d056a1d6..e201b61f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
@@ -312,9 +312,8 @@ namespace WixToolsetTest.CoreIntegration | |||
312 | var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); | 312 | var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); |
313 | Assert.True(File.Exists(pdbPath)); | 313 | Assert.True(File.Exists(pdbPath)); |
314 | 314 | ||
315 | var pdb = Pdb.Load(pdbPath, suppressVersionCheck: true); | 315 | var output = Output.Load(pdbPath, suppressVersionCheck: true); |
316 | Assert.NotNull(pdb); | 316 | Assert.NotNull(output); |
317 | Assert.NotNull(pdb.Output); | ||
318 | } | 317 | } |
319 | } | 318 | } |
320 | 319 | ||
@@ -449,6 +448,74 @@ namespace WixToolsetTest.CoreIntegration | |||
449 | } | 448 | } |
450 | 449 | ||
451 | [Fact] | 450 | [Fact] |
451 | public void CanBuildBinaryWixlib() | ||
452 | { | ||
453 | var folder = TestData.Get(@"TestData\SingleFile"); | ||
454 | |||
455 | using (var fs = new DisposableFileSystem()) | ||
456 | { | ||
457 | var baseFolder = fs.GetFolder(); | ||
458 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
459 | |||
460 | var result = WixRunner.Execute( | ||
461 | "build", | ||
462 | Path.Combine(folder, "Package.wxs"), | ||
463 | Path.Combine(folder, "PackageComponents.wxs"), | ||
464 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
465 | "-bindpath", Path.Combine(folder, "data"), | ||
466 | "-intermediateFolder", intermediateFolder, | ||
467 | "-bindfiles", | ||
468 | "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); | ||
469 | |||
470 | result.AssertSuccess(); | ||
471 | |||
472 | using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) | ||
473 | { | ||
474 | Assert.NotNull(wixout.GetDataStream("wix-ir.json")); | ||
475 | |||
476 | var text = wixout.GetData("wix-ir/test.txt"); | ||
477 | Assert.Equal("This is test.txt.", text); | ||
478 | } | ||
479 | } | ||
480 | } | ||
481 | |||
482 | [Fact] | ||
483 | public void CanBuildBinaryWixlibWithCollidingFilenames() | ||
484 | { | ||
485 | var folder = TestData.Get(@"TestData\SameFileFolders"); | ||
486 | |||
487 | using (var fs = new DisposableFileSystem()) | ||
488 | { | ||
489 | var baseFolder = fs.GetFolder(); | ||
490 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
491 | |||
492 | var result = WixRunner.Execute( | ||
493 | "build", | ||
494 | Path.Combine(folder, "TestComponents.wxs"), | ||
495 | "-bindpath", Path.Combine(folder, "data"), | ||
496 | "-intermediateFolder", intermediateFolder, | ||
497 | "-bindfiles", | ||
498 | "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); | ||
499 | |||
500 | result.AssertSuccess(); | ||
501 | |||
502 | using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) | ||
503 | { | ||
504 | Assert.NotNull(wixout.GetDataStream("wix-ir.json")); | ||
505 | |||
506 | var text = wixout.GetData("wix-ir/test.txt"); | ||
507 | Assert.Equal(@"This is a\test.txt.", text); | ||
508 | |||
509 | var text2 = wixout.GetData("wix-ir/test.txt-1"); | ||
510 | Assert.Equal(@"This is b\test.txt.", text2); | ||
511 | |||
512 | var text3 = wixout.GetData("wix-ir/test.txt-2"); | ||
513 | Assert.Equal(@"This is c\test.txt.", text3); | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | |||
518 | [Fact] | ||
452 | public void CanBuildWithIncludePath() | 519 | public void CanBuildWithIncludePath() |
453 | { | 520 | { |
454 | var folder = TestData.Get(@"TestData\IncludePath"); | 521 | var folder = TestData.Get(@"TestData\IncludePath"); |
@@ -459,8 +526,7 @@ namespace WixToolsetTest.CoreIntegration | |||
459 | var baseFolder = fs.GetFolder(); | 526 | var baseFolder = fs.GetFolder(); |
460 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 527 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
461 | 528 | ||
462 | var result = WixRunner.Execute(new[] | 529 | var result = WixRunner.Execute( |
463 | { | ||
464 | "build", | 530 | "build", |
465 | Path.Combine(folder, "Package.wxs"), | 531 | Path.Combine(folder, "Package.wxs"), |
466 | Path.Combine(folder, "PackageComponents.wxs"), | 532 | Path.Combine(folder, "PackageComponents.wxs"), |
@@ -468,8 +534,7 @@ namespace WixToolsetTest.CoreIntegration | |||
468 | "-bindpath", bindpath, | 534 | "-bindpath", bindpath, |
469 | "-intermediateFolder", intermediateFolder, | 535 | "-intermediateFolder", intermediateFolder, |
470 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | 536 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), |
471 | "-i", bindpath, | 537 | "-i", bindpath); |
472 | }); | ||
473 | 538 | ||
474 | result.AssertSuccess(); | 539 | result.AssertSuccess(); |
475 | 540 | ||
@@ -635,8 +700,8 @@ namespace WixToolsetTest.CoreIntegration | |||
635 | 700 | ||
636 | result.AssertSuccess(); | 701 | result.AssertSuccess(); |
637 | 702 | ||
638 | var pdb = Pdb.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); | 703 | var output = Output.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); |
639 | var caRows = pdb.Output.Tables["CustomAction"].Rows.Single(); | 704 | var caRows = output.Tables["CustomAction"].Rows.Single(); |
640 | Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); | 705 | Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); |
641 | Assert.Equal("51", caRows.FieldAsString(1)); | 706 | Assert.Equal("51", caRows.FieldAsString(1)); |
642 | Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); | 707 | Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); |
@@ -711,8 +776,8 @@ namespace WixToolsetTest.CoreIntegration | |||
711 | 776 | ||
712 | result.AssertSuccess(); | 777 | result.AssertSuccess(); |
713 | 778 | ||
714 | var pdb = Pdb.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); | 779 | var output = Output.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); |
715 | Assert.NotEmpty(pdb.Output.SubStorages); | 780 | Assert.NotEmpty(output.SubStorages); |
716 | } | 781 | } |
717 | } | 782 | } |
718 | } | 783 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs new file mode 100644 index 00000000..765e6778 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs | |||
@@ -0,0 +1,16 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Directory="INSTALLFOLDER:\a"> | ||
6 | <File Source="a\test.txt" /> | ||
7 | </Component> | ||
8 | <Component Directory="INSTALLFOLDER:\b"> | ||
9 | <File Source="b\test.txt" /> | ||
10 | </Component> | ||
11 | <Component Directory="INSTALLFOLDER:\c"> | ||
12 | <File Source="c\test.txt" /> | ||
13 | </Component> | ||
14 | </ComponentGroup> | ||
15 | </Fragment> | ||
16 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt new file mode 100644 index 00000000..1970cae6 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt | |||
@@ -0,0 +1 @@ | |||
This is a\test.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt new file mode 100644 index 00000000..fa2c7082 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt | |||
@@ -0,0 +1 @@ | |||
This is b\test.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt new file mode 100644 index 00000000..1c0cbda6 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt | |||
@@ -0,0 +1 @@ | |||
This is c\test.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 1f8860ef..dba30bd6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -36,6 +36,10 @@ | |||
36 | <Content Include="TestData\Font\FontTitle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 36 | <Content Include="TestData\Font\FontTitle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
37 | <Content Include="TestData\Icon\SampleIcon.wxs" CopyToOutputDirectory="PreserveNewest" /> | 37 | <Content Include="TestData\Icon\SampleIcon.wxs" CopyToOutputDirectory="PreserveNewest" /> |
38 | <Content Include="TestData\LockPermissions\EmptyPermissions.wxs" CopyToOutputDirectory="PreserveNewest" /> | 38 | <Content Include="TestData\LockPermissions\EmptyPermissions.wxs" CopyToOutputDirectory="PreserveNewest" /> |
39 | <Content Include="TestData\SameFileFolders\data\a\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
40 | <Content Include="TestData\SameFileFolders\data\c\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
41 | <Content Include="TestData\SameFileFolders\data\b\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
42 | <Content Include="TestData\SameFileFolders\TestComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
39 | <Content Include="TestData\ProductWithComponentGroupRef\MinimalComponentGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> | 43 | <Content Include="TestData\ProductWithComponentGroupRef\MinimalComponentGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> |
40 | <Content Include="TestData\ProductWithComponentGroupRef\Product.wxs" CopyToOutputDirectory="PreserveNewest" /> | 44 | <Content Include="TestData\ProductWithComponentGroupRef\Product.wxs" CopyToOutputDirectory="PreserveNewest" /> |
41 | <Content Include="TestData\Registry\RegistryValue.wxs" CopyToOutputDirectory="PreserveNewest" /> | 45 | <Content Include="TestData\Registry\RegistryValue.wxs" CopyToOutputDirectory="PreserveNewest" /> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs index 668c273a..1d359241 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs | |||
@@ -128,14 +128,14 @@ namespace WixToolsetTest.CoreIntegration | |||
128 | { | 128 | { |
129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | 129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); |
130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | 130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; |
131 | Assert.Contains("Example.Extension", path); | 131 | Assert.StartsWith(Path.Combine(baseFolder, @"obj\Example.Extension"), path); |
132 | Assert.EndsWith(@"\0", path); | 132 | Assert.EndsWith(@"wix-ir\example.txt", path); |
133 | Assert.Equal(@"BinFromWir", binary.Id.Id); | 133 | Assert.Equal(@"BinFromWir", binary.Id.Id); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | [Fact(Skip = "Test demonstrates failure")] | 138 | [Fact] |
139 | public void CanBuildWixiplUsingExtensionLibrary() | 139 | public void CanBuildWixiplUsingExtensionLibrary() |
140 | { | 140 | { |
141 | var folder = TestData.Get(@"TestData\Wixipl"); | 141 | var folder = TestData.Get(@"TestData\Wixipl"); |
@@ -171,7 +171,7 @@ namespace WixToolsetTest.CoreIntegration | |||
171 | 171 | ||
172 | result.AssertSuccess(); | 172 | result.AssertSuccess(); |
173 | 173 | ||
174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | 174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); |
175 | var section = intermediate.Sections.Single(); | 175 | var section = intermediate.Sections.Single(); |
176 | 176 | ||
177 | { | 177 | { |
@@ -183,8 +183,8 @@ namespace WixToolsetTest.CoreIntegration | |||
183 | { | 183 | { |
184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | 184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); |
185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | 185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; |
186 | Assert.Contains("Example.Extension", path); | 186 | Assert.StartsWith(Path.Combine(baseFolder, @"obj\test"), path); |
187 | Assert.EndsWith(@"\0", path); | 187 | Assert.EndsWith(@"wix-ir\example.txt", path); |
188 | Assert.Equal(@"BinFromWir", binary.Id.Id); | 188 | Assert.Equal(@"BinFromWir", binary.Id.Id); |
189 | } | 189 | } |
190 | } | 190 | } |