src/share/tools/ProjectCreator/BuildConfig.java

Print this page
rev 3265 : 0000000: Updated projectcreator
Summary: Refactoring
Reviewed-by:
Contributed-by: nils.eliasson@oracle.com


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 import java.io.File;
  26 import java.util.Enumeration;
  27 import java.util.Hashtable;
  28 import java.util.Iterator;
  29 import java.util.Vector;
  30 
  31 class BuildConfig {

  32     Hashtable vars;
  33     Vector basicNames, basicPaths;
  34     String[] context;
  35 
  36     static CompilerInterface ci;
  37     static CompilerInterface getCI() {
  38         if (ci == null) {
  39             String comp = (String)getField(null, "CompilerVersion");
  40             try {
  41                 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
  42             } catch (Exception cnfe) {
  43                 System.err.println("Cannot find support for compiler " + comp);
  44                 throw new RuntimeException(cnfe.toString());
  45             }
  46         }
  47         return ci;
  48     }
  49 

  50     protected void initNames(String flavour, String build, String outDll) {
  51         if (vars == null) vars = new Hashtable();
  52 
  53         String flavourBuild =  flavour + "_" + build;
  54         String platformName = getFieldString(null, "PlatformName");
  55         System.out.println();
  56         System.out.println(flavourBuild);
  57 
  58         put("Name", getCI().makeCfgName(flavourBuild, platformName));
  59         put("Flavour", flavour);
  60         put("Build", build);
  61         put("PlatformName", platformName);
  62 
  63         // ones mentioned above were needed to expand format
  64         String buildBase = expandFormat(getFieldString(null, "BuildBase"));
  65         String sourceBase = getFieldString(null, "SourceBase");

  66         String outDir = buildBase;
  67 
  68         put("Id", flavourBuild);
  69         put("OutputDir", outDir);
  70         put("SourceBase", sourceBase);
  71         put("BuildBase", buildBase);

  72         put("OutputDll", outDir + Util.sep + outDll);
  73 
  74         context = new String [] {flavourBuild, flavour, build, null};
  75     }
  76 
  77     protected void init(Vector includes, Vector defines) {
  78         initDefaultDefines(defines);
  79         initDefaultCompilerFlags(includes);
  80         initDefaultLinkerFlags();
  81         handleDB();
  82     }
  83 
  84 
  85     protected void initDefaultCompilerFlags(Vector includes) {
  86         Vector compilerFlags = new Vector();
  87 
  88         compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
  89                                                           includes,
  90                                                           get("OutputDir")));
  91 
  92         put("CompilerFlags", compilerFlags);
  93     }
  94 
  95     protected void initDefaultLinkerFlags() {
  96         Vector linkerFlags = new Vector();
  97 
  98         linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));
  99 
 100         put("LinkerFlags", linkerFlags);
 101     }
 102 
 103     DirectoryTree getSourceTree(String sourceBase, String startAt) {
 104         DirectoryTree tree = new DirectoryTree();
 105 
 106         tree.addSubdirToIgnore("Codemgr_wsdata");
 107         tree.addSubdirToIgnore("deleted_files");
 108         tree.addSubdirToIgnore("SCCS");
 109         tree.setVerbose(true);
 110         if (startAt != null) {
 111             tree.readDirectory(sourceBase + File.separator + startAt);
 112         } else {
 113             tree.readDirectory(sourceBase);
 114         }
 115 
 116         return tree;
 117     }
 118 
 119 
 120     Vector getPreferredPaths() {
 121         Vector preferredPaths = new Vector();
 122 
 123         // In the case of multiple files with the same name in
 124         // different subdirectories, prefer these versions
 125         preferredPaths.add("windows");
 126         preferredPaths.add("x86");
 127         preferredPaths.add("closed");
 128 
 129         // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
 130         preferredPaths.add("opto");
 131 
 132         return preferredPaths;
 133     }
 134 
 135 
 136     void handleDB() {
 137         WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
 138 
 139         putSpecificField("AllFilesHash", computeAllFiles(platform));
 140     }
 141 
 142 
 143     private boolean matchesIgnoredPath(String prefixedName) {
 144         Vector rv = new Vector();
 145         collectRelevantVectors(rv, "IgnorePath");
 146         for (Iterator i = rv.iterator(); i.hasNext(); ) {
 147             String pathPart = (String) i.next();
 148             if (prefixedName.contains(Util.normalize(pathPart)))  {
 149                 return true;
 150             }
 151         }
 152         return false;
 153     }
 154 
 155     void addAll(Iterator i, Hashtable hash,
 156                 WinGammaPlatform platform, DirectoryTree tree,
 157                 Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) {
 158         for (; i.hasNext(); ) {
 159             String fileName = (String) i.next();
 160             if (lookupHashFieldInContext("IgnoreFile", fileName) == null) {
 161                 String prefixedName = platform.envVarPrefixedFileName(fileName,
 162                                                                       0, /* ignored */
 163                                                                       tree,
 164                                                                       preferredPaths,
 165                                                                       filesNotFound,
 166                                                                       filesDuplicate);
 167                 if (prefixedName != null) {
 168                     prefixedName = Util.normalize(prefixedName);
 169                     if (!matchesIgnoredPath(prefixedName)) {
 170                         addTo(hash, prefixedName, fileName);
 171                     }
 172                 }
 173             }
 174         }

 175     }
 176 
 177     void addTo(Hashtable ht, String key, String value) {
 178         ht.put(expandFormat(key), expandFormat(value));
 179     }
 180 
 181     Hashtable computeAllFiles(WinGammaPlatform platform) {
 182         Hashtable rv = new Hashtable();
 183         DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
 184         Vector preferredPaths = getPreferredPaths();
 185 
 186         // Hold errors until end
 187         Vector filesNotFound = new Vector();
 188         Vector filesDuplicate = new Vector();
 189 
 190         Vector includedFiles = new Vector();
 191 
 192         // find all files
 193         Vector dirs = getSourceIncludes();
 194         for (Iterator i = dirs.iterator(); i.hasNext(); ) {
 195             String dir = (String)i.next();
 196             DirectoryTree subtree = getSourceTree(dir, null);
 197             for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) {
 198                 String name = ((File)fi.next()).getName();
 199                 includedFiles.add(name);
 200             }
 201         }
 202         addAll(includedFiles.iterator(), rv,
 203                platform, tree,
 204                preferredPaths, filesNotFound, filesDuplicate);
 205 
 206         Vector addFiles = new Vector();
 207         collectRelevantVectors(addFiles, "AdditionalFile");
 208         addAll(addFiles.iterator(), rv,
 209                platform, tree,
 210                preferredPaths, filesNotFound, filesDuplicate);
 211 
 212         collectRelevantHashes(rv, "AdditionalGeneratedFile");
 213 
 214         if ((filesNotFound.size() != 0) ||
 215             (filesDuplicate.size() != 0)) {
 216             System.err.println("Error: some files were not found or " +
 217                                "appeared in multiple subdirectories of " +
 218                                "directory " + get("SourceBase") + " and could not " +
 219                                "be resolved with os_family and arch.");
 220             if (filesNotFound.size() != 0) {
 221                 System.err.println("Files not found:");
 222                 for (Iterator iter = filesNotFound.iterator();
 223                      iter.hasNext(); ) {
 224                     System.err.println("  " + (String) iter.next());
 225                 }
 226             }
 227             if (filesDuplicate.size() != 0) {
 228                 System.err.println("Duplicate files:");
 229                 for (Iterator iter = filesDuplicate.iterator();
 230                      iter.hasNext(); ) {
 231                     System.err.println("  " + (String) iter.next());
 232                 }
 233             }
 234             throw new RuntimeException();
 235         }
 236 
 237         return rv;
 238     }
 239 
 240     void initDefaultDefines(Vector defines) {
 241         Vector sysDefines = new Vector();
 242         sysDefines.add("WIN32");
 243         sysDefines.add("_WINDOWS");
 244         sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
 245         sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
 246         sysDefines.add("INCLUDE_TRACE");
 247         sysDefines.add("_JNI_IMPLEMENTATION_");
 248         if (vars.get("PlatformName").equals("Win32")) {
 249             sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
 250         } else {
 251             sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
 252         }
 253 
 254         sysDefines.addAll(defines);
 255 
 256         put("Define", sysDefines);
 257     }
 258 
 259     String get(String key) {


 307         getV(key).addAll(vvalue);
 308     }
 309 
 310     String flavour() {
 311         return get("Flavour");
 312     }
 313 
 314     String build() {
 315         return get("Build");
 316     }
 317 
 318     Object getSpecificField(String field) {
 319         return getField(get("Id"), field);
 320     }
 321 
 322     void putSpecificField(String field, Object value) {
 323         putField(get("Id"), field, value);
 324     }
 325 
 326     void collectRelevantVectors(Vector rv, String field) {
 327         for (int i = 0; i < context.length; i++) {
 328             Vector v = getFieldVector(context[i], field);
 329             if (v != null) {
 330                 for (Iterator j=v.iterator(); j.hasNext(); ) {
 331                     String val = (String)j.next();
 332                     rv.add(expandFormat(val));
 333                 }
 334             }
 335         }
 336     }
 337 
 338     void collectRelevantHashes(Hashtable rv, String field) {
 339         for (int i = 0; i < context.length; i++) {
 340             Hashtable v = (Hashtable)getField(context[i], field);
 341             if (v != null) {
 342                 for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
 343                     String key = (String)e.nextElement();
 344                     String val =  (String)v.get(key);
 345                     addTo(rv, key, val);
 346                 }
 347             }
 348         }
 349     }
 350 
 351 
 352     Vector getDefines() {
 353         Vector rv = new Vector();
 354         collectRelevantVectors(rv, "Define");
 355         return rv;
 356     }
 357 
 358     Vector getIncludes() {
 359         Vector rv = new Vector();
 360 
 361         collectRelevantVectors(rv, "AbsoluteInclude");
 362 
 363         rv.addAll(getSourceIncludes());
 364 
 365         return rv;
 366     }
 367 
 368     private Vector getSourceIncludes() {
 369         Vector rv = new Vector();
 370         Vector ri = new Vector();
 371         String sourceBase = getFieldString(null, "SourceBase");
 372         collectRelevantVectors(ri, "RelativeInclude");
 373         for (Iterator i = ri.iterator(); i.hasNext(); ) {
 374             String f = (String)i.next();
 375             rv.add(sourceBase + Util.sep + f);
 376         }
 377         return rv;
 378     }
 379 
 380     static Hashtable cfgData = new Hashtable();
 381     static Hashtable globalData = new Hashtable();
 382 
 383     static boolean appliesToTieredBuild(String cfg) {
 384         return (cfg != null &&
 385                 (cfg.startsWith("compiler1") ||
 386                  cfg.startsWith("compiler2")));
 387     }
 388 
 389     // Filters out the IgnoreFile and IgnorePaths since they are
 390     // handled specially for tiered builds.
 391     static boolean appliesToTieredBuild(String cfg, String key) {
 392         return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore"));
 393     }
 394 


 587         return getCI().getNoOptFlag();
 588     }
 589 
 590     TieredDebugConfig() {
 591         initNames("tiered", "debug", "jvm.dll");
 592         init(getIncludes(), getDefines());
 593     }
 594 }
 595 
 596 class TieredFastDebugConfig extends GenericDebugNonKernelConfig {
 597     String getOptFlag() {
 598         return getCI().getOptFlag();
 599     }
 600 
 601     TieredFastDebugConfig() {
 602         initNames("tiered", "fastdebug", "jvm.dll");
 603         init(getIncludes(), getDefines());
 604     }
 605 }
 606 
 607 
 608 abstract class ProductConfig extends BuildConfig {
 609     protected void init(Vector includes, Vector defines) {
 610         defines.add("NDEBUG");
 611         defines.add("PRODUCT");
 612 
 613         super.init(includes, defines);
 614 
 615         getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
 616         getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
 617     }
 618 }
 619 
 620 class C1ProductConfig extends ProductConfig {
 621     C1ProductConfig() {
 622         initNames("compiler1", "product", "jvm.dll");
 623         init(getIncludes(), getDefines());
 624     }
 625 }
 626 
 627 class C2ProductConfig extends ProductConfig {
 628     C2ProductConfig() {
 629         initNames("compiler2", "product", "jvm.dll");
 630         init(getIncludes(), getDefines());
 631     }
 632 }
 633 
 634 class TieredProductConfig extends ProductConfig {
 635     TieredProductConfig() {
 636         initNames("tiered", "product", "jvm.dll");
 637         init(getIncludes(), getDefines());
 638     }
 639 }
 640 
 641 
 642 class CoreDebugConfig extends GenericDebugNonKernelConfig {
 643     String getOptFlag() {
 644         return getCI().getNoOptFlag();
 645     }
 646 
 647     CoreDebugConfig() {
 648         initNames("core", "debug", "jvm.dll");
 649         init(getIncludes(), getDefines());
 650     }
 651 }
 652 
 653 
 654 class CoreFastDebugConfig extends GenericDebugNonKernelConfig {
 655     String getOptFlag() {
 656         return getCI().getOptFlag();
 657     }
 658 
 659     CoreFastDebugConfig() {
 660         initNames("core", "fastdebug", "jvm.dll");
 661         init(getIncludes(), getDefines());
 662     }
 663 }
 664 
 665 
 666 class CoreProductConfig extends ProductConfig {
 667     CoreProductConfig() {
 668         initNames("core", "product", "jvm.dll");
 669         init(getIncludes(), getDefines());
 670     }
 671 }
 672 
 673 class KernelDebugConfig extends GenericDebugConfig {
 674     String getOptFlag() {
 675         return getCI().getNoOptFlag();
 676     }
 677 
 678     KernelDebugConfig() {
 679         initNames("kernel", "debug", "jvm.dll");
 680         init(getIncludes(), getDefines());
 681     }
 682 }
 683 
 684 
 685 class KernelFastDebugConfig extends GenericDebugConfig {
 686     String getOptFlag() {
 687         return getCI().getOptFlag();
 688     }
 689 
 690     KernelFastDebugConfig() {
 691         initNames("kernel", "fastdebug", "jvm.dll");
 692         init(getIncludes(), getDefines());
 693     }
 694 }
 695 
 696 
 697 class KernelProductConfig extends ProductConfig {
 698     KernelProductConfig() {
 699         initNames("kernel", "product", "jvm.dll");
 700         init(getIncludes(), getDefines());
 701     }
 702 }

 703 abstract class CompilerInterface {
 704     abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
 705     abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
 706     abstract Vector getDebugCompilerFlags(String opt);
 707     abstract Vector getDebugLinkerFlags();
 708     abstract void   getAdditionalNonKernelLinkerFlags(Vector rv);
 709     abstract Vector getProductCompilerFlags();
 710     abstract Vector getProductLinkerFlags();
 711     abstract String getOptFlag();
 712     abstract String getNoOptFlag();
 713     abstract String makeCfgName(String flavourBuild, String platformName);
 714 
 715     void addAttr(Vector receiver, String attr, String value) {
 716         receiver.add(attr); receiver.add(value);
 717     }
 718     void extAttr(Vector receiver, String attr, String value) {
 719         int attr_pos=receiver.indexOf(attr) ;
 720         if ( attr_pos == -1) {
 721           // If attr IS NOT present in the Vector - add it
 722           receiver.add(attr); receiver.add(value);


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 

  25 import java.util.Enumeration;
  26 import java.util.Hashtable;

  27 import java.util.Vector;
  28 
  29 class BuildConfig {
  30     @SuppressWarnings("rawtypes")
  31         Hashtable vars;
  32     Vector<String> basicNames, basicPaths;
  33     String[] context;
  34 
  35     static CompilerInterface ci;
  36     static CompilerInterface getCI() {
  37         if (ci == null) {
  38             String comp = (String)getField(null, "CompilerVersion");
  39             try {
  40                 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
  41             } catch (Exception cnfe) {
  42                 System.err.println("Cannot find support for compiler " + comp);
  43                 throw new RuntimeException(cnfe.toString());
  44             }
  45         }
  46         return ci;
  47     }
  48 
  49     @SuppressWarnings("rawtypes")
  50         protected void initNames(String flavour, String build, String outDll) {
  51         if (vars == null) vars = new Hashtable();
  52 
  53         String flavourBuild =  flavour + "_" + build;
  54         String platformName = getFieldString(null, "PlatformName");
  55         System.out.println();
  56         System.out.println(flavourBuild);
  57 
  58         put("Name", getCI().makeCfgName(flavourBuild, platformName));
  59         put("Flavour", flavour);
  60         put("Build", build);
  61         put("PlatformName", platformName);
  62 
  63         // ones mentioned above were needed to expand format
  64         String buildBase = expandFormat(getFieldString(null, "BuildBase"));
  65         String sourceBase = getFieldString(null, "SourceBase");
  66         String buildSpace = getFieldString(null, "BuildSpace");
  67         String outDir = buildBase;
  68 
  69         put("Id", flavourBuild);
  70         put("OutputDir", outDir);
  71         put("SourceBase", sourceBase);
  72         put("BuildBase", buildBase);
  73         put("BuildSpace", buildSpace);
  74         put("OutputDll", outDir + Util.sep + outDll);
  75 
  76         context = new String [] {flavourBuild, flavour, build, null};
  77     }
  78 
  79     protected void init(Vector<String> includes, Vector<String> defines) {
  80         initDefaultDefines(defines);
  81         initDefaultCompilerFlags(includes);
  82         initDefaultLinkerFlags();
  83         //handleDB();
  84     }
  85 
  86 
  87     protected void initDefaultCompilerFlags(Vector<String> includes) {
  88         Vector compilerFlags = new Vector();
  89 
  90         compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
  91                                                           includes,
  92                                                           get("OutputDir")));
  93 
  94         put("CompilerFlags", compilerFlags);
  95     }
  96 
  97     protected void initDefaultLinkerFlags() {
  98         Vector linkerFlags = new Vector();
  99 
 100         linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));
 101 
 102         put("LinkerFlags", linkerFlags);
 103     }
 104 
 105     public boolean matchesIgnoredPath(String path) {
 106         Vector<String> rv = new Vector<String>();
 107         collectRelevantVectors(rv, "IgnorePath");
 108         for (String pathPart : rv) {
 109             if (path.contains(pathPart))  {
 110                 return true;





 111             }


 112         }
 113         return false;





















 114     }
 115     
 116     public boolean matchesHidePath(String path) {
 117         Vector<String> rv = new Vector<String>();
 118         collectRelevantVectors(rv, "HidePath");
 119         for (String pathPart : rv) {
 120             if (path.contains(Util.normalize(pathPart)))  {


 121                 return true;
 122             }
 123         }
 124         return false;
 125     }
 126     
 127    public Vector<String> matchesAdditionalGeneratedPath(String fullPath) {
 128             Vector<String> rv = new Vector<String>();
 129         Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile");
 130         if (v != null) {
 131             for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) {
 132                 String key = e.nextElement();
 133                 String val = v.get(key);
 134 
 135                 if (fullPath.endsWith(expandFormat(key))) {
 136                         rv.add(expandFormat(val));







 137                 }                
 138             }
 139         }
 140         return rv;
 141     }
 142 
 143     void addTo(Hashtable ht, String key, String value) {
 144         ht.put(expandFormat(key), expandFormat(value));
 145     }
 146 



























































 147     void initDefaultDefines(Vector defines) {
 148         Vector sysDefines = new Vector();
 149         sysDefines.add("WIN32");
 150         sysDefines.add("_WINDOWS");
 151         sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
 152         sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
 153         sysDefines.add("INCLUDE_TRACE");
 154         sysDefines.add("_JNI_IMPLEMENTATION_");
 155         if (vars.get("PlatformName").equals("Win32")) {
 156             sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
 157         } else {
 158             sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
 159         }
 160 
 161         sysDefines.addAll(defines);
 162 
 163         put("Define", sysDefines);
 164     }
 165 
 166     String get(String key) {


 214         getV(key).addAll(vvalue);
 215     }
 216 
 217     String flavour() {
 218         return get("Flavour");
 219     }
 220 
 221     String build() {
 222         return get("Build");
 223     }
 224 
 225     Object getSpecificField(String field) {
 226         return getField(get("Id"), field);
 227     }
 228 
 229     void putSpecificField(String field, Object value) {
 230         putField(get("Id"), field, value);
 231     }
 232 
 233     void collectRelevantVectors(Vector rv, String field) {
 234         for (String ctx : context) {
 235             Vector<String> v = getFieldVector(ctx, field);












 236             if (v != null) {
 237                 for (String val : v) {
 238                     rv.add(expandFormat(val).replace('/', '\\'));


 239                 }
 240             }
 241         }
 242     }
 243 

 244     Vector getDefines() {
 245         Vector rv = new Vector();
 246         collectRelevantVectors(rv, "Define");
 247         return rv;
 248     }
 249 
 250     Vector getIncludes() {
 251         Vector rv = new Vector();

 252         collectRelevantVectors(rv, "AbsoluteInclude");

 253         rv.addAll(getSourceIncludes());

 254         return rv;
 255     }
 256 
 257     private Vector getSourceIncludes() {
 258         Vector<String> rv = new Vector<String>();
 259         Vector<String> ri = new Vector<String>();
 260         String sourceBase = getFieldString(null, "SourceBase");
 261         collectRelevantVectors(ri, "RelativeInclude");
 262         for (String f : ri) {

 263             rv.add(sourceBase + Util.sep + f);
 264         }
 265         return rv;
 266     }
 267 
 268     static Hashtable cfgData = new Hashtable();
 269     static Hashtable globalData = new Hashtable();
 270 
 271     static boolean appliesToTieredBuild(String cfg) {
 272         return (cfg != null &&
 273                 (cfg.startsWith("compiler1") ||
 274                  cfg.startsWith("compiler2")));
 275     }
 276 
 277     // Filters out the IgnoreFile and IgnorePaths since they are
 278     // handled specially for tiered builds.
 279     static boolean appliesToTieredBuild(String cfg, String key) {
 280         return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore"));
 281     }
 282 


 475         return getCI().getNoOptFlag();
 476     }
 477 
 478     TieredDebugConfig() {
 479         initNames("tiered", "debug", "jvm.dll");
 480         init(getIncludes(), getDefines());
 481     }
 482 }
 483 
 484 class TieredFastDebugConfig extends GenericDebugNonKernelConfig {
 485     String getOptFlag() {
 486         return getCI().getOptFlag();
 487     }
 488 
 489     TieredFastDebugConfig() {
 490         initNames("tiered", "fastdebug", "jvm.dll");
 491         init(getIncludes(), getDefines());
 492     }
 493 }
 494 

 495 abstract class ProductConfig extends BuildConfig {
 496     protected void init(Vector includes, Vector defines) {
 497         defines.add("NDEBUG");
 498         defines.add("PRODUCT");
 499 
 500         super.init(includes, defines);
 501 
 502         getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
 503         getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
 504     }
 505 }
 506 
 507 class C1ProductConfig extends ProductConfig {
 508     C1ProductConfig() {
 509         initNames("compiler1", "product", "jvm.dll");
 510         init(getIncludes(), getDefines());
 511     }
 512 }
 513 
 514 class C2ProductConfig extends ProductConfig {
 515     C2ProductConfig() {
 516         initNames("compiler2", "product", "jvm.dll");
 517         init(getIncludes(), getDefines());
 518     }
 519 }
 520 
 521 class TieredProductConfig extends ProductConfig {
 522     TieredProductConfig() {
 523         initNames("tiered", "product", "jvm.dll");
 524         init(getIncludes(), getDefines());
 525     }
 526 }
 527 
 528 /*
 529 class CoreDebugConfig extends GenericDebugNonKernelConfig {
 530     String getOptFlag() {
 531         return getCI().getNoOptFlag();
 532     }
 533 
 534     CoreDebugConfig() {
 535         initNames("core", "debug", "jvm.dll");
 536         init(getIncludes(), getDefines());
 537     }
 538 }
 539 

 540 class CoreFastDebugConfig extends GenericDebugNonKernelConfig {
 541     String getOptFlag() {
 542         return getCI().getOptFlag();
 543     }
 544 
 545     CoreFastDebugConfig() {
 546         initNames("core", "fastdebug", "jvm.dll");
 547         init(getIncludes(), getDefines());
 548     }
 549 }
 550 

 551 class CoreProductConfig extends ProductConfig {
 552     CoreProductConfig() {
 553         initNames("core", "product", "jvm.dll");
 554         init(getIncludes(), getDefines());
 555     }
 556 }*/
 557 
 558 class KernelDebugConfig extends GenericDebugConfig {
 559     String getOptFlag() {
 560         return getCI().getNoOptFlag();
 561     }
 562 
 563     KernelDebugConfig() {
 564         initNames("kernel", "debug", "jvm.dll");
 565         init(getIncludes(), getDefines());
 566     }
 567 }
 568 
 569 
 570 class KernelFastDebugConfig extends GenericDebugConfig {
 571     String getOptFlag() {
 572         return getCI().getOptFlag();
 573     }
 574 
 575     KernelFastDebugConfig() {
 576         initNames("kernel", "fastdebug", "jvm.dll");
 577         init(getIncludes(), getDefines());
 578     }
 579 }
 580 
 581 
 582 class KernelProductConfig extends ProductConfig {
 583     KernelProductConfig() {
 584         initNames("kernel", "product", "jvm.dll");
 585         init(getIncludes(), getDefines());
 586     }
 587 }
 588 
 589 abstract class CompilerInterface {
 590     abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
 591     abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
 592     abstract Vector getDebugCompilerFlags(String opt);
 593     abstract Vector getDebugLinkerFlags();
 594     abstract void   getAdditionalNonKernelLinkerFlags(Vector rv);
 595     abstract Vector getProductCompilerFlags();
 596     abstract Vector getProductLinkerFlags();
 597     abstract String getOptFlag();
 598     abstract String getNoOptFlag();
 599     abstract String makeCfgName(String flavourBuild, String platformName);
 600 
 601     void addAttr(Vector receiver, String attr, String value) {
 602         receiver.add(attr); receiver.add(value);
 603     }
 604     void extAttr(Vector receiver, String attr, String value) {
 605         int attr_pos=receiver.indexOf(attr) ;
 606         if ( attr_pos == -1) {
 607           // If attr IS NOT present in the Vector - add it
 608           receiver.add(attr); receiver.add(value);