1 import java.nio.file.FileSystems; |
|
2 import java.nio.file.Path; |
|
3 import java.nio.file.SimpleFileVisitor; |
|
4 import java.util.HashSet; |
|
5 import java.util.Stack; |
|
6 import java.util.Vector; |
|
7 |
|
8 public class FileTreeCreator extends SimpleFileVisitor<Path> |
|
9 { |
|
10 Path vcProjLocation; |
|
11 Path startDir; |
|
12 final int startDirLength; |
|
13 Stack<DirAttributes> attributes = new Stack<DirAttributes>(); |
|
14 Vector<BuildConfig> allConfigs; |
|
15 WinGammaPlatform wg; |
|
16 WinGammaPlatformVC10 wg10; |
|
17 |
|
18 public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) { |
|
19 super(); |
|
20 this.wg = wg; |
|
21 if (wg instanceof WinGammaPlatformVC10) { |
|
22 wg10 = (WinGammaPlatformVC10)wg; |
|
23 } |
|
24 this.allConfigs = allConfigs; |
|
25 this.startDir = startDir; |
|
26 startDirLength = startDir.toAbsolutePath().toString().length(); |
|
27 vcProjLocation = FileSystems.getDefault().getPath(allConfigs.firstElement().get("BuildSpace")); |
|
28 attributes.push(new DirAttributes()); |
|
29 } |
|
30 |
|
31 public class DirAttributes { |
|
32 |
|
33 private HashSet<BuildConfig> ignores; |
|
34 private HashSet<BuildConfig> disablePch; |
|
35 |
|
36 public DirAttributes() { |
|
37 ignores = new HashSet<BuildConfig>(); |
|
38 disablePch = new HashSet<BuildConfig>(); |
|
39 } |
|
40 |
|
41 public DirAttributes(HashSet<BuildConfig> excludes2, HashSet<BuildConfig> disablePch2) { |
|
42 ignores = excludes2; |
|
43 disablePch = disablePch2; |
|
44 } |
|
45 |
|
46 @SuppressWarnings("unchecked") |
|
47 public DirAttributes clone() { |
|
48 return new DirAttributes((HashSet<BuildConfig>)this.ignores.clone(), (HashSet<BuildConfig>)this.disablePch.clone()); |
|
49 } |
|
50 |
|
51 public void setIgnore(BuildConfig conf) { |
|
52 ignores.add(conf); |
|
53 } |
|
54 |
|
55 public boolean hasIgnore(BuildConfig cfg) { |
|
56 return ignores.contains(cfg); |
|
57 } |
|
58 |
|
59 public void removeFromIgnored(BuildConfig cfg) { |
|
60 ignores.remove(cfg); |
|
61 } |
|
62 |
|
63 public void setDisablePch(BuildConfig conf) { |
|
64 disablePch.add(conf); |
|
65 } |
|
66 |
|
67 public boolean hasDisablePch(BuildConfig cfg) { |
|
68 return disablePch.contains(cfg); |
|
69 } |
|
70 |
|
71 public void removeFromDisablePch(BuildConfig cfg) { |
|
72 disablePch.remove(cfg); |
|
73 } |
|
74 |
|
75 } |
|
76 } |
|