diff options
author | Rob Mensching <rob@firegiant.com> | 2017-12-06 11:39:26 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2017-12-06 11:40:03 -0800 |
commit | 5ba862bfa618c89a563d555e8ce7b44a904df406 (patch) | |
tree | cc2655422be3eec1f200efcbc0e562349c229274 /src/WixToolset.Core | |
parent | e53afb01c6e01bb9e6521fa77d31e575abc73f9c (diff) | |
download | wix-5ba862bfa618c89a563d555e8ce7b44a904df406.tar.gz wix-5ba862bfa618c89a563d555e8ce7b44a904df406.tar.bz2 wix-5ba862bfa618c89a563d555e8ce7b44a904df406.zip |
Add support for loading Intermediates from extensions
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r-- | src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs | 7 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/LinkContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/Linker.cs | 52 |
4 files changed, 20 insertions, 47 deletions
diff --git a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs index 28fc4817..c6e21973 100644 --- a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs +++ b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs | |||
@@ -28,19 +28,16 @@ namespace WixToolset.Core.Bind | |||
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 AddEmbeddedFileIndex(Uri uri, int embeddedFileIndex, string tempPath) |
30 | { | 30 | { |
31 | string extractPath; | ||
32 | SortedList<int, string> extracts; | ||
33 | |||
34 | // 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 |
35 | // being extracted, create the dictionary to track that. | 32 | // being extracted, create the dictionary to track that. |
36 | if (!filesWithEmbeddedFiles.TryGetValue(uri, out extracts)) | 33 | if (!filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) |
37 | { | 34 | { |
38 | extracts = new SortedList<int, string>(); | 35 | extracts = new SortedList<int, string>(); |
39 | filesWithEmbeddedFiles.Add(uri, extracts); | 36 | filesWithEmbeddedFiles.Add(uri, extracts); |
40 | } | 37 | } |
41 | 38 | ||
42 | // 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. |
43 | if (!extracts.TryGetValue(embeddedFileIndex, out extractPath)) | 40 | if (!extracts.TryGetValue(embeddedFileIndex, out var extractPath)) |
44 | { | 41 | { |
45 | string localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); | 42 | string localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); |
46 | string unique = this.HashUri(uri.AbsoluteUri); | 43 | string unique = this.HashUri(uri.AbsoluteUri); |
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 79bacd22..7a63b869 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -168,8 +168,10 @@ namespace WixToolset.Core | |||
168 | var context = this.ServiceProvider.GetService<ILinkContext>(); | 168 | var context = this.ServiceProvider.GetService<ILinkContext>(); |
169 | context.Messaging = Messaging.Instance; | 169 | context.Messaging = Messaging.Instance; |
170 | context.Extensions = this.ExtensionManager.Create<ILinkerExtension>(); | 170 | context.Extensions = this.ExtensionManager.Create<ILinkerExtension>(); |
171 | context.Intermediates = intermediates.Union(libraries).ToList(); | 171 | context.ExtensionData = this.ExtensionManager.Create<IExtensionData>(); |
172 | context.ExpectedOutputType = this.OutputType; | 172 | context.ExpectedOutputType = this.OutputType; |
173 | context.Intermediates = intermediates.Union(libraries).ToList(); | ||
174 | context.TupleDefinitionCreator = creator; | ||
173 | 175 | ||
174 | var linker = new Linker(); | 176 | var linker = new Linker(); |
175 | var output = linker.Link(context); | 177 | var output = linker.Link(context); |
diff --git a/src/WixToolset.Core/LinkContext.cs b/src/WixToolset.Core/LinkContext.cs index c3631f72..1384cf98 100644 --- a/src/WixToolset.Core/LinkContext.cs +++ b/src/WixToolset.Core/LinkContext.cs | |||
@@ -21,8 +21,12 @@ namespace WixToolset.Core | |||
21 | 21 | ||
22 | public IEnumerable<ILinkerExtension> Extensions { get; set; } | 22 | public IEnumerable<ILinkerExtension> Extensions { get; set; } |
23 | 23 | ||
24 | public IEnumerable<IExtensionData> ExtensionData { get; set; } | ||
25 | |||
24 | public OutputType ExpectedOutputType { get; set; } | 26 | public OutputType ExpectedOutputType { get; set; } |
25 | 27 | ||
26 | public IEnumerable<Intermediate> Intermediates { get; set; } | 28 | public IEnumerable<Intermediate> Intermediates { get; set; } |
29 | |||
30 | public ITupleDefinitionCreator TupleDefinitionCreator { get; set; } | ||
27 | } | 31 | } |
28 | } | 32 | } |
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index 7faf69ba..c893a01d 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
@@ -56,32 +56,6 @@ namespace WixToolset.Core | |||
56 | //internal IBindVariableResolver WixVariableResolver { get; set; } | 56 | //internal IBindVariableResolver WixVariableResolver { get; set; } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Adds an extension. | ||
60 | /// </summary> | ||
61 | /// <param name="extension">The extension to add.</param> | ||
62 | //public void AddExtensionData(IExtensionData extension) | ||
63 | //{ | ||
64 | // if (null != extension.TableDefinitions) | ||
65 | // { | ||
66 | // foreach (TableDefinition tableDefinition in extension.TableDefinitions) | ||
67 | // { | ||
68 | // if (!this.tableDefinitions.Contains(tableDefinition.Name)) | ||
69 | // { | ||
70 | // this.tableDefinitions.Add(tableDefinition); | ||
71 | // } | ||
72 | // else | ||
73 | // { | ||
74 | // throw new WixException(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); | ||
75 | // } | ||
76 | // } | ||
77 | // } | ||
78 | |||
79 | // // keep track of extension data so the libraries can be loaded from these later once all the table definitions | ||
80 | // // are loaded; this will allow extensions to have cross table definition dependencies | ||
81 | // this.extensionData.Add(extension); | ||
82 | //} | ||
83 | |||
84 | /// <summary> | ||
85 | /// Links a collection of sections into an output. | 59 | /// Links a collection of sections into an output. |
86 | /// </summary> | 60 | /// </summary> |
87 | /// <param name="inputs">The collection of sections to link together.</param> | 61 | /// <param name="inputs">The collection of sections to link together.</param> |
@@ -91,10 +65,19 @@ namespace WixToolset.Core | |||
91 | { | 65 | { |
92 | this.Context = context ?? throw new ArgumentNullException(nameof(context)); | 66 | this.Context = context ?? throw new ArgumentNullException(nameof(context)); |
93 | 67 | ||
94 | //IEnumerable<Section> inputs, OutputType expectedOutputType | ||
95 | |||
96 | var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); | 68 | var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); |
97 | 69 | ||
70 | // Add sections from the extensions with data. | ||
71 | foreach (var data in context.ExtensionData) | ||
72 | { | ||
73 | var library = data.GetLibrary(context.TupleDefinitionCreator); | ||
74 | |||
75 | if (library != null) | ||
76 | { | ||
77 | sections.AddRange(library.Sections); | ||
78 | } | ||
79 | } | ||
80 | |||
98 | #if MOVE_TO_BACKEND | 81 | #if MOVE_TO_BACKEND |
99 | bool containsModuleSubstitution = false; | 82 | bool containsModuleSubstitution = false; |
100 | bool containsModuleConfiguration = false; | 83 | bool containsModuleConfiguration = false; |
@@ -144,19 +127,6 @@ namespace WixToolset.Core | |||
144 | } | 127 | } |
145 | #endif | 128 | #endif |
146 | 129 | ||
147 | #if TODO | ||
148 | // Add sections from the extensions with data. | ||
149 | foreach (IExtensionData data in this.extensionData) | ||
150 | { | ||
151 | Library library = data.GetLibrary(this.tableDefinitions); | ||
152 | |||
153 | if (null != library) | ||
154 | { | ||
155 | sections.AddRange(library.Sections); | ||
156 | } | ||
157 | } | ||
158 | #endif | ||
159 | |||
160 | // First find the entry section and while processing all sections load all the symbols from all of the sections. | 130 | // First find the entry section and while processing all sections load all the symbols from all of the sections. |
161 | // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); | 131 | // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); |
162 | var find = new FindEntrySectionAndLoadSymbolsCommand(sections); | 132 | var find = new FindEntrySectionAndLoadSymbolsCommand(sections); |