aboutsummaryrefslogtreecommitdiff
path: root/src/wix/WixToolset.Core/Librarian.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wix/WixToolset.Core/Librarian.cs')
-rw-r--r--src/wix/WixToolset.Core/Librarian.cs26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/wix/WixToolset.Core/Librarian.cs b/src/wix/WixToolset.Core/Librarian.cs
index 1dd1b44d..2762fb33 100644
--- a/src/wix/WixToolset.Core/Librarian.cs
+++ b/src/wix/WixToolset.Core/Librarian.cs
@@ -21,17 +21,20 @@ namespace WixToolset.Core
21 this.ServiceProvider = serviceProvider; 21 this.ServiceProvider = serviceProvider;
22 22
23 this.Messaging = this.ServiceProvider.GetService<IMessaging>(); 23 this.Messaging = this.ServiceProvider.GetService<IMessaging>();
24 this.LayoutServices = this.ServiceProvider.GetService<ILayoutServices>();
24 } 25 }
25 26
26 private IServiceProvider ServiceProvider { get; } 27 private IServiceProvider ServiceProvider { get; }
27 28
28 private IMessaging Messaging { get; } 29 private IMessaging Messaging { get; }
29 30
31 private ILayoutServices LayoutServices { get; }
32
30 /// <summary> 33 /// <summary>
31 /// Create a library by combining several intermediates (objects). 34 /// Create a library by combining several intermediates (objects).
32 /// </summary> 35 /// </summary>
33 /// <returns>Returns the new library.</returns> 36 /// <returns>Returns tracked input files and the new library.</returns>
34 public Intermediate Combine(ILibraryContext context) 37 public ILibraryResult Combine(ILibraryContext context)
35 { 38 {
36 if (String.IsNullOrEmpty(context.LibraryId)) 39 if (String.IsNullOrEmpty(context.LibraryId))
37 { 40 {
@@ -43,7 +46,9 @@ namespace WixToolset.Core
43 extension.PreCombine(context); 46 extension.PreCombine(context);
44 } 47 }
45 48
49 ILibraryResult result = this.ServiceProvider.GetService<ILibraryResult>();
46 Intermediate library = null; 50 Intermediate library = null;
51 IReadOnlyCollection<ITrackedFile> trackedFiles = null;
47 try 52 try
48 { 53 {
49 var sections = context.Intermediates.SelectMany(i => i.Sections).ToList(); 54 var sections = context.Intermediates.SelectMany(i => i.Sections).ToList();
@@ -56,7 +61,7 @@ namespace WixToolset.Core
56 return null; 61 return null;
57 } 62 }
58 63
59 this.ResolveFilePathsToEmbed(context, sections); 64 trackedFiles = this.ResolveFilePathsToEmbed(context, sections);
60 65
61 foreach (var section in sections) 66 foreach (var section in sections)
62 { 67 {
@@ -71,17 +76,22 @@ namespace WixToolset.Core
71 } 76 }
72 finally 77 finally
73 { 78 {
79 result.Library = library;
80 result.TrackedFiles = trackedFiles;
81
74 foreach (var extension in context.Extensions) 82 foreach (var extension in context.Extensions)
75 { 83 {
76 extension.PostCombine(library); 84 extension.PostCombine(result);
77 } 85 }
78 } 86 }
79 87
80 return this.Messaging.EncounteredError ? null : library; 88 return result;
81 } 89 }
82 90
83 private void ResolveFilePathsToEmbed(ILibraryContext context, IEnumerable<IntermediateSection> sections) 91 private IReadOnlyCollection<ITrackedFile> ResolveFilePathsToEmbed(ILibraryContext context, IEnumerable<IntermediateSection> sections)
84 { 92 {
93 var trackedFiles = new List<ITrackedFile>();
94
85 // Resolve paths to files that are to be embedded in the library. 95 // Resolve paths to files that are to be embedded in the library.
86 if (context.BindFiles) 96 if (context.BindFiles)
87 { 97 {
@@ -105,6 +115,8 @@ namespace WixToolset.Core
105 { 115 {
106 // File was successfully resolved so track the embedded index as the embedded file index. 116 // File was successfully resolved so track the embedded index as the embedded file index.
107 field.Set(new IntermediateFieldPathValue { Embed = true, Path = file }); 117 field.Set(new IntermediateFieldPathValue { Embed = true, Path = file });
118
119 trackedFiles.Add(this.LayoutServices.TrackFile(file, TrackedFileType.Input, symbol.SourceLineNumbers));
108 } 120 }
109 else 121 else
110 { 122 {
@@ -114,6 +126,8 @@ namespace WixToolset.Core
114 } 126 }
115 } 127 }
116 } 128 }
129
130 return trackedFiles;
117 } 131 }
118 132
119 private void Validate(Intermediate library) 133 private void Validate(Intermediate library)