aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/Pyro.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2018-07-19 00:58:00 -0700
committerRob Mensching <rob@firegiant.com>2018-07-21 07:36:59 -0700
commit2724cfee4c163f3297ee25edfd2372767cfd4945 (patch)
tree8cdda34c83bea014a586a491e3b4b187ad8f16da /src/WixToolset.BuildTasks/Pyro.cs
parent4d40bef9cf51b8cff7e1f6a73fdf68b9722eb8a0 (diff)
downloadwix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.gz
wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.bz2
wix-2724cfee4c163f3297ee25edfd2372767cfd4945.zip
Move tool projects to Tools repo
Diffstat (limited to 'src/WixToolset.BuildTasks/Pyro.cs')
-rw-r--r--src/WixToolset.BuildTasks/Pyro.cs140
1 files changed, 0 insertions, 140 deletions
diff --git a/src/WixToolset.BuildTasks/Pyro.cs b/src/WixToolset.BuildTasks/Pyro.cs
deleted file mode 100644
index f6b069da..00000000
--- a/src/WixToolset.BuildTasks/Pyro.cs
+++ /dev/null
@@ -1,140 +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
3namespace WixToolset.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using Microsoft.Build.Framework;
9
10 /// <summary>
11 /// An MSBuild task to run the WiX patch builder.
12 /// </summary>
13 public sealed class Pyro : WixToolTask
14 {
15 private const string PyroToolName = "pyro.exe";
16
17 public bool BinaryDeltaPatch { get; set; }
18 public string CabinetCachePath { get; set; }
19 public string ExtensionDirectory { get; set; }
20 public ITaskItem[] Extensions { get; set; }
21 public bool LeaveTemporaryFiles { get; set; }
22 public string[] ReferencePaths { get; set; }
23 public bool ReuseCabinetCache { get; set; }
24 public bool SuppressAssemblies { get; set; }
25 public bool SuppressFiles { get; set; }
26 public bool SuppressFileHashAndInfo { get; set; }
27 public bool SuppressPdbOutput { get; set; }
28
29 [Required]
30 public string DefaultBaselineId { get; set; }
31
32 public ITaskItem[] BindInputPathsForTarget { get; set; }
33 public ITaskItem[] BindInputPathsForUpdated { get; set; }
34
35 [Required]
36 public ITaskItem InputFile { get; set; }
37
38 [Required]
39 [Output]
40 public ITaskItem OutputFile { get; set; }
41
42 [Output]
43 public ITaskItem PdbOutputFile { get; set; }
44
45 [Required]
46 public ITaskItem[] Transforms { get; set; }
47
48 /// <summary>
49 /// Get the name of the executable.
50 /// </summary>
51 /// <remarks>The ToolName is used with the ToolPath to get the location of pyro.exe.</remarks>
52 /// <value>The name of the executable.</value>
53 protected override string ToolName
54 {
55 get { return PyroToolName; }
56 }
57
58 /// <summary>
59 /// Get the path to the executable.
60 /// </summary>
61 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
62 /// <returns>The full path to the executable or simply torch.exe if it's expected to be in the system path.</returns>
63 protected override string GenerateFullPathToTool()
64 {
65 // If there's not a ToolPath specified, it has to be in the system path.
66 if (String.IsNullOrEmpty(this.ToolPath))
67 {
68 return PyroToolName;
69 }
70
71 return Path.Combine(Path.GetFullPath(this.ToolPath), PyroToolName);
72 }
73
74 /// <summary>
75 /// Builds a command line for bind-input paths (-bt and -bu switches).
76 /// </summary>
77 private void AppendBindInputPaths(WixCommandLineBuilder commandLineBuilder, IEnumerable<ITaskItem> bindInputPaths, string switchName)
78 {
79 if (null != bindInputPaths)
80 {
81 Queue<String> formattedBindInputPaths = new Queue<String>();
82 foreach (ITaskItem item in bindInputPaths)
83 {
84 String formattedPath = string.Empty;
85 String bindName = item.GetMetadata("BindName");
86 if (!String.IsNullOrEmpty(bindName))
87 {
88 formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath"));
89 }
90 else
91 {
92 formattedPath = item.GetMetadata("FullPath");
93 }
94 formattedBindInputPaths.Enqueue(formattedPath);
95 }
96
97 commandLineBuilder.AppendArrayIfNotNull(switchName, formattedBindInputPaths.ToArray());
98 }
99 }
100
101 /// <summary>
102 /// Builds a command line from options in this task.
103 /// </summary>
104 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
105 {
106 // Always put the output first so it is easy to find in the log.
107 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
108 commandLineBuilder.AppendSwitchIfNotNull("-pdbout ", this.PdbOutputFile);
109
110 base.BuildCommandLine(commandLineBuilder);
111
112 this.AppendBindInputPaths(commandLineBuilder, this.BindInputPathsForTarget, "-bt ");
113 this.AppendBindInputPaths(commandLineBuilder, this.BindInputPathsForUpdated, "-bu ");
114
115 commandLineBuilder.AppendFileNameIfNotNull(this.InputFile);
116 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
117 commandLineBuilder.AppendIfTrue("-delta", this.BinaryDeltaPatch);
118 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
119 commandLineBuilder.AppendIfTrue("-notidy", this.LeaveTemporaryFiles);
120 commandLineBuilder.AppendIfTrue("-reusecab", this.ReuseCabinetCache);
121 commandLineBuilder.AppendIfTrue("-sa", this.SuppressAssemblies);
122 commandLineBuilder.AppendIfTrue("-sf", this.SuppressFiles);
123 commandLineBuilder.AppendIfTrue("-sh", this.SuppressFileHashAndInfo);
124 commandLineBuilder.AppendIfTrue("-spdb", this.SuppressPdbOutput);
125 foreach (ITaskItem transform in this.Transforms)
126 {
127 string transformPath = transform.ItemSpec;
128 string baselineId = transform.GetMetadata("OverrideBaselineId");
129 if (String.IsNullOrEmpty(baselineId))
130 {
131 baselineId = this.DefaultBaselineId;
132 }
133
134 commandLineBuilder.AppendTextIfNotNull(String.Format("-t {0} {1}", baselineId, transformPath));
135 }
136
137 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
138 }
139 }
140}