OLD | NEW |
(Empty) | |
| 1 |
| 2 using System; |
| 3 using System.IO; |
| 4 using System.Resources; |
| 5 using System.Reflection; |
| 6 using System.Text; |
| 7 using Microsoft.Build.Framework; |
| 8 using Microsoft.Build.CPPTasks; |
| 9 |
| 10 |
| 11 namespace NaCl.Build.CPPTasks |
| 12 { |
| 13 public class NaClLink : TrackedVCToolTask |
| 14 { |
| 15 private XamlParser m_XamlParser; |
| 16 |
| 17 public bool BuildingInIDE { get; set; } |
| 18 |
| 19 [Required] |
| 20 public string OutputCommandLine { get; set; } |
| 21 |
| 22 [Required] |
| 23 public string NaClLinkerPath { get; set; } |
| 24 |
| 25 [Required] |
| 26 public virtual string OutputFile { get; set; } |
| 27 |
| 28 [Required] |
| 29 public string PropertiesFile { get; set; } |
| 30 |
| 31 [Required] |
| 32 public virtual ITaskItem[] Sources { get; set; } |
| 33 |
| 34 [Required] |
| 35 public string ConfigurationType { get; set; } |
| 36 |
| 37 public NaClLink() |
| 38 : base(new ResourceManager("NaCl.Build.CPPTasks.Properties.Resources
", Assembly.GetExecutingAssembly())) |
| 39 { |
| 40 |
| 41 } |
| 42 |
| 43 protected override string CommandTLogName |
| 44 { |
| 45 get |
| 46 { |
| 47 return "default.link.command.tlog"; |
| 48 } |
| 49 } |
| 50 |
| 51 protected override string[] ReadTLogNames |
| 52 { |
| 53 get |
| 54 { |
| 55 return new string[] { |
| 56 "default.link.read.tlog" |
| 57 }; |
| 58 } |
| 59 } |
| 60 |
| 61 protected override string[] WriteTLogNames |
| 62 { |
| 63 get |
| 64 { |
| 65 return new string[] { |
| 66 "default.link.write.tlog" |
| 67 }; |
| 68 } |
| 69 } |
| 70 |
| 71 protected override void LogEventsFromTextOutput(string singleLine, Messa
geImportance messageImportance) |
| 72 { |
| 73 base.LogEventsFromTextOutput(GCCUtilities.Convert_Output_GCC_to_VS(s
ingleLine), messageImportance); |
| 74 } |
| 75 |
| 76 protected override string GenerateResponseFileCommands() |
| 77 { |
| 78 StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_Co
mmandLineLength); |
| 79 |
| 80 foreach (ITaskItem sourceFile in Sources) |
| 81 { |
| 82 responseFileCmds.Append(GCCUtilities.Convert_Path_Windows_To_Pos
ix(sourceFile.GetMetadata("Identity"))); |
| 83 responseFileCmds.Append(" "); |
| 84 } |
| 85 |
| 86 responseFileCmds.Append(m_XamlParser.Parse(Sources[0])); |
| 87 |
| 88 return responseFileCmds.ToString(); |
| 89 } |
| 90 |
| 91 public override bool Execute() |
| 92 { |
| 93 bool returnResult = false; |
| 94 |
| 95 try |
| 96 { |
| 97 m_XamlParser = new XamlParser(PropertiesFile); |
| 98 |
| 99 returnResult = base.Execute(); |
| 100 } |
| 101 finally |
| 102 { |
| 103 |
| 104 } |
| 105 |
| 106 return returnResult; |
| 107 } |
| 108 |
| 109 protected override int ExecuteTool(string pathToTool, string responseFil
eCommands, string commandLineCommands) |
| 110 { |
| 111 if (OutputCommandLine == "true") |
| 112 { |
| 113 Log.LogMessage(MessageImportance.High, pathToTool + " " + respo
nseFileCommands); |
| 114 } |
| 115 |
| 116 return base.ExecuteTool(pathToTool, responseFileCommands, commandLin
eCommands); |
| 117 } |
| 118 |
| 119 protected override void PostProcessSwitchList() |
| 120 { |
| 121 //skip default behavior |
| 122 } |
| 123 |
| 124 protected override string GenerateFullPathToTool() |
| 125 { |
| 126 return this.ToolName; |
| 127 } |
| 128 |
| 129 protected override string TrackerIntermediateDirectory |
| 130 { |
| 131 get |
| 132 { |
| 133 if (this.TrackerLogDirectory != null) |
| 134 { |
| 135 return this.TrackerLogDirectory; |
| 136 } |
| 137 |
| 138 return string.Empty; |
| 139 } |
| 140 } |
| 141 |
| 142 protected override Encoding ResponseFileEncoding |
| 143 { |
| 144 get |
| 145 { |
| 146 return Encoding.ASCII; |
| 147 } |
| 148 } |
| 149 |
| 150 protected override ITaskItem[] TrackedInputFiles |
| 151 { |
| 152 get |
| 153 { |
| 154 return this.Sources; |
| 155 } |
| 156 } |
| 157 |
| 158 protected override bool MaintainCompositeRootingMarkers |
| 159 { |
| 160 get |
| 161 { |
| 162 return true; |
| 163 } |
| 164 |
| 165 } |
| 166 |
| 167 protected override string ToolName |
| 168 { |
| 169 get |
| 170 { |
| 171 return NaClLinkerPath; |
| 172 } |
| 173 } |
| 174 |
| 175 public override bool AttributeFileTracking |
| 176 { |
| 177 get |
| 178 { |
| 179 return true; |
| 180 } |
| 181 } |
| 182 |
| 183 public virtual string PlatformToolset |
| 184 { |
| 185 get |
| 186 { |
| 187 return "GCC"; |
| 188 } |
| 189 set |
| 190 {} |
| 191 } |
| 192 |
| 193 public string TrackerLogDirectory { get; set; } |
| 194 } |
| 195 } |
OLD | NEW |