diff options
| author | Rob Mensching <rob@firegiant.com> | 2018-07-19 00:58:00 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:59 -0700 |
| commit | 2724cfee4c163f3297ee25edfd2372767cfd4945 (patch) | |
| tree | 8cdda34c83bea014a586a491e3b4b187ad8f16da /src/light | |
| parent | 4d40bef9cf51b8cff7e1f6a73fdf68b9722eb8a0 (diff) | |
| download | wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.gz wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.bz2 wix-2724cfee4c163f3297ee25edfd2372767cfd4945.zip | |
Move tool projects to Tools repo
Diffstat (limited to 'src/light')
| -rw-r--r-- | src/light/App.ico | bin | 1078 -> 0 bytes | |||
| -rw-r--r-- | src/light/AssemblyInfo.cs | 9 | ||||
| -rw-r--r-- | src/light/LightCommandLine.cs | 421 | ||||
| -rw-r--r-- | src/light/LightStrings.Designer.cs | 104 | ||||
| -rw-r--r-- | src/light/LightStrings.resx | 174 | ||||
| -rw-r--r-- | src/light/app.config | 9 | ||||
| -rw-r--r-- | src/light/light.cs | 574 | ||||
| -rw-r--r-- | src/light/light.csproj | 24 |
8 files changed, 0 insertions, 1315 deletions
diff --git a/src/light/App.ico b/src/light/App.ico deleted file mode 100644 index 3a5525fd..00000000 --- a/src/light/App.ico +++ /dev/null | |||
| Binary files differ | |||
diff --git a/src/light/AssemblyInfo.cs b/src/light/AssemblyInfo.cs deleted file mode 100644 index ab2fc0ab..00000000 --- a/src/light/AssemblyInfo.cs +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | using System; | ||
| 4 | using System.Reflection; | ||
| 5 | using System.Runtime.CompilerServices; | ||
| 6 | using System.Runtime.InteropServices; | ||
| 7 | |||
| 8 | [assembly: AssemblyCulture("")] | ||
| 9 | [assembly: ComVisible(false)] | ||
diff --git a/src/light/LightCommandLine.cs b/src/light/LightCommandLine.cs deleted file mode 100644 index 2aa9ea59..00000000 --- a/src/light/LightCommandLine.cs +++ /dev/null | |||
| @@ -1,421 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Tools | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Globalization; | ||
| 8 | using System.IO; | ||
| 9 | using WixToolset.Data; | ||
| 10 | using WixToolset.Extensibility; | ||
| 11 | using WixToolset.Extensibility.Services; | ||
| 12 | |||
| 13 | public class LightCommandLine | ||
| 14 | { | ||
| 15 | public LightCommandLine(IMessaging messaging) | ||
| 16 | { | ||
| 17 | this.Messaging = messaging; | ||
| 18 | this.ShowLogo = true; | ||
| 19 | this.Tidy = true; | ||
| 20 | |||
| 21 | this.CubeFiles = new List<string>(); | ||
| 22 | this.SuppressIces = new List<string>(); | ||
| 23 | this.Ices = new List<string>(); | ||
| 24 | this.BindPaths = new List<BindPath>(); | ||
| 25 | this.Files = new List<string>(); | ||
| 26 | this.LocalizationFiles = new List<string>(); | ||
| 27 | this.Variables = new Dictionary<string, string>(); | ||
| 28 | } | ||
| 29 | |||
| 30 | public IMessaging Messaging { get; } | ||
| 31 | |||
| 32 | public string PdbFile { get; private set; } | ||
| 33 | |||
| 34 | public CompressionLevel? DefaultCompressionLevel { get; set; } | ||
| 35 | |||
| 36 | public bool SuppressAclReset { get; private set; } | ||
| 37 | |||
| 38 | public bool SuppressLayout { get; private set; } | ||
| 39 | |||
| 40 | public bool SuppressWixPdb { get; private set; } | ||
| 41 | |||
| 42 | public bool SuppressValidation { get; private set; } | ||
| 43 | |||
| 44 | public string IntermediateFolder { get; private set; } | ||
| 45 | |||
| 46 | public string OutputsFile { get; private set; } | ||
| 47 | |||
| 48 | public string BuiltOutputsFile { get; private set; } | ||
| 49 | |||
| 50 | public string WixprojectFile { get; private set; } | ||
| 51 | |||
| 52 | public string ContentsFile { get; private set; } | ||
| 53 | |||
| 54 | public List<string> Ices { get; private set; } | ||
| 55 | |||
| 56 | public string CabCachePath { get; private set; } | ||
| 57 | |||
| 58 | public int CabbingThreadCount { get; private set; } | ||
| 59 | |||
| 60 | public List<string> CubeFiles { get; private set; } | ||
| 61 | |||
| 62 | public List<string> SuppressIces { get; private set; } | ||
| 63 | |||
| 64 | public bool ShowLogo { get; private set; } | ||
| 65 | |||
| 66 | public bool ShowHelp { get; private set; } | ||
| 67 | |||
| 68 | public bool ShowPedanticMessages { get; private set; } | ||
| 69 | |||
| 70 | public bool SuppressLocalization { get; private set; } | ||
| 71 | |||
| 72 | public bool SuppressVersionCheck { get; private set; } | ||
| 73 | |||
| 74 | public string[] Cultures { get; private set; } | ||
| 75 | |||
| 76 | public string OutputFile { get; private set; } | ||
| 77 | |||
| 78 | public bool OutputXml { get; private set; } | ||
| 79 | |||
| 80 | public List<BindPath> BindPaths { get; private set; } | ||
| 81 | |||
| 82 | public List<string> Files { get; private set; } | ||
| 83 | |||
| 84 | public List<string> LocalizationFiles { get; private set; } | ||
| 85 | |||
| 86 | public bool Tidy { get; private set; } | ||
| 87 | |||
| 88 | public string UnreferencedSymbolsFile { get; private set; } | ||
| 89 | |||
| 90 | public IDictionary<string, string> Variables { get; private set; } | ||
| 91 | |||
| 92 | /// <summary> | ||
| 93 | /// Parse the commandline arguments. | ||
| 94 | /// </summary> | ||
| 95 | /// <param name="args">Commandline arguments.</param> | ||
| 96 | public string[] Parse(ICommandLineContext context) | ||
| 97 | { | ||
| 98 | var unprocessed = new List<string>(); | ||
| 99 | |||
| 100 | var extensions = context.ExtensionManager.Create<IExtensionCommandLine>(); | ||
| 101 | |||
| 102 | foreach (var extension in extensions) | ||
| 103 | { | ||
| 104 | extension.PreParse(context); | ||
| 105 | } | ||
| 106 | |||
| 107 | var parser = context.Arguments.Parse(); | ||
| 108 | |||
| 109 | while (!this.ShowHelp && | ||
| 110 | String.IsNullOrEmpty(parser.ErrorArgument) && | ||
| 111 | parser.TryGetNextSwitchOrArgument(out var arg)) | ||
| 112 | { | ||
| 113 | if (String.IsNullOrWhiteSpace(arg)) // skip blank arguments. | ||
| 114 | { | ||
| 115 | continue; | ||
| 116 | } | ||
| 117 | |||
| 118 | if (parser.IsSwitch(arg)) | ||
| 119 | { | ||
| 120 | var parameter = arg.Substring(1); | ||
| 121 | if (parameter.Equals("b", StringComparison.Ordinal)) | ||
| 122 | { | ||
| 123 | var result = parser.GetNextArgumentOrError(arg); | ||
| 124 | if (!String.IsNullOrEmpty(result)) | ||
| 125 | { | ||
| 126 | var bindPath = BindPath.Parse(result); | ||
| 127 | |||
| 128 | this.BindPaths.Add(bindPath); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | else if (parameter.StartsWith("cultures:", StringComparison.Ordinal)) | ||
| 132 | { | ||
| 133 | string culturesString = arg.Substring(10).ToLower(CultureInfo.InvariantCulture); | ||
| 134 | |||
| 135 | // When null is used treat it as if cultures wasn't specified. | ||
| 136 | // This is needed for batching over the light task when using MSBuild which doesn't | ||
| 137 | // support empty items | ||
| 138 | if (culturesString.Equals("null", StringComparison.OrdinalIgnoreCase)) | ||
| 139 | { | ||
| 140 | this.Cultures = null; | ||
| 141 | } | ||
| 142 | else | ||
| 143 | { | ||
| 144 | this.Cultures = culturesString.Split(';', ','); | ||
| 145 | |||
| 146 | for (int c = 0; c < this.Cultures.Length; ++c) | ||
| 147 | { | ||
| 148 | // Neutral is different from null. For neutral we still want to do WXL filtering. | ||
| 149 | // Set the culture to the empty string = identifier for the invariant culture | ||
| 150 | if (this.Cultures[c].Equals("neutral", StringComparison.OrdinalIgnoreCase)) | ||
| 151 | { | ||
| 152 | this.Cultures[c] = String.Empty; | ||
| 153 | } | ||
| 154 | } | ||
| 155 | } | ||
| 156 | } | ||
| 157 | else if (parameter.StartsWith("dcl:", StringComparison.Ordinal)) | ||
| 158 | { | ||
| 159 | string defaultCompressionLevel = arg.Substring(5); | ||
| 160 | |||
| 161 | if (String.IsNullOrEmpty(defaultCompressionLevel)) | ||
| 162 | { | ||
| 163 | break; | ||
| 164 | } | ||
| 165 | else if (Enum.TryParse(defaultCompressionLevel, true, out CompressionLevel compressionLevel)) | ||
| 166 | { | ||
| 167 | this.DefaultCompressionLevel = compressionLevel; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | else if (parameter.StartsWith("d", StringComparison.Ordinal)) | ||
| 171 | { | ||
| 172 | parameter = arg.Substring(2); | ||
| 173 | string[] value = parameter.Split("=".ToCharArray(), 2); | ||
| 174 | |||
| 175 | string preexisting; | ||
| 176 | if (1 == value.Length) | ||
| 177 | { | ||
| 178 | this.Messaging.Write(ErrorMessages.ExpectedWixVariableValue(value[0])); | ||
| 179 | } | ||
| 180 | else if (this.Variables.TryGetValue(value[0], out preexisting)) | ||
| 181 | { | ||
| 182 | this.Messaging.Write(ErrorMessages.WixVariableCollision(null, value[0])); | ||
| 183 | } | ||
| 184 | else | ||
| 185 | { | ||
| 186 | this.Variables.Add(value[0], value[1]); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | else if (parameter.Equals("loc", StringComparison.Ordinal)) | ||
| 190 | { | ||
| 191 | parser.GetNextArgumentAsFilePathOrError(arg, "localization files", this.LocalizationFiles); | ||
| 192 | } | ||
| 193 | else if (parameter.Equals("nologo", StringComparison.Ordinal)) | ||
| 194 | { | ||
| 195 | this.ShowLogo = false; | ||
| 196 | } | ||
| 197 | else if (parameter.Equals("notidy", StringComparison.Ordinal)) | ||
| 198 | { | ||
| 199 | this.Tidy = false; | ||
| 200 | } | ||
| 201 | else if ("o" == parameter || "out" == parameter) | ||
| 202 | { | ||
| 203 | this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 204 | } | ||
| 205 | else if (parameter.Equals("pedantic", StringComparison.Ordinal)) | ||
| 206 | { | ||
| 207 | this.ShowPedanticMessages = true; | ||
| 208 | } | ||
| 209 | else if (parameter.Equals("sloc", StringComparison.Ordinal)) | ||
| 210 | { | ||
| 211 | this.SuppressLocalization = true; | ||
| 212 | } | ||
| 213 | else if (parameter.Equals("usf", StringComparison.Ordinal)) | ||
| 214 | { | ||
| 215 | this.UnreferencedSymbolsFile = parser.GetNextArgumentAsDirectoryOrError(arg); | ||
| 216 | } | ||
| 217 | else if (parameter.Equals("xo", StringComparison.Ordinal)) | ||
| 218 | { | ||
| 219 | this.OutputXml = true; | ||
| 220 | } | ||
| 221 | else if (parameter.Equals("cc", StringComparison.Ordinal)) | ||
| 222 | { | ||
| 223 | this.CabCachePath = parser.GetNextArgumentAsDirectoryOrError(arg); | ||
| 224 | } | ||
| 225 | else if (parameter.Equals("ct", StringComparison.Ordinal)) | ||
| 226 | { | ||
| 227 | var result = parser.GetNextArgumentOrError(arg); | ||
| 228 | if (!String.IsNullOrEmpty(result)) | ||
| 229 | { | ||
| 230 | if (!Int32.TryParse(result, out var ct) || 0 >= ct) | ||
| 231 | { | ||
| 232 | this.Messaging.Write(ErrorMessages.IllegalCabbingThreadCount(result)); | ||
| 233 | parser.ErrorArgument = arg; | ||
| 234 | break; | ||
| 235 | } | ||
| 236 | |||
| 237 | this.CabbingThreadCount = ct; | ||
| 238 | this.Messaging.Write(VerboseMessages.SetCabbingThreadCount(this.CabbingThreadCount.ToString())); | ||
| 239 | } | ||
| 240 | } | ||
| 241 | else if (parameter.Equals("cub", StringComparison.Ordinal)) | ||
| 242 | { | ||
| 243 | parser.GetNextArgumentAsFilePathOrError(arg, "static validation files", this.CubeFiles); | ||
| 244 | } | ||
| 245 | else if (parameter.StartsWith("ice:", StringComparison.Ordinal)) | ||
| 246 | { | ||
| 247 | this.Ices.Add(parameter.Substring(4)); | ||
| 248 | } | ||
| 249 | else if (parameter.Equals("intermediatefolder", StringComparison.OrdinalIgnoreCase)) | ||
| 250 | { | ||
| 251 | this.IntermediateFolder = parser.GetNextArgumentAsDirectoryOrError(arg); | ||
| 252 | } | ||
| 253 | else if (parameter.Equals("contentsfile", StringComparison.Ordinal)) | ||
| 254 | { | ||
| 255 | this.ContentsFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 256 | } | ||
| 257 | else if (parameter.Equals("outputsfile", StringComparison.Ordinal)) | ||
| 258 | { | ||
| 259 | this.OutputsFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 260 | } | ||
| 261 | else if (parameter.Equals("builtoutputsfile", StringComparison.Ordinal)) | ||
| 262 | { | ||
| 263 | this.BuiltOutputsFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 264 | } | ||
| 265 | else if (parameter.Equals("wixprojectfile", StringComparison.Ordinal)) | ||
| 266 | { | ||
| 267 | this.WixprojectFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 268 | } | ||
| 269 | else if (parameter.Equals("pdbout", StringComparison.Ordinal)) | ||
| 270 | { | ||
| 271 | this.PdbFile = parser.GetNextArgumentAsFilePathOrError(arg); | ||
| 272 | } | ||
| 273 | else if (parameter.StartsWith("sice:", StringComparison.Ordinal)) | ||
| 274 | { | ||
| 275 | this.SuppressIces.Add(parameter.Substring(5)); | ||
| 276 | } | ||
| 277 | else if (parameter.Equals("sl", StringComparison.Ordinal)) | ||
| 278 | { | ||
| 279 | this.SuppressLayout = true; | ||
| 280 | } | ||
| 281 | else if (parameter.Equals("spdb", StringComparison.Ordinal)) | ||
| 282 | { | ||
| 283 | this.SuppressWixPdb = true; | ||
| 284 | } | ||
| 285 | else if (parameter.Equals("sacl", StringComparison.Ordinal)) | ||
| 286 | { | ||
| 287 | this.SuppressAclReset = true; | ||
| 288 | } | ||
| 289 | else if (parameter.Equals("sval", StringComparison.Ordinal)) | ||
| 290 | { | ||
| 291 | this.SuppressValidation = true; | ||
| 292 | } | ||
| 293 | else if ("sv" == parameter) | ||
| 294 | { | ||
| 295 | this.SuppressVersionCheck = true; | ||
| 296 | } | ||
| 297 | else if (parameter.StartsWith("sw", StringComparison.Ordinal)) | ||
| 298 | { | ||
| 299 | string paramArg = parameter.Substring(2); | ||
| 300 | if (0 == paramArg.Length) | ||
| 301 | { | ||
| 302 | this.Messaging.SuppressAllWarnings = true; | ||
| 303 | } | ||
| 304 | else | ||
| 305 | { | ||
| 306 | int suppressWarning = 0; | ||
| 307 | if (!Int32.TryParse(paramArg, out suppressWarning) || 0 >= suppressWarning) | ||
| 308 | { | ||
| 309 | this.Messaging.Write(ErrorMessages.IllegalSuppressWarningId(paramArg)); | ||
| 310 | } | ||
| 311 | else | ||
| 312 | { | ||
| 313 | this.Messaging.SuppressWarningMessage(suppressWarning); | ||
| 314 | } | ||
| 315 | } | ||
| 316 | } | ||
| 317 | else if (parameter.StartsWith("wx", StringComparison.Ordinal)) | ||
| 318 | { | ||
| 319 | string paramArg = parameter.Substring(2); | ||
| 320 | if (0 == paramArg.Length) | ||
| 321 | { | ||
| 322 | this.Messaging.WarningsAsError = true; | ||
| 323 | } | ||
| 324 | else | ||
| 325 | { | ||
| 326 | int elevateWarning = 0; | ||
| 327 | if (!Int32.TryParse(paramArg, out elevateWarning) || 0 >= elevateWarning) | ||
| 328 | { | ||
| 329 | this.Messaging.Write(ErrorMessages.IllegalWarningIdAsError(paramArg)); | ||
| 330 | } | ||
| 331 | else | ||
| 332 | { | ||
| 333 | this.Messaging.ElevateWarningMessage(elevateWarning); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | } | ||
| 337 | else if ("v" == parameter) | ||
| 338 | { | ||
| 339 | this.Messaging.ShowVerboseMessages = true; | ||
| 340 | } | ||
| 341 | else if ("?" == parameter || "help" == parameter) | ||
| 342 | { | ||
| 343 | this.ShowHelp = true; | ||
| 344 | break; | ||
| 345 | } | ||
| 346 | else if (!this.TryParseCommandLineArgumentWithExtension(arg, parser, extensions)) | ||
| 347 | { | ||
| 348 | unprocessed.Add(arg); | ||
| 349 | } | ||
| 350 | } | ||
| 351 | else if (!this.TryParseCommandLineArgumentWithExtension(arg, parser, extensions)) | ||
| 352 | { | ||
| 353 | unprocessed.Add(arg); | ||
| 354 | } | ||
| 355 | } | ||
| 356 | |||
| 357 | return this.ParsePostExtensions(parser, unprocessed.ToArray()); | ||
| 358 | } | ||
| 359 | |||
| 360 | private string[] ParsePostExtensions(IParseCommandLine parser, string[] remaining) | ||
| 361 | { | ||
| 362 | var unprocessed = new List<string>(); | ||
| 363 | |||
| 364 | for (int i = 0; i < remaining.Length; ++i) | ||
| 365 | { | ||
| 366 | var arg = remaining[i]; | ||
| 367 | |||
| 368 | if (parser.IsSwitch(arg)) | ||
| 369 | { | ||
| 370 | unprocessed.Add(arg); | ||
| 371 | } | ||
| 372 | else | ||
| 373 | { | ||
| 374 | parser.GetArgumentAsFilePathOrError(arg, "source files", this.Files); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | |||
| 378 | if (0 == this.Files.Count) | ||
| 379 | { | ||
| 380 | this.ShowHelp = true; | ||
| 381 | } | ||
| 382 | else if (String.IsNullOrEmpty(this.OutputFile)) | ||
| 383 | { | ||
| 384 | if (1 < this.Files.Count) | ||
| 385 | { | ||
| 386 | this.Messaging.Write(ErrorMessages.MustSpecifyOutputWithMoreThanOneInput()); | ||
| 387 | } | ||
| 388 | |||
| 389 | // After the linker tells us what the output type actually is, we'll change the ".wix" to the correct extension. | ||
| 390 | this.OutputFile = Path.ChangeExtension(Path.GetFileName(this.Files[0]), ".wix"); | ||
| 391 | |||
| 392 | // Add the directories of the input files as unnamed bind paths. | ||
| 393 | foreach (string file in this.Files) | ||
| 394 | { | ||
| 395 | var bindPath = new BindPath(Path.GetDirectoryName(Path.GetFullPath(file))); | ||
| 396 | this.BindPaths.Add(bindPath); | ||
| 397 | } | ||
| 398 | } | ||
| 399 | |||
| 400 | if (!this.SuppressWixPdb && String.IsNullOrEmpty(this.PdbFile) && !String.IsNullOrEmpty(this.OutputFile)) | ||
| 401 | { | ||
| 402 | this.PdbFile = Path.ChangeExtension(this.OutputFile, ".wixpdb"); | ||
| 403 | } | ||
| 404 | |||
| 405 | return unprocessed.ToArray(); | ||
| 406 | } | ||
| 407 | |||
| 408 | private bool TryParseCommandLineArgumentWithExtension(string arg, IParseCommandLine parser, IEnumerable<IExtensionCommandLine> extensions) | ||
| 409 | { | ||
| 410 | foreach (var extension in extensions) | ||
| 411 | { | ||
| 412 | if (extension.TryParseArgument(parser, arg)) | ||
| 413 | { | ||
| 414 | return true; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | return false; | ||
| 419 | } | ||
| 420 | } | ||
| 421 | } | ||
diff --git a/src/light/LightStrings.Designer.cs b/src/light/LightStrings.Designer.cs deleted file mode 100644 index 50e271fd..00000000 --- a/src/light/LightStrings.Designer.cs +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Tools { | ||
| 4 | using System; | ||
| 5 | |||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// A strongly-typed resource class, for looking up localized strings, etc. | ||
| 9 | /// </summary> | ||
| 10 | // This class was auto-generated by the StronglyTypedResourceBuilder | ||
| 11 | // class via a tool like ResGen or Visual Studio. | ||
| 12 | // To add or remove a member, edit your .ResX file then rerun ResGen | ||
| 13 | // with the /str option, or rebuild your VS project. | ||
| 14 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | ||
| 15 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||
| 16 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | ||
| 17 | internal class LightStrings { | ||
| 18 | |||
| 19 | private static global::System.Resources.ResourceManager resourceMan; | ||
| 20 | |||
| 21 | private static global::System.Globalization.CultureInfo resourceCulture; | ||
| 22 | |||
| 23 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | ||
| 24 | internal LightStrings() { | ||
| 25 | } | ||
| 26 | |||
| 27 | /// <summary> | ||
| 28 | /// Returns the cached ResourceManager instance used by this class. | ||
| 29 | /// </summary> | ||
| 30 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
| 31 | internal static global::System.Resources.ResourceManager ResourceManager { | ||
| 32 | get { | ||
| 33 | if (object.ReferenceEquals(resourceMan, null)) { | ||
| 34 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WixToolset.Tools.LightStrings", typeof(LightStrings).Assembly); | ||
| 35 | resourceMan = temp; | ||
| 36 | } | ||
| 37 | return resourceMan; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | /// <summary> | ||
| 42 | /// Overrides the current thread's CurrentUICulture property for all | ||
| 43 | /// resource lookups using this strongly typed resource class. | ||
| 44 | /// </summary> | ||
| 45 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
| 46 | internal static global::System.Globalization.CultureInfo Culture { | ||
| 47 | get { | ||
| 48 | return resourceCulture; | ||
| 49 | } | ||
| 50 | set { | ||
| 51 | resourceCulture = value; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | /// <summary> | ||
| 56 | /// Looks up a localized string similar to -b <path> specify a binder path to locate all files | ||
| 57 | /// (default: current directory) | ||
| 58 | /// prefix the path with 'name=' where 'name' is the name of your | ||
| 59 | /// named bindpath. | ||
| 60 | /// -cc <path> path to cache built cabinets (will not be deleted after linking) | ||
| 61 | /// -ct <N> number of threads to use when creating cabinets | ||
| 62 | /// (default: %NUMBER_OF_PROCESSORS%) | ||
| 63 | /// -cub <file.cub> additional .cub file containing ICEs to run | ||
| 64 | /// -dcl:level set default cabinet compression l [rest of string was truncated]";. | ||
| 65 | /// </summary> | ||
| 66 | internal static string CommandLineArguments { | ||
| 67 | get { | ||
| 68 | return ResourceManager.GetString("CommandLineArguments", resourceCulture); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | /// <summary> | ||
| 73 | /// Looks up a localized string similar to The -bf (bind files) option is only applicable with the -xo option.. | ||
| 74 | /// </summary> | ||
| 75 | internal static string EXP_BindFileOptionNotApplicable { | ||
| 76 | get { | ||
| 77 | return ResourceManager.GetString("EXP_BindFileOptionNotApplicable", resourceCulture); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | /// <summary> | ||
| 82 | /// Looks up a localized string similar to Cannot link object files (.wixobj) files with an output file (.wixout). | ||
| 83 | /// </summary> | ||
| 84 | internal static string EXP_CannotLinkObjFilesWithOutpuFile { | ||
| 85 | get { | ||
| 86 | return ResourceManager.GetString("EXP_CannotLinkObjFilesWithOutpuFile", resourceCulture); | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | /// <summary> | ||
| 91 | /// Looks up a localized string similar to usage: light.exe [-?] [-b bindPath] [-nologo] [-out outputFile] objectFile [objectFile ...] [@responseFile] | ||
| 92 | /// | ||
| 93 | ///{0} | ||
| 94 | /// | ||
| 95 | ///Environment variables: | ||
| 96 | /// WIX_TEMP overrides the temporary directory used for cab creation, msm exploding, .... | ||
| 97 | /// </summary> | ||
| 98 | internal static string HelpMessage { | ||
| 99 | get { | ||
| 100 | return ResourceManager.GetString("HelpMessage", resourceCulture); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | ||
| 104 | } | ||
diff --git a/src/light/LightStrings.resx b/src/light/LightStrings.resx deleted file mode 100644 index 3f586a5d..00000000 --- a/src/light/LightStrings.resx +++ /dev/null | |||
| @@ -1,174 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <root> | ||
| 3 | <!-- | ||
| 4 | Microsoft ResX Schema | ||
| 5 | |||
| 6 | Version 2.0 | ||
| 7 | |||
| 8 | The primary goals of this format is to allow a simple XML format | ||
| 9 | that is mostly human readable. The generation and parsing of the | ||
| 10 | various data types are done through the TypeConverter classes | ||
| 11 | associated with the data types. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | ... ado.net/XML headers & schema ... | ||
| 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> | ||
| 17 | <resheader name="version">2.0</resheader> | ||
| 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
| 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
| 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
| 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
| 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
| 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> | ||
| 24 | </data> | ||
| 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
| 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
| 27 | <comment>This is a comment</comment> | ||
| 28 | </data> | ||
| 29 | |||
| 30 | There are any number of "resheader" rows that contain simple | ||
| 31 | name/value pairs. | ||
| 32 | |||
| 33 | Each data row contains a name, and value. The row also contains a | ||
| 34 | type or mimetype. Type corresponds to a .NET class that support | ||
| 35 | text/value conversion through the TypeConverter architecture. | ||
| 36 | Classes that don't support this are serialized and stored with the | ||
| 37 | mimetype set. | ||
| 38 | |||
| 39 | The mimetype is used for serialized objects, and tells the | ||
| 40 | ResXResourceReader how to depersist the object. This is currently not | ||
| 41 | extensible. For a given mimetype the value must be set accordingly: | ||
| 42 | |||
| 43 | Note - application/x-microsoft.net.object.binary.base64 is the format | ||
| 44 | that the ResXResourceWriter will generate, however the reader can | ||
| 45 | read any of the formats listed below. | ||
| 46 | |||
| 47 | mimetype: application/x-microsoft.net.object.binary.base64 | ||
| 48 | value : The object must be serialized with | ||
| 49 | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
| 50 | : and then encoded with base64 encoding. | ||
| 51 | |||
| 52 | mimetype: application/x-microsoft.net.object.soap.base64 | ||
| 53 | value : The object must be serialized with | ||
| 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
| 55 | : and then encoded with base64 encoding. | ||
| 56 | |||
| 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
| 58 | value : The object must be serialized into a byte array | ||
| 59 | : using a System.ComponentModel.TypeConverter | ||
| 60 | : and then encoded with base64 encoding. | ||
| 61 | --> | ||
| 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
| 63 | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
| 64 | <xsd:element name="root" msdata:IsDataSet="true"> | ||
| 65 | <xsd:complexType> | ||
| 66 | <xsd:choice maxOccurs="unbounded"> | ||
| 67 | <xsd:element name="metadata"> | ||
| 68 | <xsd:complexType> | ||
| 69 | <xsd:sequence> | ||
| 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
| 71 | </xsd:sequence> | ||
| 72 | <xsd:attribute name="name" use="required" type="xsd:string" /> | ||
| 73 | <xsd:attribute name="type" type="xsd:string" /> | ||
| 74 | <xsd:attribute name="mimetype" type="xsd:string" /> | ||
| 75 | <xsd:attribute ref="xml:space" /> | ||
| 76 | </xsd:complexType> | ||
| 77 | </xsd:element> | ||
| 78 | <xsd:element name="assembly"> | ||
| 79 | <xsd:complexType> | ||
| 80 | <xsd:attribute name="alias" type="xsd:string" /> | ||
| 81 | <xsd:attribute name="name" type="xsd:string" /> | ||
| 82 | </xsd:complexType> | ||
| 83 | </xsd:element> | ||
| 84 | <xsd:element name="data"> | ||
| 85 | <xsd:complexType> | ||
| 86 | <xsd:sequence> | ||
| 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
| 89 | </xsd:sequence> | ||
| 90 | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
| 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
| 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
| 93 | <xsd:attribute ref="xml:space" /> | ||
| 94 | </xsd:complexType> | ||
| 95 | </xsd:element> | ||
| 96 | <xsd:element name="resheader"> | ||
| 97 | <xsd:complexType> | ||
| 98 | <xsd:sequence> | ||
| 99 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 100 | </xsd:sequence> | ||
| 101 | <xsd:attribute name="name" type="xsd:string" use="required" /> | ||
| 102 | </xsd:complexType> | ||
| 103 | </xsd:element> | ||
| 104 | </xsd:choice> | ||
| 105 | </xsd:complexType> | ||
| 106 | </xsd:element> | ||
| 107 | </xsd:schema> | ||
| 108 | <resheader name="resmimetype"> | ||
| 109 | <value>text/microsoft-resx</value> | ||
| 110 | </resheader> | ||
| 111 | <resheader name="version"> | ||
| 112 | <value>2.0</value> | ||
| 113 | </resheader> | ||
| 114 | <resheader name="reader"> | ||
| 115 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 116 | </resheader> | ||
| 117 | <resheader name="writer"> | ||
| 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 119 | </resheader> | ||
| 120 | <data name="CommandLineArguments" xml:space="preserve"> | ||
| 121 | <value> -b <path> specify a binder path to locate all files | ||
| 122 | (default: current directory) | ||
| 123 | prefix the path with 'name=' where 'name' is the name of your | ||
| 124 | named bindpath. | ||
| 125 | -cc <path> path to cache built cabinets (will not be deleted after linking) | ||
| 126 | -ct <N> number of threads to use when creating cabinets | ||
| 127 | (default: %NUMBER_OF_PROCESSORS%) | ||
| 128 | -cub <file.cub> additional .cub file containing ICEs to run | ||
| 129 | -dcl:level set default cabinet compression level | ||
| 130 | (low, medium, high, none, mszip; mszip default) | ||
| 131 | -eav exact assembly versions (breaks .NET 1.1 RTM compatibility) | ||
| 132 | -ice:<ICE> run a specific internal consistency evaluator (ICE) | ||
| 133 | -pdbout <output.wixpdb> save the WixPdb to a specific file | ||
| 134 | (default: same name as output with wixpdb extension) | ||
| 135 | -reusecab reuse cabinets from cabinet cache | ||
| 136 | -sacl suppress resetting ACLs | ||
| 137 | (useful when laying out image to a network share) | ||
| 138 | -sice:<ICE> suppress an internal consistency evaluator (ICE) | ||
| 139 | -sl suppress layout | ||
| 140 | -spdb suppress outputting the WixPdb | ||
| 141 | -sval suppress MSI/MSM validation | ||
| 142 | -cultures:<cultures> semicolon or comma delimited list of localized | ||
| 143 | string cultures to load from .wxl files and libraries. | ||
| 144 | Precedence of cultures is from left to right. | ||
| 145 | -d<name>[=<value>] define a wix variable, with or without a value. | ||
| 146 | -ext <extension> extension assembly or "class, assembly" | ||
| 147 | -loc <loc.wxl> read localization strings from .wxl file | ||
| 148 | -nologo skip printing light logo information | ||
| 149 | -notidy do not delete temporary files (useful for debugging) | ||
| 150 | -o[ut] specify output file (default: write to current directory) | ||
| 151 | -pedantic show pedantic messages | ||
| 152 | -sloc suppress localization | ||
| 153 | -sw[N] suppress all warnings or a specific message ID | ||
| 154 | (example: -sw1009 -sw1103) | ||
| 155 | -usf <output.xml> unreferenced symbols file | ||
| 156 | -v verbose output | ||
| 157 | -wx[N] treat all warnings or a specific message ID as an error | ||
| 158 | (example: -wx1009 -wx1103) | ||
| 159 | -xo output wixout format instead of MSI format | ||
| 160 | -? | -help this help information</value> | ||
| 161 | </data> | ||
| 162 | <data name="EXP_CannotLinkObjFilesWithOutpuFile" xml:space="preserve"> | ||
| 163 | <value>Cannot link object files (.wixobj) files with an output file (.wixout)</value> | ||
| 164 | </data> | ||
| 165 | <data name="HelpMessage" xml:space="preserve"> | ||
| 166 | <value> usage: light.exe [-?] [-b bindPath] [-nologo] [-out outputFile] objectFile [objectFile ...] [@responseFile] | ||
| 167 | |||
| 168 | {0} | ||
| 169 | |||
| 170 | Environment variables: | ||
| 171 | WIX_TEMP overrides the temporary directory used for cab creation, msm exploding, ...</value> | ||
| 172 | <comment>{0} is replaced by a list of light's arguments.</comment> | ||
| 173 | </data> | ||
| 174 | </root> | ||
diff --git a/src/light/app.config b/src/light/app.config deleted file mode 100644 index 71c529fb..00000000 --- a/src/light/app.config +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8" ?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | |||
| 5 | <configuration> | ||
| 6 | <runtime> | ||
| 7 | <loadFromRemoteSources enabled="true"/> | ||
| 8 | </runtime> | ||
| 9 | </configuration> | ||
diff --git a/src/light/light.cs b/src/light/light.cs deleted file mode 100644 index 0f467bbb..00000000 --- a/src/light/light.cs +++ /dev/null | |||
| @@ -1,574 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Tools | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Globalization; | ||
| 8 | using System.IO; | ||
| 9 | using System.Linq; | ||
| 10 | using System.Runtime.InteropServices; | ||
| 11 | using System.Text; | ||
| 12 | using System.Threading; | ||
| 13 | using WixToolset.Core; | ||
| 14 | using WixToolset.Data; | ||
| 15 | using WixToolset.Data.Bind; | ||
| 16 | using WixToolset.Extensibility; | ||
| 17 | using WixToolset.Extensibility.Services; | ||
| 18 | |||
| 19 | /// <summary> | ||
| 20 | /// The main entry point for light. | ||
| 21 | /// </summary> | ||
| 22 | public sealed class Light | ||
| 23 | { | ||
| 24 | LightCommandLine commandLine; | ||
| 25 | //private IEnumerable<IBinderExtension> binderExtensions; | ||
| 26 | //private IEnumerable<IBinderFileManager> fileManagers; | ||
| 27 | |||
| 28 | /// <summary> | ||
| 29 | /// The main entry point for light. | ||
| 30 | /// </summary> | ||
| 31 | /// <param name="args">Commandline arguments for the application.</param> | ||
| 32 | /// <returns>Returns the application error code.</returns> | ||
| 33 | [MTAThread] | ||
| 34 | public static int Main(string[] args) | ||
| 35 | { | ||
| 36 | var serviceProvider = new WixToolsetServiceProvider(); | ||
| 37 | |||
| 38 | var listener = new ConsoleMessageListener("WIX", "light.exe"); | ||
| 39 | |||
| 40 | Light light = new Light(); | ||
| 41 | return light.Run(serviceProvider, listener, args); | ||
| 42 | } | ||
| 43 | |||
| 44 | /// <summary> | ||
| 45 | /// Main running method for the application. | ||
| 46 | /// </summary> | ||
| 47 | /// <param name="args">Commandline arguments to the application.</param> | ||
| 48 | /// <returns>Returns the application error code.</returns> | ||
| 49 | public int Run(IServiceProvider serviceProvider, IMessageListener listener, string[] args) | ||
| 50 | { | ||
| 51 | var messaging = serviceProvider.GetService<IMessaging>(); | ||
| 52 | messaging.SetListener(listener); | ||
| 53 | |||
| 54 | try | ||
| 55 | { | ||
| 56 | var unparsed = this.ParseCommandLineAndLoadExtensions(serviceProvider, messaging, args); | ||
| 57 | |||
| 58 | if (!messaging.EncounteredError) | ||
| 59 | { | ||
| 60 | if (this.commandLine.ShowLogo) | ||
| 61 | { | ||
| 62 | AppCommon.DisplayToolHeader(); | ||
| 63 | } | ||
| 64 | |||
| 65 | if (this.commandLine.ShowHelp) | ||
| 66 | { | ||
| 67 | PrintHelp(); | ||
| 68 | AppCommon.DisplayToolFooter(); | ||
| 69 | } | ||
| 70 | else | ||
| 71 | { | ||
| 72 | foreach (string arg in unparsed) | ||
| 73 | { | ||
| 74 | messaging.Write(WarningMessages.UnsupportedCommandLineArgument(arg)); | ||
| 75 | } | ||
| 76 | |||
| 77 | this.Bind(serviceProvider, messaging); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | catch (WixException we) | ||
| 82 | { | ||
| 83 | messaging.Write(we.Error); | ||
| 84 | } | ||
| 85 | catch (Exception e) | ||
| 86 | { | ||
| 87 | messaging.Write(ErrorMessages.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace)); | ||
| 88 | if (e is NullReferenceException || e is SEHException) | ||
| 89 | { | ||
| 90 | throw; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | return messaging.LastErrorNumber; | ||
| 95 | } | ||
| 96 | |||
| 97 | /// <summary> | ||
| 98 | /// Parse command line and load all the extensions. | ||
| 99 | /// </summary> | ||
| 100 | /// <param name="args">Command line arguments to be parsed.</param> | ||
| 101 | private IEnumerable<string> ParseCommandLineAndLoadExtensions(IServiceProvider serviceProvider, IMessaging messaging, string[] args) | ||
| 102 | { | ||
| 103 | var arguments = serviceProvider.GetService<ICommandLineArguments>(); | ||
| 104 | arguments.Populate(args); | ||
| 105 | |||
| 106 | var extensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions); | ||
| 107 | |||
| 108 | var context = serviceProvider.GetService<ICommandLineContext>(); | ||
| 109 | context.ExtensionManager = extensionManager; | ||
| 110 | context.Messaging = messaging; | ||
| 111 | context.Arguments = arguments; | ||
| 112 | |||
| 113 | this.commandLine = new LightCommandLine(messaging); | ||
| 114 | var unprocessed = this.commandLine.Parse(context); | ||
| 115 | |||
| 116 | return unprocessed; | ||
| 117 | } | ||
| 118 | |||
| 119 | private void Bind(IServiceProvider serviceProvider, IMessaging messaging) | ||
| 120 | { | ||
| 121 | var output = this.LoadWixout(messaging); | ||
| 122 | |||
| 123 | if (messaging.EncounteredError) | ||
| 124 | { | ||
| 125 | return; | ||
| 126 | } | ||
| 127 | |||
| 128 | var intermediateFolder = this.commandLine.IntermediateFolder; | ||
| 129 | if (String.IsNullOrEmpty(intermediateFolder)) | ||
| 130 | { | ||
| 131 | intermediateFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | ||
| 132 | } | ||
| 133 | |||
| 134 | var localizations = this.LoadLocalizationFiles(messaging, this.commandLine.LocalizationFiles); | ||
| 135 | |||
| 136 | if (messaging.EncounteredError) | ||
| 137 | { | ||
| 138 | return; | ||
| 139 | } | ||
| 140 | |||
| 141 | ResolveResult resolveResult; | ||
| 142 | { | ||
| 143 | var resolver = new Resolver(serviceProvider); | ||
| 144 | resolver.BindPaths = this.commandLine.BindPaths; | ||
| 145 | resolver.IntermediateFolder = intermediateFolder; | ||
| 146 | resolver.IntermediateRepresentation = output; | ||
| 147 | resolver.Localizations = localizations; | ||
| 148 | |||
| 149 | resolveResult = resolver.Execute(); | ||
| 150 | } | ||
| 151 | |||
| 152 | if (messaging.EncounteredError) | ||
| 153 | { | ||
| 154 | return; | ||
| 155 | } | ||
| 156 | |||
| 157 | BindResult bindResult; | ||
| 158 | { | ||
| 159 | var binder = new Binder(serviceProvider); | ||
| 160 | binder.CabbingThreadCount = this.commandLine.CabbingThreadCount; | ||
| 161 | binder.CabCachePath = this.commandLine.CabCachePath; | ||
| 162 | binder.Codepage = resolveResult.Codepage; | ||
| 163 | binder.DefaultCompressionLevel = this.commandLine.DefaultCompressionLevel; | ||
| 164 | binder.DelayedFields = resolveResult.DelayedFields; | ||
| 165 | binder.ExpectedEmbeddedFiles = resolveResult.ExpectedEmbeddedFiles; | ||
| 166 | binder.Ices = this.commandLine.Ices; | ||
| 167 | binder.IntermediateFolder = intermediateFolder; | ||
| 168 | binder.IntermediateRepresentation = resolveResult.IntermediateRepresentation; | ||
| 169 | binder.OutputPath = this.commandLine.OutputFile; | ||
| 170 | binder.OutputPdbPath = Path.ChangeExtension(this.commandLine.OutputFile, ".wixpdb"); | ||
| 171 | binder.SuppressIces = this.commandLine.SuppressIces; | ||
| 172 | binder.SuppressValidation = this.commandLine.SuppressValidation; | ||
| 173 | |||
| 174 | bindResult = binder.Execute(); | ||
| 175 | } | ||
| 176 | |||
| 177 | if (messaging.EncounteredError) | ||
| 178 | { | ||
| 179 | return; | ||
| 180 | } | ||
| 181 | |||
| 182 | { | ||
| 183 | var layout = new Layout(serviceProvider); | ||
| 184 | layout.FileTransfers = bindResult.FileTransfers; | ||
| 185 | layout.ContentFilePaths = bindResult.ContentFilePaths; | ||
| 186 | layout.ContentsFile = this.commandLine.ContentsFile; | ||
| 187 | layout.OutputsFile = this.commandLine.OutputsFile; | ||
| 188 | layout.BuiltOutputsFile = this.commandLine.BuiltOutputsFile; | ||
| 189 | layout.SuppressAclReset = this.commandLine.SuppressAclReset; | ||
| 190 | |||
| 191 | layout.Execute(); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | private void Run(IMessaging messaging) | ||
| 196 | { | ||
| 197 | #if false | ||
| 198 | // Initialize the variable resolver from the command line. | ||
| 199 | WixVariableResolver wixVariableResolver = new WixVariableResolver(); | ||
| 200 | foreach (var wixVar in this.commandLine.Variables) | ||
| 201 | { | ||
| 202 | wixVariableResolver.AddVariable(wixVar.Key, wixVar.Value); | ||
| 203 | } | ||
| 204 | |||
| 205 | // Initialize the linker from the command line. | ||
| 206 | Linker linker = new Linker(); | ||
| 207 | linker.UnreferencedSymbolsFile = this.commandLine.UnreferencedSymbolsFile; | ||
| 208 | linker.ShowPedanticMessages = this.commandLine.ShowPedanticMessages; | ||
| 209 | linker.WixVariableResolver = wixVariableResolver; | ||
| 210 | |||
| 211 | foreach (IExtensionData data in this.extensionData) | ||
| 212 | { | ||
| 213 | linker.AddExtensionData(data); | ||
| 214 | } | ||
| 215 | |||
| 216 | // Initialize the binder from the command line. | ||
| 217 | WixToolset.Binder binder = new WixToolset.Binder(); | ||
| 218 | binder.CabCachePath = this.commandLine.CabCachePath; | ||
| 219 | binder.ContentsFile = this.commandLine.ContentsFile; | ||
| 220 | binder.BuiltOutputsFile = this.commandLine.BuiltOutputsFile; | ||
| 221 | binder.OutputsFile = this.commandLine.OutputsFile; | ||
| 222 | binder.WixprojectFile = this.commandLine.WixprojectFile; | ||
| 223 | binder.BindPaths.AddRange(this.commandLine.BindPaths); | ||
| 224 | binder.CabbingThreadCount = this.commandLine.CabbingThreadCount; | ||
| 225 | if (this.commandLine.DefaultCompressionLevel.HasValue) | ||
| 226 | { | ||
| 227 | binder.DefaultCompressionLevel = this.commandLine.DefaultCompressionLevel.Value; | ||
| 228 | } | ||
| 229 | binder.Ices.AddRange(this.commandLine.Ices); | ||
| 230 | binder.SuppressIces.AddRange(this.commandLine.SuppressIces); | ||
| 231 | binder.SuppressAclReset = this.commandLine.SuppressAclReset; | ||
| 232 | binder.SuppressLayout = this.commandLine.SuppressLayout; | ||
| 233 | binder.SuppressValidation = this.commandLine.SuppressValidation; | ||
| 234 | binder.PdbFile = this.commandLine.SuppressWixPdb ? null : this.commandLine.PdbFile; | ||
| 235 | binder.TempFilesLocation = AppCommon.GetTempLocation(); | ||
| 236 | binder.WixVariableResolver = wixVariableResolver; | ||
| 237 | |||
| 238 | foreach (IBinderExtension extension in this.binderExtensions) | ||
| 239 | { | ||
| 240 | binder.AddExtension(extension); | ||
| 241 | } | ||
| 242 | |||
| 243 | foreach (IBinderFileManager fileManager in this.fileManagers) | ||
| 244 | { | ||
| 245 | binder.AddExtension(fileManager); | ||
| 246 | } | ||
| 247 | |||
| 248 | // Initialize the localizer. | ||
| 249 | Localizer localizer = this.InitializeLocalization(linker.TableDefinitions); | ||
| 250 | if (messaging.EncounteredError) | ||
| 251 | { | ||
| 252 | return; | ||
| 253 | } | ||
| 254 | |||
| 255 | wixVariableResolver.Localizer = localizer; | ||
| 256 | linker.Localizer = localizer; | ||
| 257 | binder.Localizer = localizer; | ||
| 258 | |||
| 259 | // Loop through all the believed object files. | ||
| 260 | List<Section> sections = new List<Section>(); | ||
| 261 | Output output = null; | ||
| 262 | foreach (string inputFile in this.commandLine.Files) | ||
| 263 | { | ||
| 264 | string inputFileFullPath = Path.GetFullPath(inputFile); | ||
| 265 | FileFormat format = FileStructure.GuessFileFormatFromExtension(Path.GetExtension(inputFileFullPath)); | ||
| 266 | bool retry; | ||
| 267 | do | ||
| 268 | { | ||
| 269 | retry = false; | ||
| 270 | |||
| 271 | try | ||
| 272 | { | ||
| 273 | switch (format) | ||
| 274 | { | ||
| 275 | case FileFormat.Wixobj: | ||
| 276 | Intermediate intermediate = Intermediate.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck); | ||
| 277 | sections.AddRange(intermediate.Sections); | ||
| 278 | break; | ||
| 279 | |||
| 280 | case FileFormat.Wixlib: | ||
| 281 | Library library = Library.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck); | ||
| 282 | AddLibraryLocalizationsToLocalizer(library, this.commandLine.Cultures, localizer); | ||
| 283 | sections.AddRange(library.Sections); | ||
| 284 | break; | ||
| 285 | |||
| 286 | default: | ||
| 287 | output = Output.Load(inputFileFullPath, this.commandLine.SuppressVersionCheck); | ||
| 288 | break; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | catch (WixUnexpectedFileFormatException e) | ||
| 292 | { | ||
| 293 | format = e.FileFormat; | ||
| 294 | retry = (FileFormat.Wixobj == format || FileFormat.Wixlib == format || FileFormat.Wixout == format); // .wixobj, .wixout and .wixout are supported by light. | ||
| 295 | if (!retry) | ||
| 296 | { | ||
| 297 | messaging.OnMessage(e.Error); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | } while (retry); | ||
| 301 | } | ||
| 302 | |||
| 303 | // Stop processing if any errors were found loading object files. | ||
| 304 | if (messaging.EncounteredError) | ||
| 305 | { | ||
| 306 | return; | ||
| 307 | } | ||
| 308 | |||
| 309 | // and now for the fun part | ||
| 310 | if (null == output) | ||
| 311 | { | ||
| 312 | OutputType expectedOutputType = OutputType.Unknown; | ||
| 313 | if (!String.IsNullOrEmpty(this.commandLine.OutputFile)) | ||
| 314 | { | ||
| 315 | expectedOutputType = Output.GetOutputType(Path.GetExtension(this.commandLine.OutputFile)); | ||
| 316 | } | ||
| 317 | |||
| 318 | output = linker.Link(sections, expectedOutputType); | ||
| 319 | |||
| 320 | // If an error occurred during linking, stop processing. | ||
| 321 | if (null == output) | ||
| 322 | { | ||
| 323 | return; | ||
| 324 | } | ||
| 325 | } | ||
| 326 | else if (0 != sections.Count) | ||
| 327 | { | ||
| 328 | throw new InvalidOperationException(LightStrings.EXP_CannotLinkObjFilesWithOutpuFile); | ||
| 329 | } | ||
| 330 | |||
| 331 | bool tidy = true; // clean up after ourselves by default. | ||
| 332 | try | ||
| 333 | { | ||
| 334 | // only output the xml if its a patch build or user specfied to only output wixout | ||
| 335 | string outputFile = this.commandLine.OutputFile; | ||
| 336 | string outputExtension = Path.GetExtension(outputFile); | ||
| 337 | if (this.commandLine.OutputXml || OutputType.Patch == output.Type) | ||
| 338 | { | ||
| 339 | if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal)) | ||
| 340 | { | ||
| 341 | outputExtension = (OutputType.Patch == output.Type) ? ".wixmsp" : ".wixout"; | ||
| 342 | outputFile = Path.ChangeExtension(outputFile, outputExtension); | ||
| 343 | } | ||
| 344 | |||
| 345 | output.Save(outputFile); | ||
| 346 | } | ||
| 347 | else // finish creating the MSI/MSM | ||
| 348 | { | ||
| 349 | if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal)) | ||
| 350 | { | ||
| 351 | outputExtension = Output.GetExtension(output.Type); | ||
| 352 | outputFile = Path.ChangeExtension(outputFile, outputExtension); | ||
| 353 | } | ||
| 354 | |||
| 355 | binder.Bind(output, outputFile); | ||
| 356 | } | ||
| 357 | } | ||
| 358 | catch (WixException we) // keep files around for debugging IDT issues. | ||
| 359 | { | ||
| 360 | if (we is WixInvalidIdtException) | ||
| 361 | { | ||
| 362 | tidy = false; | ||
| 363 | } | ||
| 364 | |||
| 365 | throw; | ||
| 366 | } | ||
| 367 | catch (Exception) // keep files around for debugging unexpected exceptions. | ||
| 368 | { | ||
| 369 | tidy = false; | ||
| 370 | throw; | ||
| 371 | } | ||
| 372 | finally | ||
| 373 | { | ||
| 374 | if (null != binder) | ||
| 375 | { | ||
| 376 | binder.Cleanup(tidy); | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | return; | ||
| 381 | #endif | ||
| 382 | } | ||
| 383 | |||
| 384 | #if false | ||
| 385 | private Localizer InitializeLocalization(TableDefinitionCollection tableDefinitions) | ||
| 386 | { | ||
| 387 | Localizer localizer = null; | ||
| 388 | |||
| 389 | // Instantiate the localizer and load any localization files. | ||
| 390 | if (!this.commandLine.SuppressLocalization || 0 < this.commandLine.LocalizationFiles.Count || null != this.commandLine.Cultures || !this.commandLine.OutputXml) | ||
| 391 | { | ||
| 392 | List<Localization> localizations = new List<Localization>(); | ||
| 393 | |||
| 394 | // Load each localization file. | ||
| 395 | foreach (string localizationFile in this.commandLine.LocalizationFiles) | ||
| 396 | { | ||
| 397 | Localization localization = Localizer.ParseLocalizationFile(localizationFile, tableDefinitions); | ||
| 398 | if (null != localization) | ||
| 399 | { | ||
| 400 | localizations.Add(localization); | ||
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 | localizer = new Localizer(); | ||
| 405 | if (null != this.commandLine.Cultures) | ||
| 406 | { | ||
| 407 | // Alocalizations in order specified in cultures. | ||
| 408 | foreach (string culture in this.commandLine.Cultures) | ||
| 409 | { | ||
| 410 | foreach (Localization localization in localizations) | ||
| 411 | { | ||
| 412 | if (culture.Equals(localization.Culture, StringComparison.OrdinalIgnoreCase)) | ||
| 413 | { | ||
| 414 | localizer.AddLocalization(localization); | ||
| 415 | } | ||
| 416 | } | ||
| 417 | } | ||
| 418 | } | ||
| 419 | else // no cultures specified, so try neutral culture and if none of those add all loc files. | ||
| 420 | { | ||
| 421 | bool neutralFound = false; | ||
| 422 | foreach (Localization localization in localizations) | ||
| 423 | { | ||
| 424 | if (String.IsNullOrEmpty(localization.Culture)) | ||
| 425 | { | ||
| 426 | // If a neutral wxl was provided use it. | ||
| 427 | localizer.AddLocalization(localization); | ||
| 428 | neutralFound = true; | ||
| 429 | } | ||
| 430 | } | ||
| 431 | |||
| 432 | if (!neutralFound) | ||
| 433 | { | ||
| 434 | // No cultures were specified and no neutral wxl are available, include all of the loc files. | ||
| 435 | foreach (Localization localization in localizations) | ||
| 436 | { | ||
| 437 | localizer.AddLocalization(localization); | ||
| 438 | } | ||
| 439 | } | ||
| 440 | } | ||
| 441 | |||
| 442 | // Load localizations provided by extensions with data. | ||
| 443 | foreach (IExtensionData data in this.extensionData) | ||
| 444 | { | ||
| 445 | Library library = data.GetLibrary(tableDefinitions); | ||
| 446 | if (null != library) | ||
| 447 | { | ||
| 448 | // Load the extension's default culture if it provides one and no cultures were specified. | ||
| 449 | string[] extensionCultures = this.commandLine.Cultures; | ||
| 450 | if (null == extensionCultures && null != data.DefaultCulture) | ||
| 451 | { | ||
| 452 | extensionCultures = new string[] { data.DefaultCulture }; | ||
| 453 | } | ||
| 454 | |||
| 455 | AddLibraryLocalizationsToLocalizer(library, extensionCultures, localizer); | ||
| 456 | } | ||
| 457 | } | ||
| 458 | } | ||
| 459 | |||
| 460 | return localizer; | ||
| 461 | } | ||
| 462 | |||
| 463 | private void AddLibraryLocalizationsToLocalizer(Library library, string[] cultures, Localizer localizer) | ||
| 464 | { | ||
| 465 | foreach (Localization localization in library.GetLocalizations(cultures)) | ||
| 466 | { | ||
| 467 | localizer.AddLocalization(localization); | ||
| 468 | } | ||
| 469 | } | ||
| 470 | #endif | ||
| 471 | |||
| 472 | private bool TryParseCommandLineArgumentWithExtension(string arg, IEnumerable<IExtensionCommandLine> extensions) | ||
| 473 | { | ||
| 474 | foreach (var extension in extensions) | ||
| 475 | { | ||
| 476 | // TODO: decide what to do with "IParseCommandLine" argument. | ||
| 477 | if (extension.TryParseArgument(null, arg)) | ||
| 478 | { | ||
| 479 | return true; | ||
| 480 | } | ||
| 481 | } | ||
| 482 | |||
| 483 | return false; | ||
| 484 | } | ||
| 485 | |||
| 486 | private IEnumerable<Localization> LoadLocalizationFiles(IMessaging messaging, IEnumerable<string> locFiles) | ||
| 487 | { | ||
| 488 | foreach (var loc in locFiles) | ||
| 489 | { | ||
| 490 | var localization = Localizer.ParseLocalizationFile(messaging, loc); | ||
| 491 | |||
| 492 | yield return localization; | ||
| 493 | } | ||
| 494 | } | ||
| 495 | |||
| 496 | private Intermediate LoadWixout(IMessaging messaging) | ||
| 497 | { | ||
| 498 | var path = this.commandLine.Files.Single(); | ||
| 499 | |||
| 500 | return Intermediate.Load(path); | ||
| 501 | } | ||
| 502 | |||
| 503 | private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, IEnumerable<string> extensions) | ||
| 504 | { | ||
| 505 | var extensionManager = serviceProvider.GetService<IExtensionManager>(); | ||
| 506 | |||
| 507 | foreach (var type in new[] { typeof(WixToolset.Core.Burn.WixToolsetStandardBackend), typeof(WixToolset.Core.WindowsInstaller.WixToolsetStandardBackend) }) | ||
| 508 | { | ||
| 509 | extensionManager.Add(type.Assembly); | ||
| 510 | } | ||
| 511 | |||
| 512 | foreach (var extension in extensions) | ||
| 513 | { | ||
| 514 | extensionManager.Load(extension); | ||
| 515 | } | ||
| 516 | |||
| 517 | return extensionManager; | ||
| 518 | } | ||
| 519 | |||
| 520 | private static void PrintHelp() | ||
| 521 | { | ||
| 522 | string lightArgs = LightStrings.CommandLineArguments; | ||
| 523 | |||
| 524 | Console.WriteLine(String.Format(LightStrings.HelpMessage, lightArgs)); | ||
| 525 | } | ||
| 526 | |||
| 527 | private class ConsoleMessageListener : IMessageListener | ||
| 528 | { | ||
| 529 | public ConsoleMessageListener(string shortName, string longName) | ||
| 530 | { | ||
| 531 | this.ShortAppName = shortName; | ||
| 532 | this.LongAppName = longName; | ||
| 533 | |||
| 534 | PrepareConsoleForLocalization(); | ||
| 535 | } | ||
| 536 | |||
| 537 | public string LongAppName { get; } | ||
| 538 | |||
| 539 | public string ShortAppName { get; } | ||
| 540 | |||
| 541 | public void Write(Message message) | ||
| 542 | { | ||
| 543 | var filename = message.SourceLineNumbers?.FileName ?? this.LongAppName; | ||
| 544 | var line = message.SourceLineNumbers?.LineNumber ?? -1; | ||
| 545 | var type = message.Level.ToString().ToLowerInvariant(); | ||
| 546 | var output = message.Level >= MessageLevel.Warning ? Console.Out : Console.Error; | ||
| 547 | |||
| 548 | if (line > 0) | ||
| 549 | { | ||
| 550 | filename = String.Concat(filename, "(", line, ")"); | ||
| 551 | } | ||
| 552 | |||
| 553 | output.WriteLine("{0} : {1} {2}{3:0000}: {4}", filename, type, this.ShortAppName, message.Id, message.ToString()); | ||
| 554 | } | ||
| 555 | |||
| 556 | public void Write(string message) | ||
| 557 | { | ||
| 558 | Console.Out.WriteLine(message); | ||
| 559 | } | ||
| 560 | |||
| 561 | private static void PrepareConsoleForLocalization() | ||
| 562 | { | ||
| 563 | Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture(); | ||
| 564 | |||
| 565 | if (Console.OutputEncoding.CodePage != Encoding.UTF8.CodePage && | ||
| 566 | Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage && | ||
| 567 | Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) | ||
| 568 | { | ||
| 569 | Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); | ||
| 570 | } | ||
| 571 | } | ||
| 572 | } | ||
| 573 | } | ||
| 574 | } | ||
diff --git a/src/light/light.csproj b/src/light/light.csproj deleted file mode 100644 index 95adba01..00000000 --- a/src/light/light.csproj +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>net461</TargetFramework> | ||
| 7 | <OutputType>Exe</OutputType> | ||
| 8 | <Description>Linker</Description> | ||
| 9 | <Title>WiX Toolset Linker</Title> | ||
| 10 | <DebugType>embedded</DebugType> | ||
| 11 | <PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
| 12 | </PropertyGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 15 | <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" /> | ||
| 16 | <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" /> | ||
| 17 | <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" /> | ||
| 18 | </ItemGroup> | ||
| 19 | |||
| 20 | <ItemGroup> | ||
| 21 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/> | ||
| 22 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | ||
| 23 | </ItemGroup> | ||
| 24 | </Project> | ||
