1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/tools/ProjectCreator/FileTreeCreator.java Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,76 @@ 1.4 +import java.nio.file.FileSystems; 1.5 +import java.nio.file.Path; 1.6 +import java.nio.file.SimpleFileVisitor; 1.7 +import java.util.HashSet; 1.8 +import java.util.Stack; 1.9 +import java.util.Vector; 1.10 + 1.11 +public class FileTreeCreator extends SimpleFileVisitor<Path> 1.12 +{ 1.13 + Path vcProjLocation; 1.14 + Path startDir; 1.15 + final int startDirLength; 1.16 + Stack<DirAttributes> attributes = new Stack<DirAttributes>(); 1.17 + Vector<BuildConfig> allConfigs; 1.18 + WinGammaPlatform wg; 1.19 + WinGammaPlatformVC10 wg10; 1.20 + 1.21 + public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) { 1.22 + super(); 1.23 + this.wg = wg; 1.24 + if (wg instanceof WinGammaPlatformVC10) { 1.25 + wg10 = (WinGammaPlatformVC10)wg; 1.26 + } 1.27 + this.allConfigs = allConfigs; 1.28 + this.startDir = startDir; 1.29 + startDirLength = startDir.toAbsolutePath().toString().length(); 1.30 + vcProjLocation = FileSystems.getDefault().getPath(allConfigs.firstElement().get("BuildSpace")); 1.31 + attributes.push(new DirAttributes()); 1.32 + } 1.33 + 1.34 + public class DirAttributes { 1.35 + 1.36 + private HashSet<BuildConfig> ignores; 1.37 + private HashSet<BuildConfig> disablePch; 1.38 + 1.39 + public DirAttributes() { 1.40 + ignores = new HashSet<BuildConfig>(); 1.41 + disablePch = new HashSet<BuildConfig>(); 1.42 + } 1.43 + 1.44 + public DirAttributes(HashSet<BuildConfig> excludes2, HashSet<BuildConfig> disablePch2) { 1.45 + ignores = excludes2; 1.46 + disablePch = disablePch2; 1.47 + } 1.48 + 1.49 + @SuppressWarnings("unchecked") 1.50 + public DirAttributes clone() { 1.51 + return new DirAttributes((HashSet<BuildConfig>)this.ignores.clone(), (HashSet<BuildConfig>)this.disablePch.clone()); 1.52 + } 1.53 + 1.54 + public void setIgnore(BuildConfig conf) { 1.55 + ignores.add(conf); 1.56 + } 1.57 + 1.58 + public boolean hasIgnore(BuildConfig cfg) { 1.59 + return ignores.contains(cfg); 1.60 + } 1.61 + 1.62 + public void removeFromIgnored(BuildConfig cfg) { 1.63 + ignores.remove(cfg); 1.64 + } 1.65 + 1.66 + public void setDisablePch(BuildConfig conf) { 1.67 + disablePch.add(conf); 1.68 + } 1.69 + 1.70 + public boolean hasDisablePch(BuildConfig cfg) { 1.71 + return disablePch.contains(cfg); 1.72 + } 1.73 + 1.74 + public void removeFromDisablePch(BuildConfig cfg) { 1.75 + disablePch.remove(cfg); 1.76 + } 1.77 + 1.78 + } 1.79 +}