OLD | NEW |
(Empty) | |
| 1 using System; |
| 2 using System.Collections.Generic; |
| 3 using System.Linq; |
| 4 using System.Text; |
| 5 |
| 6 using System.IO; |
| 7 |
| 8 namespace NaCl.Build.CPPTasks |
| 9 { |
| 10 class DependencyParser |
| 11 { |
| 12 private static char[] elementEndings = new char[] { ' ', '\n', '\\' }; |
| 13 private List<string> m_dependencies; |
| 14 public List<String> Dependencies |
| 15 { |
| 16 get |
| 17 { |
| 18 return m_dependencies; |
| 19 } |
| 20 } |
| 21 |
| 22 public DependencyParser(string filename) |
| 23 { |
| 24 m_dependencies = new List<string>(); |
| 25 |
| 26 using (StreamReader reader = new StreamReader(filename, Encoding.ASC
II)) |
| 27 { |
| 28 while (!reader.EndOfStream) |
| 29 { |
| 30 string str = reader.ReadLine(); |
| 31 ParseLine(str); |
| 32 } |
| 33 reader.Close(); |
| 34 } |
| 35 } |
| 36 |
| 37 private void ParseLine(string line) |
| 38 { |
| 39 string[] paths = line.Split(elementEndings, StringSplitOptions.Remov
eEmptyEntries); |
| 40 |
| 41 foreach (string path in paths) |
| 42 { |
| 43 // ignore the source object file |
| 44 // assumes .o file is only possible file ending with 'o' |
| 45 if (path.ElementAt(path.Length - 1) != 'o' && path.ElementAt(pat
h.Length - 1) != ':') |
| 46 { |
| 47 string newDependency = GCCUtilities.Convert_Path_Posix_To_Wi
ndows(path); |
| 48 m_dependencies.Add(newDependency); |
| 49 } |
| 50 } |
| 51 } |
| 52 } |
| 53 } |
OLD | NEW |