From dc9f4c329e6f55ce7595970463e0caf148096f4b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 21 Dec 2017 13:42:52 -0800 Subject: Support wixout and extract Resolve and Layout from Binder --- src/WixToolset.Core/Compiler.cs | 53 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'src/WixToolset.Core/Compiler.cs') 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 } // Resolve any Component Id placeholders compiled into the intermediate. - if (0 < this.componentIdPlaceholdersResolver.VariableCount) + this.ResolveComponentIdPlaceholders(target); + } + finally + { + foreach (var extension in context.Extensions) { - foreach (var section in target.Sections) + extension.PostCompile(target); + } + + this.Core = null; + } + + return this.Context.Messaging.EncounteredError ? null : target; + } + + private void ResolveComponentIdPlaceholders(Intermediate target) + { + if (0 < this.componentIdPlaceholdersResolver.VariableCount) + { + foreach (var section in target.Sections) + { + foreach (var tuple in section.Tuples) { - foreach (var tuple in section.Tuples) + foreach (var field in tuple.Fields) { - foreach (var field in tuple.Fields) + if (field?.Type == IntermediateFieldType.String) { - if (field != null && field.Type == IntermediateFieldType.String) + var data = field.AsString(); + if (!String.IsNullOrEmpty(data)) { - var data = field.AsString(); - if (!String.IsNullOrEmpty(data)) + var resolved = this.componentIdPlaceholdersResolver.ResolveVariables(tuple.SourceLineNumbers, data, false, false); + if (resolved.UpdatedValue) { - var resolved = this.componentIdPlaceholdersResolver.ResolveVariables(tuple.SourceLineNumbers, data, false, false, out var defaultIgnored, out var delayedIgnored); - if (data != resolved) - { - field.Set(resolved); - } + field.Set(resolved.Value); } } } @@ -179,17 +195,6 @@ namespace WixToolset.Core } } } - finally - { - foreach (var extension in context.Extensions) - { - extension.PostCompile(target); - } - - this.Core = null; - } - - return this.Context.Messaging.EncounteredError ? null : target; } /// @@ -2422,7 +2427,7 @@ namespace WixToolset.Core { if (isGeneratableGuidOk || keyFound && !String.IsNullOrEmpty(keyPath)) { - this.componentIdPlaceholdersResolver.AddVariable(componentIdPlaceholder, keyPath); + this.componentIdPlaceholdersResolver.AddVariable(componentIdPlaceholder, keyPath, false); id = new Identifier(keyPath, AccessModifier.Private); } -- cgit v1.2.3-55-g6feb