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; | 4 using System; |
5 using System.Collections.Generic; | 5 using System.Collections.Generic; |
6 using System.Linq; | 6 using System.Linq; |
7 using System.Text; | 7 using System.Text; |
8 using System.IO; | 8 using System.IO; |
9 | 9 |
10 using Microsoft.Build.Framework; | 10 using Microsoft.Build.Framework; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 m_typeFunctionMap = new Dictionary<Type, Action<CommandLineBuilder,
BaseProperty, string>> | 42 m_typeFunctionMap = new Dictionary<Type, Action<CommandLineBuilder,
BaseProperty, string>> |
43 { | 43 { |
44 { typeof(StringListProperty), GenerateArgumentStringList }, | 44 { typeof(StringListProperty), GenerateArgumentStringList }, |
45 { typeof(StringProperty), GenerateArgumentString }, | 45 { typeof(StringProperty), GenerateArgumentString }, |
46 { typeof(IntProperty), GenerateArgumentInt }, | 46 { typeof(IntProperty), GenerateArgumentInt }, |
47 { typeof(BoolProperty), GenerateArgumentBool }, | 47 { typeof(BoolProperty), GenerateArgumentBool }, |
48 { typeof(EnumProperty), GenerateArgumentEnum } | 48 { typeof(EnumProperty), GenerateArgumentEnum } |
49 }; | 49 }; |
50 } | 50 } |
51 | 51 |
52 public string Parse(ITaskItem taskItem, bool fullOutputName) | 52 public string Parse(ITaskItem taskItem, bool fullOutputName, string outp
utExtension) |
53 { | 53 { |
54 CommandLineBuilder builder = new CommandLineBuilder(); | 54 CommandLineBuilder builder = new CommandLineBuilder(); |
55 | 55 |
56 foreach (string name in taskItem.MetadataNames) | 56 foreach (string name in taskItem.MetadataNames) |
57 { | 57 { |
58 string value = taskItem.GetMetadata(name); | 58 string value = taskItem.GetMetadata(name); |
| 59 if (outputExtension != null && name == "OutputFile") |
| 60 { |
| 61 value = Path.ChangeExtension(value, outputExtension); |
| 62 } |
59 if (fullOutputName && name == "ObjectFileName") | 63 if (fullOutputName && name == "ObjectFileName") |
60 { | 64 { |
61 if ((File.GetAttributes(value) & FileAttributes.Directory) !
= 0) | 65 if ((File.GetAttributes(value) & FileAttributes.Directory) !
= 0) |
62 { | 66 { |
63 value = Path.Combine(value, Path.GetFileName(taskItem.It
emSpec)); | 67 value = Path.Combine(value, Path.GetFileName(taskItem.It
emSpec)); |
64 value = Path.ChangeExtension(value, ".obj"); | 68 value = Path.ChangeExtension(value, ".obj"); |
65 } | 69 } |
66 } | 70 } |
67 AppendArgumentForProperty(builder, name, value); | 71 AppendArgumentForProperty(builder, name, value); |
68 } | 72 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } // class | 173 } // class |
170 | 174 |
171 private Rule m_parsedBuildRule; | 175 private Rule m_parsedBuildRule; |
172 private Dictionary<string, PropertyWrapper> ToolProperties { get; set; } | 176 private Dictionary<string, PropertyWrapper> ToolProperties { get; set; } |
173 | 177 |
174 // function mapping for easy property function calling | 178 // function mapping for easy property function calling |
175 private Dictionary<Type, Action<CommandLineBuilder, BaseProperty, string
>> m_typeFunctionMap; | 179 private Dictionary<Type, Action<CommandLineBuilder, BaseProperty, string
>> m_typeFunctionMap; |
176 } // XamlParser | 180 } // XamlParser |
177 } // namespace NaCl.Build.CPPTasks | 181 } // namespace NaCl.Build.CPPTasks |
178 | 182 |
OLD | NEW |