annotate src/share/tools/ProjectCreator/FileTreeCreator.java @ 12021:bd0e82136b03

8022740: Visual 2008 IDE build is broken Summary: Fixed project generation code, and added warning to upgrade to VS 2008 SP1. Reviewed-by: dcubed, ccheung
author iklam
date Sat, 10 Aug 2013 10:56:27 -0700
parents 1a9b9cfcef41
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6801
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
1 import java.nio.file.FileSystems;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
2 import java.nio.file.Path;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
3 import java.nio.file.SimpleFileVisitor;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
4 import java.util.HashSet;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
5 import java.util.Stack;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
6 import java.util.Vector;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
7
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
8 public class FileTreeCreator extends SimpleFileVisitor<Path>
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
9 {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
10 Path vcProjLocation;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
11 Path startDir;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
12 final int startDirLength;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
13 Stack<DirAttributes> attributes = new Stack<DirAttributes>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
14 Vector<BuildConfig> allConfigs;
12021
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
15 WinGammaPlatform wg;
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
16 WinGammaPlatformVC10 wg10;
6801
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
17
12021
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
18 public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) {
6801
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
19 super();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
20 this.wg = wg;
12021
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
21 if (wg instanceof WinGammaPlatformVC10) {
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
22 wg10 = (WinGammaPlatformVC10)wg;
bd0e82136b03 8022740: Visual 2008 IDE build is broken
iklam
parents: 6801
diff changeset
23 }
6801
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
24 this.allConfigs = allConfigs;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
25 this.startDir = startDir;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
26 startDirLength = startDir.toAbsolutePath().toString().length();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
27 vcProjLocation = FileSystems.getDefault().getPath(allConfigs.firstElement().get("BuildSpace"));
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
28 attributes.push(new DirAttributes());
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
29 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
30
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
31 public class DirAttributes {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
32
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
33 private HashSet<BuildConfig> ignores;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
34 private HashSet<BuildConfig> disablePch;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
35
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
36 public DirAttributes() {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
37 ignores = new HashSet<BuildConfig>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
38 disablePch = new HashSet<BuildConfig>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
39 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
40
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
41 public DirAttributes(HashSet<BuildConfig> excludes2, HashSet<BuildConfig> disablePch2) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
42 ignores = excludes2;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
43 disablePch = disablePch2;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
44 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
45
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
46 @SuppressWarnings("unchecked")
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
47 public DirAttributes clone() {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
48 return new DirAttributes((HashSet<BuildConfig>)this.ignores.clone(), (HashSet<BuildConfig>)this.disablePch.clone());
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
49 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
50
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
51 public void setIgnore(BuildConfig conf) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
52 ignores.add(conf);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
53 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
54
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
55 public boolean hasIgnore(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
56 return ignores.contains(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
57 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
58
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
59 public void removeFromIgnored(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
60 ignores.remove(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
61 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
62
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
63 public void setDisablePch(BuildConfig conf) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
64 disablePch.add(conf);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
65 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
66
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
67 public boolean hasDisablePch(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
68 return disablePch.contains(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
69 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
70
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
71 public void removeFromDisablePch(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
72 disablePch.remove(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
73 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
74
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
75 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
76 }