src/share/tools/ProjectCreator/WinGammaPlatform.java
Print this page
rev 3265 : projectcreator
@@ -23,15 +23,13 @@
*/
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
+import java.util.Stack;
import java.util.Vector;
abstract class HsArgHandler extends ArgHandler {
static final int STRING = 1;
static final int VECTOR = 2;
@@ -216,73 +214,10 @@
}
return false;
}
- /* This returns a String containing the full path to the passed
- file name, or null if an error occurred. If the file was not
- found or was a duplicate and couldn't be resolved using the
- preferred paths, the file name is added to the appropriate
- Vector of Strings. */
- private String findFileInDirectory(String fileName,
- DirectoryTree directory,
- Vector preferredPaths,
- Vector filesNotFound,
- Vector filesDuplicate) {
- List locationsInTree = directory.findFile(fileName);
- int rootNameLength = directory.getRootNodeName().length();
- String name = null;
- if ((locationsInTree == null) ||
- (locationsInTree.size() == 0)) {
- filesNotFound.add(fileName);
- } else if (locationsInTree.size() > 1) {
- // Iterate through them, trying to find one with a
- // preferred path
- search:
- {
- for (Iterator locIter = locationsInTree.iterator();
- locIter.hasNext(); ) {
- DirectoryTreeNode node =
- (DirectoryTreeNode) locIter.next();
- String tmpName = node.getName();
- for (Iterator prefIter = preferredPaths.iterator();
- prefIter.hasNext(); ) {
- // We need to make sure the preferred path is
- // found from the file path not including the root node name.
- if (tmpName.indexOf((String)prefIter.next(),
- rootNameLength) != -1) {
- name = tmpName;
- break search;
- }
- }
- }
- }
-
- if (name == null) {
- filesDuplicate.add(fileName);
- }
- } else {
- name = ((DirectoryTreeNode) locationsInTree.get(0)).getName();
- }
-
- return name;
- }
-
- protected String envVarPrefixedFileName(String fileName,
- int sourceBaseLen,
- DirectoryTree tree,
- Vector preferredPaths,
- Vector filesNotFound,
- Vector filesDuplicate) {
- String fullName = findFileInDirectory(fileName,
- tree,
- preferredPaths,
- filesNotFound,
- filesDuplicate);
- return fullName;
- }
-
String getProjectName(String fullPath, String extension)
throws IllegalArgumentException, IOException {
File file = new File(fullPath).getCanonicalFile();
fullPath = file.getCanonicalPath();
String parent = file.getParent();
@@ -367,10 +302,13 @@
"BuildBase",
" (Did you set the HotSpotBuildSpace environment variable?)",
HsArgHandler.STRING
),
+ new HsArgRule("-buildSpace", "BuildSpace", null,
+ HsArgHandler.STRING),
+
new HsArgRule("-platformName",
"PlatformName",
null,
HsArgHandler.STRING
),
@@ -403,10 +341,16 @@
"RelativeInclude",
null,
HsArgHandler.VECTOR
),
+ new HsArgRule("-absoluteSrcInclude", "AbsoluteSrcInclude",
+ null, HsArgHandler.VECTOR),
+
+ new HsArgRule("-relativeSrcInclude", "RelativeSrcInclude",
+ null, HsArgHandler.VECTOR),
+
new HsArgRule("-define",
"Define",
null,
HsArgHandler.VECTOR
),
@@ -492,36 +436,21 @@
"IgnorePath",
null,
HsArgHandler.VECTOR
),
- new HsArgRule("-additionalFile",
- "AdditionalFile",
+ new HsArgRule("-hidePath",
+ "IgnorePath",
null,
HsArgHandler.VECTOR
),
- new ArgRuleSpecific("-additionalGeneratedFile",
- new HsArgHandler() {
- public void handle(ArgIterator it) {
- String cfg = getCfg(it.get());
- if (nextNotKey(it)) {
- String dir = it.get();
- if (nextNotKey(it)) {
- String fileName = it.get();
- BuildConfig.putFieldHash(cfg, "AdditionalGeneratedFile",
- Util.normalize(dir + Util.sep + fileName),
- fileName);
- it.next();
- return;
- }
- }
- empty(null, "** Error: wrong number of args to -additionalGeneratedFile");
- }
- }
+ new HsArgRule("-additionalFile",
+ "AdditionalFile",
+ null,
+ HsArgHandler.VECTOR
),
-
new ArgRule("-prelink",
new HsArgHandler() {
public void handle(ArgIterator it) {
if (nextNotKey(it)) {
if (nextNotKey(it)) {
@@ -596,122 +525,115 @@
allConfigs.add(new TieredDebugConfig());
allConfigs.add(new TieredFastDebugConfig());
allConfigs.add(new TieredProductConfig());
- allConfigs.add(new CoreDebugConfig());
- allConfigs.add(new CoreFastDebugConfig());
- allConfigs.add(new CoreProductConfig());
+ // Removed for now, doesn't build and isn't tested
+ //allConfigs.add(new CoreDebugConfig());
+ //allConfigs.add(new CoreFastDebugConfig());
+ //allConfigs.add(new CoreProductConfig());
if (platform.equals("Win32")) {
allConfigs.add(new KernelDebugConfig());
allConfigs.add(new KernelFastDebugConfig());
allConfigs.add(new KernelProductConfig());
}
return allConfigs;
}
- class FileAttribute {
- int numConfigs;
- Vector configs;
- String shortName;
- boolean noPch, pchRoot;
-
- FileAttribute(String shortName, BuildConfig cfg, int numConfigs) {
- this.shortName = shortName;
- this.noPch = (cfg.lookupHashFieldInContext("DisablePch", shortName) != null);
- this.pchRoot = shortName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"));
- this.numConfigs = numConfigs;
+ PrintWriter printWriter;
- configs = new Vector();
- add(cfg.get("Name"));
+ public void writeProjectFile(String projectFileName, String projectName,
+ Vector<BuildConfig> allConfigs) throws IOException {
+ throw new RuntimeException("use compiler version specific version");
}
- void add(String confName) {
- configs.add(confName);
+ int indent;
+ private Stack<String> tagStack = new Stack<String>();
- // if presented in all configs
- if (configs.size() == numConfigs) {
- configs = null;
- }
- }
+ private void startTagPrim(String name, String[] attrs, boolean close) {
+ startTagPrim(name, attrs, close, true);
}
- class FileInfo implements Comparable {
- String full;
- FileAttribute attr;
+ private void startTagPrim(String name, String[] attrs, boolean close,
+ boolean newline) {
+ doIndent();
+ printWriter.print("<" + name);
+ indent++;
- FileInfo(String full, FileAttribute attr) {
- this.full = full;
- this.attr = attr;
+ if (attrs != null && attrs.length > 0) {
+ for (int i = 0; i < attrs.length; i += 2) {
+ printWriter.print(" " + attrs[i] + "=\"" + attrs[i + 1] + "\"");
+ if (i < attrs.length - 2) {
}
-
- public int compareTo(Object o) {
- FileInfo oo = (FileInfo)o;
- return full.compareTo(oo.full);
}
-
- boolean isHeader() {
- return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp");
}
- boolean isCpp() {
- return attr.shortName.endsWith(".cpp");
- }
+ if (close) {
+ indent--;
+ printWriter.print(" />");
+ } else {
+ tagStack.push(name);
+ printWriter.print(">");
}
-
-
- TreeSet sortFiles(Hashtable allFiles) {
- TreeSet rv = new TreeSet();
- Enumeration e = allFiles.keys();
- while (e.hasMoreElements()) {
- String fullPath = (String)e.nextElement();
- rv.add(new FileInfo(fullPath, (FileAttribute)allFiles.get(fullPath)));
+ if (newline) {
+ printWriter.println();
}
- return rv;
}
- Hashtable computeAttributedFiles(Vector allConfigs) {
- Hashtable ht = new Hashtable();
- int numConfigs = allConfigs.size();
-
- for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
- BuildConfig bc = (BuildConfig)i.next();
- Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
- String confName = bc.get("Name");
-
- for (Enumeration e=confFiles.keys(); e.hasMoreElements(); ) {
- String filePath = (String)e.nextElement();
- FileAttribute fa = (FileAttribute)ht.get(filePath);
+ void startTag(String name, String... attrs) {
+ startTagPrim(name, attrs, false);
+ }
- if (fa == null) {
- fa = new FileAttribute((String)confFiles.get(filePath), bc, numConfigs);
- ht.put(filePath, fa);
- } else {
- fa.add(confName);
+ void startTagV(String name, Vector attrs) {
+ String s[] = new String[attrs.size()];
+ for (int i = 0; i < attrs.size(); i++) {
+ s[i] = (String) attrs.elementAt(i);
}
+ startTagPrim(name, s, false);
}
+
+ void endTag() {
+ String name = tagStack.pop();
+ indent--;
+ doIndent();
+ printWriter.println("</" + name + ">");
}
- return ht;
+ private void endTagNoIndent() {
+ String name = tagStack.pop();
+ indent--;
+ printWriter.println("</" + name + ">");
}
- Hashtable computeAttributedFiles(BuildConfig bc) {
- Hashtable ht = new Hashtable();
- Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
+ void tag(String name, String... attrs) {
+ startTagPrim(name, attrs, true);
+ }
- for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) {
- String filePath = (String)e.nextElement();
- ht.put(filePath, new FileAttribute((String)confFiles.get(filePath), bc, 1));
+ void tagData(String name, String data) {
+ startTagPrim(name, null, false, false);
+ printWriter.print(data);
+ endTagNoIndent();
}
- return ht;
+ void tagData(String name, String data, String... attrs) {
+ startTagPrim(name, attrs, false, false);
+ printWriter.print(data);
+ endTagNoIndent();
}
- PrintWriter printWriter;
+ void tagV(String name, Vector attrs) {
+ String s[] = new String[attrs.size()];
+ for (int i = 0; i < attrs.size(); i++) {
+ s[i] = (String) attrs.elementAt(i);
+ }
+ startTagPrim(name, s, true);
+ }
- public void writeProjectFile(String projectFileName, String projectName,
- Vector<BuildConfig> allConfigs) throws IOException {
- throw new RuntimeException("use compiler version specific version");
+ void doIndent() {
+ for (int i = 0; i < indent; i++) {
+ printWriter.print(" ");
}
+ }
+
}