aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Compiler.cs')
-rw-r--r--src/WixToolset.Core/Compiler.cs53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index 74ca86ac..2dd7da4d 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -154,24 +154,40 @@ namespace WixToolset.Core
154 } 154 }
155 155
156 // Resolve any Component Id placeholders compiled into the intermediate. 156 // Resolve any Component Id placeholders compiled into the intermediate.
157 if (0 < this.componentIdPlaceholdersResolver.VariableCount) 157 this.ResolveComponentIdPlaceholders(target);
158 }
159 finally
160 {
161 foreach (var extension in context.Extensions)
158 { 162 {
159 foreach (var section in target.Sections) 163 extension.PostCompile(target);
164 }
165
166 this.Core = null;
167 }
168
169 return this.Context.Messaging.EncounteredError ? null : target;
170 }
171
172 private void ResolveComponentIdPlaceholders(Intermediate target)
173 {
174 if (0 < this.componentIdPlaceholdersResolver.VariableCount)
175 {
176 foreach (var section in target.Sections)
177 {
178 foreach (var tuple in section.Tuples)
160 { 179 {
161 foreach (var tuple in section.Tuples) 180 foreach (var field in tuple.Fields)
162 { 181 {
163 foreach (var field in tuple.Fields) 182 if (field?.Type == IntermediateFieldType.String)
164 { 183 {
165 if (field != null && field.Type == IntermediateFieldType.String) 184 var data = field.AsString();
185 if (!String.IsNullOrEmpty(data))
166 { 186 {
167 var data = field.AsString(); 187 var resolved = this.componentIdPlaceholdersResolver.ResolveVariables(tuple.SourceLineNumbers, data, false, false);
168 if (!String.IsNullOrEmpty(data)) 188 if (resolved.UpdatedValue)
169 { 189 {
170 var resolved = this.componentIdPlaceholdersResolver.ResolveVariables(tuple.SourceLineNumbers, data, false, false, out var defaultIgnored, out var delayedIgnored); 190 field.Set(resolved.Value);
171 if (data != resolved)
172 {
173 field.Set(resolved);
174 }
175 } 191 }
176 } 192 }
177 } 193 }
@@ -179,17 +195,6 @@ namespace WixToolset.Core
179 } 195 }
180 } 196 }
181 } 197 }
182 finally
183 {
184 foreach (var extension in context.Extensions)
185 {
186 extension.PostCompile(target);
187 }
188
189 this.Core = null;
190 }
191
192 return this.Context.Messaging.EncounteredError ? null : target;
193 } 198 }
194 199
195 /// <summary> 200 /// <summary>
@@ -2422,7 +2427,7 @@ namespace WixToolset.Core
2422 { 2427 {
2423 if (isGeneratableGuidOk || keyFound && !String.IsNullOrEmpty(keyPath)) 2428 if (isGeneratableGuidOk || keyFound && !String.IsNullOrEmpty(keyPath))
2424 { 2429 {
2425 this.componentIdPlaceholdersResolver.AddVariable(componentIdPlaceholder, keyPath); 2430 this.componentIdPlaceholdersResolver.AddVariable(componentIdPlaceholder, keyPath, false);
2426 2431
2427 id = new Identifier(keyPath, AccessModifier.Private); 2432 id = new Identifier(keyPath, AccessModifier.Private);
2428 } 2433 }