src/share/tools/ProjectCreator/BuildConfig.java

changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 2369
aa6e219afbf1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/tools/ProjectCreator/BuildConfig.java	Tue Nov 23 13:22:55 2010 -0800
     1.3 @@ -0,0 +1,716 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +import java.util.*;
    1.29 +import java.io.File;
    1.30 +
    1.31 +class BuildConfig {
    1.32 +    Hashtable vars;
    1.33 +    Vector basicNames, basicPaths;
    1.34 +    String[] context;
    1.35 +
    1.36 +    static CompilerInterface ci;
    1.37 +    static CompilerInterface getCI() {
    1.38 +        if (ci == null) {
    1.39 +            String comp = (String)getField(null, "CompilerVersion");
    1.40 +            try {
    1.41 +                ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
    1.42 +            } catch (Exception cnfe) {
    1.43 +                System.err.println("Cannot find support for compiler " + comp);
    1.44 +                throw new RuntimeException(cnfe.toString());
    1.45 +            }
    1.46 +        }
    1.47 +        return ci;
    1.48 +    }
    1.49 +
    1.50 +    protected void initNames(String flavour, String build, String outDll) {
    1.51 +        if (vars == null) vars = new Hashtable();
    1.52 +
    1.53 +        String flavourBuild =  flavour + "_" + build;
    1.54 +        System.out.println();
    1.55 +        System.out.println(flavourBuild);
    1.56 +
    1.57 +        put("Name", getCI().makeCfgName(flavourBuild));
    1.58 +        put("Flavour", flavour);
    1.59 +        put("Build", build);
    1.60 +
    1.61 +        // ones mentioned above were needed to expand format
    1.62 +        String buildBase = expandFormat(getFieldString(null, "BuildBase"));
    1.63 +        String jdkDir =  getFieldString(null, "JdkTargetRoot");
    1.64 +        String sourceBase = getFieldString(null, "SourceBase");
    1.65 +        String outDir = buildBase;
    1.66 +
    1.67 +        put("Id", flavourBuild);
    1.68 +        put("OutputDir", outDir);
    1.69 +        put("SourceBase", sourceBase);
    1.70 +        put("BuildBase", buildBase);
    1.71 +        put("OutputDll", jdkDir + Util.sep + outDll);
    1.72 +
    1.73 +        context = new String [] {flavourBuild, flavour, build, null};
    1.74 +    }
    1.75 +
    1.76 +    protected void init(Vector includes, Vector defines) {
    1.77 +        initDefaultDefines(defines);
    1.78 +        initDefaultCompilerFlags(includes);
    1.79 +        initDefaultLinkerFlags();
    1.80 +        handleDB();
    1.81 +    }
    1.82 +
    1.83 +
    1.84 +    protected void initDefaultCompilerFlags(Vector includes) {
    1.85 +        Vector compilerFlags = new Vector();
    1.86 +
    1.87 +        compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
    1.88 +                                                          includes,
    1.89 +                                                          get("OutputDir")));
    1.90 +
    1.91 +        put("CompilerFlags", compilerFlags);
    1.92 +    }
    1.93 +
    1.94 +    protected void initDefaultLinkerFlags() {
    1.95 +        Vector linkerFlags = new Vector();
    1.96 +
    1.97 +        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
    1.98 +
    1.99 +        put("LinkerFlags", linkerFlags);
   1.100 +    }
   1.101 +
   1.102 +    DirectoryTree getSourceTree(String sourceBase, String startAt) {
   1.103 +        DirectoryTree tree = new DirectoryTree();
   1.104 +
   1.105 +        tree.addSubdirToIgnore("Codemgr_wsdata");
   1.106 +        tree.addSubdirToIgnore("deleted_files");
   1.107 +        tree.addSubdirToIgnore("SCCS");
   1.108 +        tree.setVerbose(true);
   1.109 +        if (startAt != null) {
   1.110 +            tree.readDirectory(sourceBase + File.separator + startAt);
   1.111 +        } else {
   1.112 +            tree.readDirectory(sourceBase);
   1.113 +        }
   1.114 +
   1.115 +        return tree;
   1.116 +    }
   1.117 +
   1.118 +
   1.119 +    Vector getPreferredPaths(MacroDefinitions macros) {
   1.120 +        Vector preferredPaths = new Vector();
   1.121 +        // In the case of multiple files with the same name in
   1.122 +        // different subdirectories, prefer the versions specified in
   1.123 +        // the platform file as the "os_family" and "arch" macros.
   1.124 +        for (Iterator iter = macros.getMacros(); iter.hasNext(); ) {
   1.125 +            Macro macro = (Macro) iter.next();
   1.126 +            if (macro.name.equals("os_family") ||
   1.127 +                macro.name.equals("arch")) {
   1.128 +                preferredPaths.add(macro.contents);
   1.129 +            }
   1.130 +        }
   1.131 +        // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
   1.132 +        preferredPaths.add("opto");
   1.133 +
   1.134 +        return preferredPaths;
   1.135 +    }
   1.136 +
   1.137 +
   1.138 +    void handleDB() {
   1.139 +        WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
   1.140 +
   1.141 +        File incls = new File(get("OutputDir")+Util.sep+"incls");
   1.142 +
   1.143 +        incls.mkdirs();
   1.144 +
   1.145 +        MacroDefinitions macros = new MacroDefinitions();
   1.146 +        try {
   1.147 +            macros.readFrom(getFieldString(null, "Platform"), false);
   1.148 +        } catch (Exception e) {
   1.149 +            throw new RuntimeException(e);
   1.150 +        }
   1.151 +
   1.152 +        putSpecificField("AllFilesHash", computeAllFiles(platform, macros));
   1.153 +    }
   1.154 +
   1.155 +
   1.156 +    private boolean matchesIgnoredPath(String prefixedName) {
   1.157 +        Vector rv = new Vector();
   1.158 +        collectRelevantVectors(rv, "IgnorePath");
   1.159 +        for (Iterator i = rv.iterator(); i.hasNext(); ) {
   1.160 +            String pathPart = (String) i.next();
   1.161 +            if (prefixedName.contains(Util.normalize(pathPart)))  {
   1.162 +                return true;
   1.163 +            }
   1.164 +        }
   1.165 +        return false;
   1.166 +    }
   1.167 +
   1.168 +    void addAll(Iterator i, Hashtable hash,
   1.169 +                WinGammaPlatform platform, DirectoryTree tree,
   1.170 +                Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) {
   1.171 +        for (; i.hasNext(); ) {
   1.172 +            String fileName = (String) i.next();
   1.173 +            if (lookupHashFieldInContext("IgnoreFile", fileName) == null) {
   1.174 +                String prefixedName = platform.envVarPrefixedFileName(fileName,
   1.175 +                                                                      0, /* ignored */
   1.176 +                                                                      tree,
   1.177 +                                                                      preferredPaths,
   1.178 +                                                                      filesNotFound,
   1.179 +                                                                      filesDuplicate);
   1.180 +                if (prefixedName != null) {
   1.181 +                    prefixedName = Util.normalize(prefixedName);
   1.182 +                    if (!matchesIgnoredPath(prefixedName)) {
   1.183 +                        addTo(hash, prefixedName, fileName);
   1.184 +                    }
   1.185 +                }
   1.186 +            }
   1.187 +        }
   1.188 +    }
   1.189 +
   1.190 +    void addTo(Hashtable ht, String key, String value) {
   1.191 +        ht.put(expandFormat(key), expandFormat(value));
   1.192 +    }
   1.193 +
   1.194 +    Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) {
   1.195 +        Hashtable rv = new Hashtable();
   1.196 +        DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
   1.197 +        Vector preferredPaths = getPreferredPaths(macros);
   1.198 +
   1.199 +        // Hold errors until end
   1.200 +        Vector filesNotFound = new Vector();
   1.201 +        Vector filesDuplicate = new Vector();
   1.202 +
   1.203 +        Vector includedFiles = new Vector();
   1.204 +
   1.205 +        // find all files
   1.206 +        Vector dirs = getSourceIncludes();
   1.207 +        for (Iterator i = dirs.iterator(); i.hasNext(); ) {
   1.208 +            String dir = (String)i.next();
   1.209 +            DirectoryTree subtree = getSourceTree(dir, null);
   1.210 +            for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) {
   1.211 +                String name = ((File)fi.next()).getName();
   1.212 +                includedFiles.add(name);
   1.213 +            }
   1.214 +        }
   1.215 +        addAll(includedFiles.iterator(), rv,
   1.216 +               platform, tree,
   1.217 +               preferredPaths, filesNotFound, filesDuplicate);
   1.218 +
   1.219 +        Vector addFiles = new Vector();
   1.220 +        collectRelevantVectors(addFiles, "AdditionalFile");
   1.221 +        addAll(addFiles.iterator(), rv,
   1.222 +               platform, tree,
   1.223 +               preferredPaths, filesNotFound, filesDuplicate);
   1.224 +
   1.225 +        collectRelevantHashes(rv, "AdditionalGeneratedFile");
   1.226 +
   1.227 +        if ((filesNotFound.size() != 0) ||
   1.228 +            (filesDuplicate.size() != 0)) {
   1.229 +            System.err.println("Error: some files were not found or " +
   1.230 +                               "appeared in multiple subdirectories of " +
   1.231 +                               "directory " + get("SourceBase") + " and could not " +
   1.232 +                               "be resolved with the os_family and arch " +
   1.233 +                               "macros in the platform file.");
   1.234 +            if (filesNotFound.size() != 0) {
   1.235 +                System.err.println("Files not found:");
   1.236 +                for (Iterator iter = filesNotFound.iterator();
   1.237 +                     iter.hasNext(); ) {
   1.238 +                    System.err.println("  " + (String) iter.next());
   1.239 +                }
   1.240 +            }
   1.241 +            if (filesDuplicate.size() != 0) {
   1.242 +                System.err.println("Duplicate files:");
   1.243 +                for (Iterator iter = filesDuplicate.iterator();
   1.244 +                     iter.hasNext(); ) {
   1.245 +                    System.err.println("  " + (String) iter.next());
   1.246 +                }
   1.247 +            }
   1.248 +            throw new RuntimeException();
   1.249 +        }
   1.250 +
   1.251 +        return rv;
   1.252 +    }
   1.253 +
   1.254 +    void initDefaultDefines(Vector defines) {
   1.255 +        Vector sysDefines = new Vector();
   1.256 +        sysDefines.add("WIN32");
   1.257 +        sysDefines.add("_WINDOWS");
   1.258 +        sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
   1.259 +        sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
   1.260 +        sysDefines.add("_JNI_IMPLEMENTATION_");
   1.261 +        sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
   1.262 +
   1.263 +        sysDefines.addAll(defines);
   1.264 +
   1.265 +        put("Define", sysDefines);
   1.266 +    }
   1.267 +
   1.268 +    String get(String key) {
   1.269 +        return (String)vars.get(key);
   1.270 +    }
   1.271 +
   1.272 +    Vector getV(String key) {
   1.273 +        return (Vector)vars.get(key);
   1.274 +    }
   1.275 +
   1.276 +    Object getO(String key) {
   1.277 +        return vars.get(key);
   1.278 +    }
   1.279 +
   1.280 +    Hashtable getH(String key) {
   1.281 +        return (Hashtable)vars.get(key);
   1.282 +    }
   1.283 +
   1.284 +    Object getFieldInContext(String field) {
   1.285 +        for (int i=0; i<context.length; i++) {
   1.286 +            Object rv = getField(context[i], field);
   1.287 +            if (rv != null) {
   1.288 +                return rv;
   1.289 +            }
   1.290 +        }
   1.291 +        return null;
   1.292 +    }
   1.293 +
   1.294 +    Object lookupHashFieldInContext(String field, String key) {
   1.295 +        for (int i=0; i<context.length; i++) {
   1.296 +            Hashtable ht = (Hashtable)getField(context[i], field);
   1.297 +            if (ht != null) {
   1.298 +                Object rv = ht.get(key);
   1.299 +                if (rv != null) {
   1.300 +                    return rv;
   1.301 +                }
   1.302 +            }
   1.303 +        }
   1.304 +        return null;
   1.305 +    }
   1.306 +
   1.307 +    void put(String key, String value) {
   1.308 +        vars.put(key, value);
   1.309 +    }
   1.310 +
   1.311 +    void put(String key, Vector vvalue) {
   1.312 +        vars.put(key, vvalue);
   1.313 +    }
   1.314 +
   1.315 +    void add(String key, Vector vvalue) {
   1.316 +        getV(key).addAll(vvalue);
   1.317 +    }
   1.318 +
   1.319 +    String flavour() {
   1.320 +        return get("Flavour");
   1.321 +    }
   1.322 +
   1.323 +    String build() {
   1.324 +        return get("Build");
   1.325 +    }
   1.326 +
   1.327 +    Object getSpecificField(String field) {
   1.328 +        return getField(get("Id"), field);
   1.329 +    }
   1.330 +
   1.331 +    void putSpecificField(String field, Object value) {
   1.332 +        putField(get("Id"), field, value);
   1.333 +    }
   1.334 +
   1.335 +    void collectRelevantVectors(Vector rv, String field) {
   1.336 +        for (int i = 0; i < context.length; i++) {
   1.337 +            Vector v = getFieldVector(context[i], field);
   1.338 +            if (v != null) {
   1.339 +                for (Iterator j=v.iterator(); j.hasNext(); ) {
   1.340 +                    String val = (String)j.next();
   1.341 +                    rv.add(expandFormat(val));
   1.342 +                }
   1.343 +            }
   1.344 +        }
   1.345 +    }
   1.346 +
   1.347 +    void collectRelevantHashes(Hashtable rv, String field) {
   1.348 +        for (int i = 0; i < context.length; i++) {
   1.349 +            Hashtable v = (Hashtable)getField(context[i], field);
   1.350 +            if (v != null) {
   1.351 +                for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
   1.352 +                    String key = (String)e.nextElement();
   1.353 +                    String val =  (String)v.get(key);
   1.354 +                    addTo(rv, key, val);
   1.355 +                }
   1.356 +            }
   1.357 +        }
   1.358 +    }
   1.359 +
   1.360 +
   1.361 +    Vector getDefines() {
   1.362 +        Vector rv = new Vector();
   1.363 +        collectRelevantVectors(rv, "Define");
   1.364 +        return rv;
   1.365 +    }
   1.366 +
   1.367 +    Vector getIncludes() {
   1.368 +        Vector rv = new Vector();
   1.369 +
   1.370 +        collectRelevantVectors(rv, "AbsoluteInclude");
   1.371 +
   1.372 +        rv.addAll(getSourceIncludes());
   1.373 +
   1.374 +        return rv;
   1.375 +    }
   1.376 +
   1.377 +    private Vector getSourceIncludes() {
   1.378 +        Vector rv = new Vector();
   1.379 +        Vector ri = new Vector();
   1.380 +        String sourceBase = getFieldString(null, "SourceBase");
   1.381 +        collectRelevantVectors(ri, "RelativeInclude");
   1.382 +        for (Iterator i = ri.iterator(); i.hasNext(); ) {
   1.383 +            String f = (String)i.next();
   1.384 +            rv.add(sourceBase + Util.sep + f);
   1.385 +        }
   1.386 +        return rv;
   1.387 +    }
   1.388 +
   1.389 +    static Hashtable cfgData = new Hashtable();
   1.390 +    static Hashtable globalData = new Hashtable();
   1.391 +
   1.392 +    static boolean appliesToTieredBuild(String cfg) {
   1.393 +        return (cfg != null &&
   1.394 +                (cfg.startsWith("compiler1") ||
   1.395 +                 cfg.startsWith("compiler2")));
   1.396 +    }
   1.397 +
   1.398 +    // Filters out the IgnoreFile and IgnorePaths since they are
   1.399 +    // handled specially for tiered builds.
   1.400 +    static boolean appliesToTieredBuild(String cfg, String key) {
   1.401 +        return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore"));
   1.402 +    }
   1.403 +
   1.404 +    static String getTieredBuildCfg(String cfg) {
   1.405 +        assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg;
   1.406 +        return "tiered" + cfg.substring(9);
   1.407 +    }
   1.408 +
   1.409 +    static Object getField(String cfg, String field) {
   1.410 +        if (cfg == null) {
   1.411 +            return globalData.get(field);
   1.412 +        }
   1.413 +
   1.414 +        Hashtable ht =  (Hashtable)cfgData.get(cfg);
   1.415 +        return ht == null ? null : ht.get(field);
   1.416 +    }
   1.417 +
   1.418 +    static String getFieldString(String cfg, String field) {
   1.419 +        return (String)getField(cfg, field);
   1.420 +    }
   1.421 +
   1.422 +    static Vector getFieldVector(String cfg, String field) {
   1.423 +        return (Vector)getField(cfg, field);
   1.424 +    }
   1.425 +
   1.426 +    static void putField(String cfg, String field, Object value) {
   1.427 +        putFieldImpl(cfg, field, value);
   1.428 +        if (appliesToTieredBuild(cfg, field)) {
   1.429 +            putFieldImpl(getTieredBuildCfg(cfg), field, value);
   1.430 +        }
   1.431 +    }
   1.432 +
   1.433 +    private static void putFieldImpl(String cfg, String field, Object value) {
   1.434 +        if (cfg == null) {
   1.435 +            globalData.put(field, value);
   1.436 +            return;
   1.437 +        }
   1.438 +
   1.439 +        Hashtable ht = (Hashtable)cfgData.get(cfg);
   1.440 +        if (ht == null) {
   1.441 +            ht = new Hashtable();
   1.442 +            cfgData.put(cfg, ht);
   1.443 +        }
   1.444 +
   1.445 +        ht.put(field, value);
   1.446 +    }
   1.447 +
   1.448 +    static Object getFieldHash(String cfg, String field, String name) {
   1.449 +        Hashtable ht = (Hashtable)getField(cfg, field);
   1.450 +
   1.451 +        return ht == null ? null : ht.get(name);
   1.452 +    }
   1.453 +
   1.454 +    static void putFieldHash(String cfg, String field, String name, Object val) {
   1.455 +        putFieldHashImpl(cfg, field, name, val);
   1.456 +        if (appliesToTieredBuild(cfg, field)) {
   1.457 +            putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
   1.458 +        }
   1.459 +    }
   1.460 +
   1.461 +    private static void putFieldHashImpl(String cfg, String field, String name, Object val) {
   1.462 +        Hashtable ht = (Hashtable)getField(cfg, field);
   1.463 +
   1.464 +        if (ht == null) {
   1.465 +            ht = new Hashtable();
   1.466 +            putFieldImpl(cfg, field, ht);
   1.467 +        }
   1.468 +
   1.469 +        ht.put(name, val);
   1.470 +    }
   1.471 +
   1.472 +    static void addFieldVector(String cfg, String field, String element) {
   1.473 +        addFieldVectorImpl(cfg, field, element);
   1.474 +        if (appliesToTieredBuild(cfg, field)) {
   1.475 +            addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
   1.476 +        }
   1.477 +    }
   1.478 +
   1.479 +    private static void addFieldVectorImpl(String cfg, String field, String element) {
   1.480 +        Vector v = (Vector)getField(cfg, field);
   1.481 +
   1.482 +        if (v == null) {
   1.483 +            v = new Vector();
   1.484 +            putFieldImpl(cfg, field, v);
   1.485 +        }
   1.486 +
   1.487 +        v.add(element);
   1.488 +    }
   1.489 +
   1.490 +    String expandFormat(String format) {
   1.491 +        if (format == null) {
   1.492 +            return null;
   1.493 +        }
   1.494 +
   1.495 +        if (format.indexOf('%') == -1) {
   1.496 +            return format;
   1.497 +        }
   1.498 +
   1.499 +        StringBuffer sb = new StringBuffer();
   1.500 +        int len = format.length();
   1.501 +        for (int i=0; i<len; i++) {
   1.502 +            char ch = format.charAt(i);
   1.503 +            if (ch == '%') {
   1.504 +                char ch1 = format.charAt(i+1);
   1.505 +                switch (ch1) {
   1.506 +                case '%':
   1.507 +                    sb.append(ch1);
   1.508 +                    break;
   1.509 +                case 'b':
   1.510 +                    sb.append(build());
   1.511 +                    break;
   1.512 +                case 'f':
   1.513 +                    sb.append(flavour());
   1.514 +                    break;
   1.515 +                default:
   1.516 +                    sb.append(ch);
   1.517 +                    sb.append(ch1);
   1.518 +                }
   1.519 +                i++;
   1.520 +            } else {
   1.521 +                sb.append(ch);
   1.522 +            }
   1.523 +        }
   1.524 +
   1.525 +        return sb.toString();
   1.526 +    }
   1.527 +}
   1.528 +
   1.529 +abstract class GenericDebugConfig extends BuildConfig {
   1.530 +    abstract String getOptFlag();
   1.531 +
   1.532 +    protected void init(Vector includes, Vector defines) {
   1.533 +        defines.add("_DEBUG");
   1.534 +        defines.add("ASSERT");
   1.535 +
   1.536 +        super.init(includes, defines);
   1.537 +
   1.538 +        getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag()));
   1.539 +        getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
   1.540 +   }
   1.541 +}
   1.542 +
   1.543 +class C1DebugConfig extends GenericDebugConfig {
   1.544 +    String getOptFlag() {
   1.545 +        return getCI().getNoOptFlag();
   1.546 +    }
   1.547 +
   1.548 +    C1DebugConfig() {
   1.549 +        initNames("compiler1", "debug", "fastdebug\\jre\\bin\\client\\jvm.dll");
   1.550 +        init(getIncludes(), getDefines());
   1.551 +    }
   1.552 +}
   1.553 +
   1.554 +class C1FastDebugConfig extends GenericDebugConfig {
   1.555 +    String getOptFlag() {
   1.556 +        return getCI().getOptFlag();
   1.557 +    }
   1.558 +
   1.559 +    C1FastDebugConfig() {
   1.560 +        initNames("compiler1", "fastdebug", "fastdebug\\jre\\bin\\client\\jvm.dll");
   1.561 +        init(getIncludes(), getDefines());
   1.562 +    }
   1.563 +}
   1.564 +
   1.565 +class C2DebugConfig extends GenericDebugConfig {
   1.566 +    String getOptFlag() {
   1.567 +        return getCI().getNoOptFlag();
   1.568 +    }
   1.569 +
   1.570 +    C2DebugConfig() {
   1.571 +        initNames("compiler2", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
   1.572 +        init(getIncludes(), getDefines());
   1.573 +    }
   1.574 +}
   1.575 +
   1.576 +class C2FastDebugConfig extends GenericDebugConfig {
   1.577 +    String getOptFlag() {
   1.578 +        return getCI().getOptFlag();
   1.579 +    }
   1.580 +
   1.581 +    C2FastDebugConfig() {
   1.582 +        initNames("compiler2", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
   1.583 +        init(getIncludes(), getDefines());
   1.584 +    }
   1.585 +}
   1.586 +
   1.587 +class TieredDebugConfig extends GenericDebugConfig {
   1.588 +    String getOptFlag() {
   1.589 +        return getCI().getNoOptFlag();
   1.590 +    }
   1.591 +
   1.592 +    TieredDebugConfig() {
   1.593 +        initNames("tiered", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
   1.594 +        init(getIncludes(), getDefines());
   1.595 +    }
   1.596 +}
   1.597 +
   1.598 +class TieredFastDebugConfig extends GenericDebugConfig {
   1.599 +    String getOptFlag() {
   1.600 +        return getCI().getOptFlag();
   1.601 +    }
   1.602 +
   1.603 +    TieredFastDebugConfig() {
   1.604 +        initNames("tiered", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
   1.605 +        init(getIncludes(), getDefines());
   1.606 +    }
   1.607 +}
   1.608 +
   1.609 +
   1.610 +abstract class ProductConfig extends BuildConfig {
   1.611 +    protected void init(Vector includes, Vector defines) {
   1.612 +        defines.add("NDEBUG");
   1.613 +        defines.add("PRODUCT");
   1.614 +
   1.615 +        super.init(includes, defines);
   1.616 +
   1.617 +        getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
   1.618 +        getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
   1.619 +    }
   1.620 +}
   1.621 +
   1.622 +class C1ProductConfig extends ProductConfig {
   1.623 +    C1ProductConfig() {
   1.624 +        initNames("compiler1", "product", "jre\\bin\\client\\jvm.dll");
   1.625 +        init(getIncludes(), getDefines());
   1.626 +    }
   1.627 +}
   1.628 +
   1.629 +class C2ProductConfig extends ProductConfig {
   1.630 +    C2ProductConfig() {
   1.631 +        initNames("compiler2", "product", "jre\\bin\\server\\jvm.dll");
   1.632 +        init(getIncludes(), getDefines());
   1.633 +    }
   1.634 +}
   1.635 +
   1.636 +class TieredProductConfig extends ProductConfig {
   1.637 +    TieredProductConfig() {
   1.638 +        initNames("tiered", "product", "jre\\bin\\server\\jvm.dll");
   1.639 +        init(getIncludes(), getDefines());
   1.640 +    }
   1.641 +}
   1.642 +
   1.643 +
   1.644 +class CoreDebugConfig extends GenericDebugConfig {
   1.645 +    String getOptFlag() {
   1.646 +        return getCI().getNoOptFlag();
   1.647 +    }
   1.648 +
   1.649 +    CoreDebugConfig() {
   1.650 +        initNames("core", "debug", "fastdebug\\jre\\bin\\core\\jvm.dll");
   1.651 +        init(getIncludes(), getDefines());
   1.652 +    }
   1.653 +}
   1.654 +
   1.655 +
   1.656 +class CoreFastDebugConfig extends GenericDebugConfig {
   1.657 +    String getOptFlag() {
   1.658 +        return getCI().getOptFlag();
   1.659 +    }
   1.660 +
   1.661 +    CoreFastDebugConfig() {
   1.662 +        initNames("core", "fastdebug", "fastdebug\\jre\\bin\\core\\jvm.dll");
   1.663 +        init(getIncludes(), getDefines());
   1.664 +    }
   1.665 +}
   1.666 +
   1.667 +
   1.668 +class CoreProductConfig extends ProductConfig {
   1.669 +    CoreProductConfig() {
   1.670 +        initNames("core", "product", "jre\\bin\\core\\jvm.dll");
   1.671 +        init(getIncludes(), getDefines());
   1.672 +    }
   1.673 +}
   1.674 +
   1.675 +class KernelDebugConfig extends GenericDebugConfig {
   1.676 +    String getOptFlag() {
   1.677 +        return getCI().getNoOptFlag();
   1.678 +    }
   1.679 +
   1.680 +    KernelDebugConfig() {
   1.681 +        initNames("kernel", "debug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
   1.682 +        init(getIncludes(), getDefines());
   1.683 +    }
   1.684 +}
   1.685 +
   1.686 +
   1.687 +class KernelFastDebugConfig extends GenericDebugConfig {
   1.688 +    String getOptFlag() {
   1.689 +        return getCI().getOptFlag();
   1.690 +    }
   1.691 +
   1.692 +    KernelFastDebugConfig() {
   1.693 +        initNames("kernel", "fastdebug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
   1.694 +        init(getIncludes(), getDefines());
   1.695 +    }
   1.696 +}
   1.697 +
   1.698 +
   1.699 +class KernelProductConfig extends ProductConfig {
   1.700 +    KernelProductConfig() {
   1.701 +        initNames("kernel", "product", "jre\\bin\\kernel\\jvm.dll");
   1.702 +        init(getIncludes(), getDefines());
   1.703 +    }
   1.704 +}
   1.705 +abstract class CompilerInterface {
   1.706 +    abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
   1.707 +    abstract Vector getBaseLinkerFlags(String outDir, String outDll);
   1.708 +    abstract Vector getDebugCompilerFlags(String opt);
   1.709 +    abstract Vector getDebugLinkerFlags();
   1.710 +    abstract Vector getProductCompilerFlags();
   1.711 +    abstract Vector getProductLinkerFlags();
   1.712 +    abstract String getOptFlag();
   1.713 +    abstract String getNoOptFlag();
   1.714 +    abstract String makeCfgName(String flavourBuild);
   1.715 +
   1.716 +    void addAttr(Vector receiver, String attr, String value) {
   1.717 +        receiver.add(attr); receiver.add(value);
   1.718 +    }
   1.719 +}

mercurial