--- old/src/share/tools/ProjectCreator/WinGammaPlatform.java 2012-04-19 13:24:25.605522600 +0200 +++ new/src/share/tools/ProjectCreator/WinGammaPlatform.java 2012-04-19 13:24:25.147496400 +0200 @@ -25,11 +25,9 @@ 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 { @@ -196,7 +194,7 @@ protected static class PrelinkCommandData { String description; String commands; - } + } protected void addPrelinkCommand(Hashtable table, String build, @@ -215,71 +213,8 @@ } } - 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; - } + return false; + } String getProjectName(String fullPath, String extension) throws IllegalArgumentException, IOException { @@ -369,6 +304,9 @@ HsArgHandler.STRING ), + new HsArgRule("-buildSpace", "BuildSpace", null, + HsArgHandler.STRING), + new HsArgRule("-platformName", "PlatformName", null, @@ -405,6 +343,12 @@ HsArgHandler.VECTOR ), + new HsArgRule("-absoluteSrcInclude", "AbsoluteSrcInclude", + null, HsArgHandler.VECTOR), + + new HsArgRule("-relativeSrcInclude", "RelativeSrcInclude", + null, HsArgHandler.VECTOR), + new HsArgRule("-define", "Define", null, @@ -493,33 +437,18 @@ null, HsArgHandler.VECTOR ), + + new HsArgRule("-hidePath", + "IgnorePath", + null, + HsArgHandler.VECTOR + ), new HsArgRule("-additionalFile", "AdditionalFile", 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 ArgRule("-prelink", new HsArgHandler() { public void handle(ArgIterator it) { @@ -598,9 +527,10 @@ 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()); @@ -611,107 +541,99 @@ 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; - - configs = new Vector(); - add(cfg.get("Name")); - } - - void add(String confName) { - configs.add(confName); - - // if presented in all configs - if (configs.size() == numConfigs) { - configs = null; - } - } - } - - class FileInfo implements Comparable { - String full; - FileAttribute attr; - - FileInfo(String full, FileAttribute attr) { - this.full = full; - this.attr = attr; - } - - 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"); - } - } - + PrintWriter printWriter; - 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))); - } - 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); - - if (fa == null) { - fa = new FileAttribute((String)confFiles.get(filePath), bc, numConfigs); - ht.put(filePath, fa); - } else { - fa.add(confName); - } + public void writeProjectFile(String projectFileName, String projectName, + Vector allConfigs) throws IOException { + throw new RuntimeException("use compiler version specific version"); + } + + int indent; + private Stack tagStack = new Stack(); + + private void startTagPrim(String name, String[] attrs, boolean close) { + startTagPrim(name, attrs, close, true); + } + + private void startTagPrim(String name, String[] attrs, boolean close, + boolean newline) { + doIndent(); + printWriter.print("<" + name); + indent++; + + 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) { } - } + } + } - return ht; - } + if (close) { + indent--; + printWriter.print(" />"); + } else { + tagStack.push(name); + printWriter.print(">"); + } + if (newline) { + printWriter.println(); + } + } + + void startTag(String name, String... attrs) { + startTagPrim(name, attrs, false); + } + + 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(""); + } + + private void endTagNoIndent() { + String name = tagStack.pop(); + indent--; + printWriter.println(""); + } + + void tag(String name, String... attrs) { + startTagPrim(name, attrs, true); + } + + void tagData(String name, String data) { + startTagPrim(name, null, false, false); + printWriter.print(data); + endTagNoIndent(); + } + + void tagData(String name, String data, String... attrs) { + startTagPrim(name, attrs, false, false); + printWriter.print(data); + endTagNoIndent(); + } + + 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); + } + + void doIndent() { + for (int i = 0; i < indent; i++) { + printWriter.print(" "); + } + } - Hashtable computeAttributedFiles(BuildConfig bc) { - Hashtable ht = new Hashtable(); - Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash"); - - for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) { - String filePath = (String)e.nextElement(); - ht.put(filePath, new FileAttribute((String)confFiles.get(filePath), bc, 1)); - } - - return ht; - } - - PrintWriter printWriter; - - public void writeProjectFile(String projectFileName, String projectName, - Vector allConfigs) throws IOException { - throw new RuntimeException("use compiler version specific version"); - } }