OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 using System.Collections.Generic; | 4 using System.Collections.Generic; |
5 using System.Linq; | 5 using System.Linq; |
6 using System.Text; | 6 using System.Text; |
7 using System.Collections; | 7 using System.Collections; |
8 using System.IO; | 8 using System.IO; |
9 using System.Reflection; | 9 using System.Reflection; |
10 using System.Resources; | 10 using System.Resources; |
11 using System.Text.RegularExpressions; | 11 using System.Text.RegularExpressions; |
12 using System.Diagnostics; | 12 using System.Diagnostics; |
13 | 13 |
14 using Microsoft.Build.Framework; | 14 using Microsoft.Build.Framework; |
15 using Microsoft.Build.CPPTasks; | 15 using Microsoft.Build.CPPTasks; |
16 using Microsoft.Build.Utilities; | 16 using Microsoft.Build.Utilities; |
17 | 17 |
18 namespace NaCl.Build.CPPTasks | 18 namespace NaCl.Build.CPPTasks |
19 { | 19 { |
20 public class NaClLib : NaClToolTask | 20 public class NaClLib : NaClToolTask |
21 { | 21 { |
22 [Required] | 22 [Required] |
23 public string LibrarianToolPath { get; set; } | 23 public string LibrarianToolPath { get; set; } |
24 | 24 |
25 [Required] | |
26 public string PropertiesFile { get; set; } | |
27 | |
28 public NaClLib() | 25 public NaClLib() |
29 : base(new ResourceManager("NaCl.Build.CPPTasks.Properties.Resources
", Assembly.GetExecutingAssembly())) | 26 : base(new ResourceManager("NaCl.Build.CPPTasks.Properties.Resources
", Assembly.GetExecutingAssembly())) |
30 { | 27 { |
31 this.EnvironmentVariables = new string[] { "CYGWIN=nodosfilewarning",
"LC_CTYPE=C" }; | 28 this.EnvironmentVariables = new string[] { "CYGWIN=nodosfilewarning",
"LC_CTYPE=C" }; |
32 } | 29 } |
33 | 30 |
34 protected override string GenerateResponseFileCommands() | 31 protected override string GenerateResponseFileCommands() |
35 { | 32 { |
36 StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_Co
mmandLineLength); | 33 StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_Co
mmandLineLength); |
37 responseFileCmds.Append("rcs "); | 34 responseFileCmds.Append("rcs "); |
38 responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(Outpu
tFile)); | 35 responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(Outpu
tFile)); |
39 | 36 |
40 foreach (ITaskItem item in Sources) | 37 foreach (ITaskItem item in Sources) |
41 { | 38 { |
42 responseFileCmds.Append(" "); | 39 responseFileCmds.Append(" "); |
43 responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(i
tem.ToString())); | 40 responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(i
tem.ToString())); |
44 } | 41 } |
45 return responseFileCmds.ToString(); | 42 return responseFileCmds.ToString(); |
46 } | 43 } |
47 | 44 |
48 public override bool Execute() | 45 public override bool Execute() |
49 { | 46 { |
50 if (!Setup()) | 47 if (!Setup()) |
51 return false; | 48 return false; |
52 | 49 |
53 return base.Execute(); | 50 return base.Execute(); |
54 } | 51 } |
55 | 52 |
| 53 protected override string CommandTLogFilename |
| 54 { |
| 55 get |
| 56 { |
| 57 return BaseTool() + ".lib.command.1.tlog"; |
| 58 } |
| 59 } |
| 60 |
| 61 protected override string[] ReadTLogFilenames |
| 62 { |
| 63 get |
| 64 { |
| 65 return new string[] { BaseTool() + ".lib.read.1.tlog" }; |
| 66 } |
| 67 } |
| 68 |
| 69 protected override string WriteTLogFilename |
| 70 { |
| 71 get |
| 72 { |
| 73 return BaseTool() + ".lib.write.1.tlog"; |
| 74 } |
| 75 } |
| 76 |
56 protected override int ExecuteTool(string pathToTool, string responseFil
eCommands, string commandLineCommands) | 77 protected override int ExecuteTool(string pathToTool, string responseFil
eCommands, string commandLineCommands) |
57 { | 78 { |
58 if (OutputCommandLine) | 79 if (OutputCommandLine) |
59 Log.LogMessage(MessageImportance.High, pathToTool + " " + respo
nseFileCommands); | 80 Log.LogMessage(MessageImportance.High, pathToTool + " " + respo
nseFileCommands); |
60 | 81 |
61 return base.ExecuteTool(pathToTool, responseFileCommands, commandLin
eCommands); | 82 return base.ExecuteTool(pathToTool, responseFileCommands, commandLin
eCommands); |
62 } | 83 } |
63 | 84 |
64 protected override Encoding ResponseFileEncoding | 85 protected override Encoding ResponseFileEncoding |
65 { | 86 { |
66 get | 87 get |
67 { | 88 { |
68 return Encoding.ASCII; | 89 return Encoding.ASCII; |
69 } | 90 } |
70 } | 91 } |
71 | 92 |
72 protected override string ToolName | 93 protected override string ToolName |
73 { | 94 { |
74 get | 95 get |
75 { | 96 { |
76 return LibrarianToolPath; | 97 return LibrarianToolPath; |
77 } | 98 } |
78 } | 99 } |
79 } | 100 } |
80 } | 101 } |
OLD | NEW |