diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-08 21:57:31 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-08 22:11:35 +1000 |
| commit | e087bb766a7f85d78d1bfa7b240a08db4e27f730 (patch) | |
| tree | 3a33fbc6d2e6605a6cbc186a9c7603a07952febb /src/WixToolset.BuildTasks/DoIt.cs | |
| parent | 692f9292e733f0d5383f04dc55c78241785f7118 (diff) | |
| download | wix-e087bb766a7f85d78d1bfa7b240a08db4e27f730.tar.gz wix-e087bb766a7f85d78d1bfa7b240a08db4e27f730.tar.bz2 wix-e087bb766a7f85d78d1bfa7b240a08db4e27f730.zip | |
Implement Heat tasks from WixToolset.Harvesters
Diffstat (limited to 'src/WixToolset.BuildTasks/DoIt.cs')
| -rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 73 |
1 files changed, 6 insertions, 67 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index 1872f9e4..d95d6e3c 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs | |||
| @@ -16,10 +16,8 @@ namespace WixToolset.BuildTasks | |||
| 16 | /// <summary> | 16 | /// <summary> |
| 17 | /// An MSBuild task to run the WiX compiler. | 17 | /// An MSBuild task to run the WiX compiler. |
| 18 | /// </summary> | 18 | /// </summary> |
| 19 | public sealed class DoIt : Task | 19 | public sealed class DoIt : ToolsetTask |
| 20 | { | 20 | { |
| 21 | public string AdditionalOptions { get; set; } | ||
| 22 | |||
| 23 | public string[] Cultures { get; set; } | 21 | public string[] Cultures { get; set; } |
| 24 | 22 | ||
| 25 | public string[] DefineConstants { get; set; } | 23 | public string[] DefineConstants { get; set; } |
| @@ -37,8 +35,6 @@ namespace WixToolset.BuildTasks | |||
| 37 | 35 | ||
| 38 | public ITaskItem[] LocalizationFiles { get; set; } | 36 | public ITaskItem[] LocalizationFiles { get; set; } |
| 39 | 37 | ||
| 40 | public bool NoLogo { get; set; } | ||
| 41 | |||
| 42 | public ITaskItem[] LibraryFiles { get; set; } | 38 | public ITaskItem[] LibraryFiles { get; set; } |
| 43 | 39 | ||
| 44 | [Output] | 40 | [Output] |
| @@ -59,32 +55,6 @@ namespace WixToolset.BuildTasks | |||
| 59 | public string[] ReferencePaths { get; set; } | 55 | public string[] ReferencePaths { get; set; } |
| 60 | 56 | ||
| 61 | 57 | ||
| 62 | /// <summary> | ||
| 63 | /// Gets or sets whether all warnings should be suppressed. | ||
| 64 | /// </summary> | ||
| 65 | public bool SuppressAllWarnings { get; set; } | ||
| 66 | |||
| 67 | /// <summary> | ||
| 68 | /// Gets or sets a list of specific warnings to be suppressed. | ||
| 69 | /// </summary> | ||
| 70 | public string[] SuppressSpecificWarnings { get; set; } | ||
| 71 | |||
| 72 | /// <summary> | ||
| 73 | /// Gets or sets whether all warnings should be treated as errors. | ||
| 74 | /// </summary> | ||
| 75 | public bool TreatWarningsAsErrors { get; set; } | ||
| 76 | |||
| 77 | /// <summary> | ||
| 78 | /// Gets or sets a list of specific warnings to treat as errors. | ||
| 79 | /// </summary> | ||
| 80 | public string[] TreatSpecificWarningsAsErrors { get; set; } | ||
| 81 | |||
| 82 | /// <summary> | ||
| 83 | /// Gets or sets whether to display verbose output. | ||
| 84 | /// </summary> | ||
| 85 | public bool VerboseOutput { get; set; } | ||
| 86 | |||
| 87 | |||
| 88 | public ITaskItem[] BindInputPaths { get; set; } | 58 | public ITaskItem[] BindInputPaths { get; set; } |
| 89 | 59 | ||
| 90 | public bool BindFiles { get; set; } | 60 | public bool BindFiles { get; set; } |
| @@ -109,37 +79,10 @@ namespace WixToolset.BuildTasks | |||
| 109 | public string[] SuppressIces { get; set; } | 79 | public string[] SuppressIces { get; set; } |
| 110 | public string AdditionalCub { get; set; } | 80 | public string AdditionalCub { get; set; } |
| 111 | 81 | ||
| 112 | public override bool Execute() | 82 | protected override string TaskShortName => "WIX"; |
| 113 | { | ||
| 114 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | ||
| 115 | |||
| 116 | var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode); | ||
| 117 | |||
| 118 | try | ||
| 119 | { | ||
| 120 | this.ExecuteCore(serviceProvider, listener); | ||
| 121 | } | ||
| 122 | catch (WixException e) | ||
| 123 | { | ||
| 124 | listener.Write(e.Error); | ||
| 125 | } | ||
| 126 | catch (Exception e) | ||
| 127 | { | ||
| 128 | this.Log.LogErrorFromException(e, showStackTrace: true, showDetail: true, null); | ||
| 129 | |||
| 130 | if (e is NullReferenceException || e is SEHException) | ||
| 131 | { | ||
| 132 | throw; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | 83 | ||
| 136 | return !this.Log.HasLoggedErrors; | 84 | protected override void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener listener, string commandLineString) |
| 137 | } | ||
| 138 | |||
| 139 | private void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener listener) | ||
| 140 | { | 85 | { |
| 141 | var commandLineString = this.BuildCommandLine(); | ||
| 142 | |||
| 143 | this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); | 86 | this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); |
| 144 | 87 | ||
| 145 | var messaging = serviceProvider.GetService<IMessaging>(); | 88 | var messaging = serviceProvider.GetService<IMessaging>(); |
| @@ -155,10 +98,8 @@ namespace WixToolset.BuildTasks | |||
| 155 | command?.Execute(); | 98 | command?.Execute(); |
| 156 | } | 99 | } |
| 157 | 100 | ||
| 158 | private string BuildCommandLine() | 101 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) |
| 159 | { | 102 | { |
| 160 | var commandLineBuilder = new WixCommandLineBuilder(); | ||
| 161 | |||
| 162 | commandLineBuilder.AppendTextUnquoted("build"); | 103 | commandLineBuilder.AppendTextUnquoted("build"); |
| 163 | 104 | ||
| 164 | commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform); | 105 | commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform); |
| @@ -166,14 +107,12 @@ namespace WixToolset.BuildTasks | |||
| 166 | commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); | 107 | commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); |
| 167 | commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile); | 108 | commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile); |
| 168 | commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType); | 109 | commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType); |
| 169 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); | ||
| 170 | commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures); | 110 | commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures); |
| 171 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); | 111 | commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); |
| 172 | commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths); | 112 | commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths); |
| 173 | commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); | 113 | commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); |
| 174 | commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); | 114 | commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); |
| 175 | commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); | 115 | commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); |
| 176 | commandLineBuilder.AppendArrayIfNotNull("-sw ", this.SuppressSpecificWarnings); | ||
| 177 | commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); | 116 | commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); |
| 178 | commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); | 117 | commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); |
| 179 | commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); | 118 | commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); |
| @@ -181,14 +120,14 @@ namespace WixToolset.BuildTasks | |||
| 181 | commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); | 120 | commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); |
| 182 | commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); | 121 | commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); |
| 183 | 122 | ||
| 123 | base.BuildCommandLine(commandLineBuilder); | ||
| 124 | |||
| 184 | commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles); | 125 | commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles); |
| 185 | commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings()); | 126 | commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings()); |
| 186 | commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); | 127 | commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); |
| 187 | commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles); | 128 | commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles); |
| 188 | commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); | 129 | commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); |
| 189 | commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); | 130 | commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); |
| 190 | |||
| 191 | return commandLineBuilder.ToString(); | ||
| 192 | } | 131 | } |
| 193 | 132 | ||
| 194 | private IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, IMessaging messaging, string[] extensions) | 133 | private IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, IMessaging messaging, string[] extensions) |
