diff options
Diffstat (limited to 'src/WixToolset.BuildTasks/DoIt.cs')
-rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index 7688342c..97554bc6 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs | |||
@@ -2,6 +2,9 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.BuildTasks | 3 | namespace WixToolset.BuildTasks |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Runtime.InteropServices; | ||
5 | using Microsoft.Build.Framework; | 8 | using Microsoft.Build.Framework; |
6 | using Microsoft.Build.Utilities; | 9 | using Microsoft.Build.Utilities; |
7 | using WixToolset.Core; | 10 | using WixToolset.Core; |
@@ -40,12 +43,14 @@ namespace WixToolset.BuildTasks | |||
40 | 43 | ||
41 | public bool NoLogo { get; set; } | 44 | public bool NoLogo { get; set; } |
42 | 45 | ||
43 | public ITaskItem[] ObjectFiles { get; set; } | 46 | public ITaskItem[] LibraryFiles { get; set; } |
44 | 47 | ||
45 | [Output] | 48 | [Output] |
46 | [Required] | 49 | [Required] |
47 | public ITaskItem OutputFile { get; set; } | 50 | public ITaskItem OutputFile { get; set; } |
48 | 51 | ||
52 | public string OutputType { get; set; } | ||
53 | |||
49 | public string PdbOutputFile { get; set; } | 54 | public string PdbOutputFile { get; set; } |
50 | 55 | ||
51 | public bool Pedantic { get; set; } | 56 | public bool Pedantic { get; set; } |
@@ -84,7 +89,7 @@ namespace WixToolset.BuildTasks | |||
84 | 89 | ||
85 | public ITaskItem[] BindInputPaths { get; set; } | 90 | public ITaskItem[] BindInputPaths { get; set; } |
86 | public bool BindFiles { get; set; } | 91 | public bool BindFiles { get; set; } |
87 | public ITaskItem BindContentsFile{ get; set; } | 92 | public ITaskItem BindContentsFile { get; set; } |
88 | public ITaskItem BindOutputsFile { get; set; } | 93 | public ITaskItem BindOutputsFile { get; set; } |
89 | public ITaskItem BindBuiltOutputsFile { get; set; } | 94 | public ITaskItem BindBuiltOutputsFile { get; set; } |
90 | 95 | ||
@@ -102,21 +107,20 @@ namespace WixToolset.BuildTasks | |||
102 | public string[] SuppressIces { get; set; } | 107 | public string[] SuppressIces { get; set; } |
103 | public string AdditionalCub { get; set; } | 108 | public string AdditionalCub { get; set; } |
104 | 109 | ||
105 | |||
106 | |||
107 | public override bool Execute() | 110 | public override bool Execute() |
108 | { | 111 | { |
109 | try | 112 | try |
110 | { | 113 | { |
111 | this.ExecuteCore(); | 114 | this.ExecuteCore(); |
112 | } | 115 | } |
113 | catch (BuildException e) | 116 | catch (Exception e) |
114 | { | ||
115 | this.Log.LogErrorFromException(e); | ||
116 | } | ||
117 | catch (WixException e) | ||
118 | { | 117 | { |
119 | this.Log.LogErrorFromException(e); | 118 | this.Log.LogErrorFromException(e); |
119 | |||
120 | if (e is NullReferenceException || e is SEHException) | ||
121 | { | ||
122 | throw; | ||
123 | } | ||
120 | } | 124 | } |
121 | 125 | ||
122 | return !this.Log.HasLoggedErrors; | 126 | return !this.Log.HasLoggedErrors; |
@@ -129,27 +133,31 @@ namespace WixToolset.BuildTasks | |||
129 | commandLineBuilder.AppendTextUnquoted("build"); | 133 | commandLineBuilder.AppendTextUnquoted("build"); |
130 | 134 | ||
131 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | 135 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); |
136 | commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); | ||
137 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); | ||
132 | commandLineBuilder.AppendSwitchIfNotNull("-cultures ", this.Cultures); | 138 | commandLineBuilder.AppendSwitchIfNotNull("-cultures ", this.Cultures); |
133 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); | 139 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); |
134 | commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths); | 140 | commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths); |
135 | commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); | 141 | commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); |
136 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); | ||
137 | commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); | 142 | commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); |
138 | commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); | 143 | commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); |
139 | commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); | 144 | commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); |
140 | commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); | 145 | commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); |
146 | commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); | ||
141 | commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile); | 147 | commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile); |
142 | commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); | 148 | commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); |
143 | commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); | 149 | commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); |
144 | commandLineBuilder.AppendSwitchIfNotNull("-wixprojectfile ", this.WixProjectFile); | 150 | commandLineBuilder.AppendSwitchIfNotNull("-wixprojectfile ", this.WixProjectFile); |
145 | commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); | 151 | commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); |
146 | 152 | ||
153 | commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings()); | ||
147 | commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); | 154 | commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); |
155 | commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles); | ||
148 | commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); | 156 | commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); |
149 | 157 | ||
150 | var commandLineString = commandLineBuilder.ToString(); | 158 | var commandLineString = commandLineBuilder.ToString(); |
151 | 159 | ||
152 | this.Log.LogMessage(MessageImportance.Normal, commandLineString); | 160 | this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); |
153 | 161 | ||
154 | var command = CommandLine.ParseStandardCommandLine(commandLineString); | 162 | var command = CommandLine.ParseStandardCommandLine(commandLineString); |
155 | command?.Execute(); | 163 | command?.Execute(); |
@@ -160,6 +168,27 @@ namespace WixToolset.BuildTasks | |||
160 | this.Log.LogMessageFromText(e.Message, MessageImportance.Normal); | 168 | this.Log.LogMessageFromText(e.Message, MessageImportance.Normal); |
161 | } | 169 | } |
162 | 170 | ||
171 | private IEnumerable<string> CalculateBindPathStrings() | ||
172 | { | ||
173 | if (null != this.BindInputPaths) | ||
174 | { | ||
175 | foreach (var item in this.BindInputPaths) | ||
176 | { | ||
177 | var path = item.GetMetadata("FullPath"); | ||
178 | |||
179 | var bindName = item.GetMetadata("BindName"); | ||
180 | if (!String.IsNullOrEmpty(bindName)) | ||
181 | { | ||
182 | yield return String.Concat(bindName, "=", path); | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | yield return path; | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | |||
163 | ///// <summary> | 192 | ///// <summary> |
164 | ///// Builds a command line from options in this task. | 193 | ///// Builds a command line from options in this task. |
165 | ///// </summary> | 194 | ///// </summary> |