aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/BuildCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/CommandLine/BuildCommand.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/BuildCommand.cs57
1 files changed, 37 insertions, 20 deletions
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs
index e11cd15a..48f1b214 100644
--- a/src/WixToolset.Core/CommandLine/BuildCommand.cs
+++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs
@@ -75,37 +75,48 @@ namespace WixToolset.Core.CommandLine
75 75
76 public int Execute() 76 public int Execute()
77 { 77 {
78 var intermediates = this.CompilePhase(); 78 var wixobjs = this.CompilePhase();
79 79
80 if (this.Messaging.EncounteredError) 80 if (this.Messaging.EncounteredError)
81 { 81 {
82 return this.Messaging.LastErrorNumber; 82 return this.Messaging.LastErrorNumber;
83 } 83 }
84 84
85 if (!intermediates.Any()) 85 if (!wixobjs.Any())
86 { 86 {
87 return 1; 87 return 1;
88 } 88 }
89 89
90 if (this.OutputType == OutputType.Library) 90 var wxls = this.LoadLocalizationFiles();
91 {
92 var library = this.LibraryPhase(intermediates);
93 91
94 library?.Save(this.OutputPath); 92 if (this.Messaging.EncounteredError)
93 {
94 return this.Messaging.LastErrorNumber;
95 } 95 }
96 else if (this.OutputType == OutputType.IntermediatePostLink) 96
97 if (this.OutputType == OutputType.Library)
97 { 98 {
98 var output = this.LinkPhase(intermediates); 99 var wixlib = this.LibraryPhase(wixobjs, wxls);
99 100
100 output?.Save(this.OutputPath); 101 if (!this.Messaging.EncounteredError)
102 {
103 wixlib.Save(this.OutputPath);
104 }
101 } 105 }
102 else 106 else
103 { 107 {
104 var output = this.LinkPhase(intermediates); 108 var wixipl = this.LinkPhase(wixobjs);
105 109
106 if (!this.Messaging.EncounteredError) 110 if (!this.Messaging.EncounteredError)
107 { 111 {
108 this.BindPhase(output); 112 if (this.OutputType == OutputType.IntermediatePostLink)
113 {
114 wixipl.Save(this.OutputPath);
115 }
116 else
117 {
118 this.BindPhase(wixipl, wxls);
119 }
109 } 120 }
110 } 121 }
111 122
@@ -147,10 +158,8 @@ namespace WixToolset.Core.CommandLine
147 return intermediates; 158 return intermediates;
148 } 159 }
149 160
150 private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates) 161 private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates, IEnumerable<Localization> localizations)
151 { 162 {
152 var localizations = this.LoadLocalizationFiles().ToList();
153
154 // If there was an error loading localization files, then bail. 163 // If there was an error loading localization files, then bail.
155 if (this.Messaging.EncounteredError) 164 if (this.Messaging.EncounteredError)
156 { 165 {
@@ -184,12 +193,8 @@ namespace WixToolset.Core.CommandLine
184 return linker.Execute(); 193 return linker.Execute();
185 } 194 }
186 195
187 private void BindPhase(Intermediate output) 196 private void BindPhase(Intermediate output, IEnumerable<Localization> localizations)
188 { 197 {
189 var localizations = new List<Localization>(output.Localizations);
190
191 localizations.AddRange(this.LoadLocalizationFiles());
192
193 // If there was an error loading localization files, then bail. 198 // If there was an error loading localization files, then bail.
194 if (this.Messaging.EncounteredError) 199 if (this.Messaging.EncounteredError)
195 { 200 {
@@ -288,7 +293,19 @@ namespace WixToolset.Core.CommandLine
288 { 293 {
289 foreach (var loc in this.LocFiles) 294 foreach (var loc in this.LocFiles)
290 { 295 {
291 var localization = Localizer.ParseLocalizationFile(this.Messaging, loc); 296 var preprocessor = new Preprocessor(this.ServiceProvider);
297 preprocessor.IncludeSearchPaths = this.IncludeSearchPaths;
298 preprocessor.Platform = Platform.X86; // TODO: set this correctly
299 preprocessor.SourcePath = loc;
300 preprocessor.Variables = this.PreprocessorVariables;
301 var document = preprocessor.Execute();
302
303 if (this.Messaging.EncounteredError)
304 {
305 continue;
306 }
307
308 var localization = Localizer.ParseLocalizationFile(this.Messaging, document);
292 309
293 yield return localization; 310 yield return localization;
294 } 311 }