src/share/tools/ProjectCreator/BuildConfig.java

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/tools/ProjectCreator/BuildConfig.java	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,644 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005, 2013, 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.Enumeration;
    1.29 +import java.util.Hashtable;
    1.30 +import java.util.Vector;
    1.31 +
    1.32 +class BuildConfig {
    1.33 +    @SuppressWarnings("rawtypes")
    1.34 +    Hashtable vars;
    1.35 +    Vector<String> basicNames, basicPaths;
    1.36 +    String[] context;
    1.37 +
    1.38 +    static CompilerInterface ci;
    1.39 +    static CompilerInterface getCI() {
    1.40 +        if (ci == null) {
    1.41 +            String comp = (String)getField(null, "CompilerVersion");
    1.42 +            try {
    1.43 +                ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
    1.44 +            } catch (Exception cnfe) {
    1.45 +                System.err.println("Cannot find support for compiler " + comp);
    1.46 +                throw new RuntimeException(cnfe.toString());
    1.47 +            }
    1.48 +        }
    1.49 +        return ci;
    1.50 +    }
    1.51 +
    1.52 +    @SuppressWarnings("rawtypes")
    1.53 +    protected void initNames(String flavour, String build, String outDll) {
    1.54 +        if (vars == null) vars = new Hashtable();
    1.55 +
    1.56 +        String flavourBuild =  flavour + "_" + build;
    1.57 +        String platformName = getFieldString(null, "PlatformName");
    1.58 +        System.out.println();
    1.59 +        System.out.println(flavourBuild);
    1.60 +
    1.61 +        put("Name", getCI().makeCfgName(flavourBuild, platformName));
    1.62 +        put("Flavour", flavour);
    1.63 +        put("Build", build);
    1.64 +        put("PlatformName", platformName);
    1.65 +
    1.66 +        // ones mentioned above were needed to expand format
    1.67 +        String buildBase = expandFormat(getFieldString(null, "BuildBase"));
    1.68 +        String sourceBase = getFieldString(null, "SourceBase");
    1.69 +        String buildSpace = getFieldString(null, "BuildSpace");
    1.70 +        String outDir = buildBase;
    1.71 +        String jdkTargetRoot = getFieldString(null, "JdkTargetRoot");
    1.72 +
    1.73 +        put("Id", flavourBuild);
    1.74 +        put("OutputDir", outDir);
    1.75 +        put("SourceBase", sourceBase);
    1.76 +        put("BuildBase", buildBase);
    1.77 +        put("BuildSpace", buildSpace);
    1.78 +        put("OutputDll", outDir + Util.sep + outDll);
    1.79 +        put("JdkTargetRoot", jdkTargetRoot);
    1.80 +
    1.81 +        context = new String [] {flavourBuild, flavour, build, null};
    1.82 +    }
    1.83 +
    1.84 +    protected void init(Vector<String> includes, Vector<String> defines) {
    1.85 +        initDefaultDefines(defines);
    1.86 +        initDefaultCompilerFlags(includes);
    1.87 +        initDefaultLinkerFlags();
    1.88 +        //handleDB();
    1.89 +    }
    1.90 +
    1.91 +
    1.92 +    protected void initDefaultCompilerFlags(Vector<String> includes) {
    1.93 +        Vector compilerFlags = new Vector();
    1.94 +
    1.95 +        compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
    1.96 +                                                          includes,
    1.97 +                                                          get("OutputDir")));
    1.98 +
    1.99 +        put("CompilerFlags", compilerFlags);
   1.100 +    }
   1.101 +
   1.102 +    protected void initDefaultLinkerFlags() {
   1.103 +        Vector linkerFlags = new Vector();
   1.104 +
   1.105 +        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));
   1.106 +
   1.107 +        put("LinkerFlags", linkerFlags);
   1.108 +    }
   1.109 +
   1.110 +    public boolean matchesIgnoredPath(String path) {
   1.111 +        Vector<String> rv = new Vector<String>();
   1.112 +        collectRelevantVectors(rv, "IgnorePath");
   1.113 +        for (String pathPart : rv) {
   1.114 +            if (path.contains(pathPart))  {
   1.115 +                return true;
   1.116 +            }
   1.117 +        }
   1.118 +        return false;
   1.119 +    }
   1.120 +
   1.121 +    public boolean matchesHidePath(String path) {
   1.122 +        Vector<String> rv = new Vector<String>();
   1.123 +        collectRelevantVectors(rv, "HidePath");
   1.124 +        for (String pathPart : rv) {
   1.125 +            if (path.contains(Util.normalize(pathPart)))  {
   1.126 +                return true;
   1.127 +            }
   1.128 +        }
   1.129 +        return false;
   1.130 +    }
   1.131 +
   1.132 +   public Vector<String> matchesAdditionalGeneratedPath(String fullPath) {
   1.133 +        Vector<String> rv = new Vector<String>();
   1.134 +        Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile");
   1.135 +        if (v != null) {
   1.136 +            for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) {
   1.137 +                String key = e.nextElement();
   1.138 +                String val = v.get(key);
   1.139 +
   1.140 +                if (fullPath.endsWith(expandFormat(key))) {
   1.141 +                    rv.add(expandFormat(val));
   1.142 +                }
   1.143 +            }
   1.144 +        }
   1.145 +        return rv;
   1.146 +    }
   1.147 +
   1.148 +    // Returns true if the specified path refers to a relative alternate
   1.149 +    // source file. RelativeAltSrcInclude is usually "src\closed".
   1.150 +    public static boolean matchesRelativeAltSrcInclude(String path) {
   1.151 +        String relativeAltSrcInclude =
   1.152 +            getFieldString(null, "RelativeAltSrcInclude");
   1.153 +        Vector<String> v = getFieldVector(null, "AltRelativeInclude");
   1.154 +        for (String pathPart : v) {
   1.155 +            if (path.contains(relativeAltSrcInclude + Util.sep + pathPart))  {
   1.156 +                return true;
   1.157 +            }
   1.158 +        }
   1.159 +        return false;
   1.160 +    }
   1.161 +
   1.162 +    // Returns the relative alternate source file for the specified path.
   1.163 +    // Null is returned if the specified path does not have a matching
   1.164 +    // alternate source file.
   1.165 +    public static String getMatchingRelativeAltSrcFile(String path) {
   1.166 +        Vector<String> v = getFieldVector(null, "RelativeAltSrcFileList");
   1.167 +        if (v == null) {
   1.168 +            return null;
   1.169 +        }
   1.170 +        for (String pathPart : v) {
   1.171 +            if (path.endsWith(pathPart)) {
   1.172 +                String relativeAltSrcInclude =
   1.173 +                    getFieldString(null, "RelativeAltSrcInclude");
   1.174 +                return relativeAltSrcInclude + Util.sep + pathPart;
   1.175 +            }
   1.176 +        }
   1.177 +        return null;
   1.178 +    }
   1.179 +
   1.180 +    // Returns true if the specified path has a matching alternate
   1.181 +    // source file.
   1.182 +    public static boolean matchesRelativeAltSrcFile(String path) {
   1.183 +        return getMatchingRelativeAltSrcFile(path) != null;
   1.184 +    }
   1.185 +
   1.186 +    // Track the specified alternate source file. The source file is
   1.187 +    // tracked without the leading .*<sep><RelativeAltSrcFileList><sep>
   1.188 +    // part to make matching regular source files easier.
   1.189 +    public static void trackRelativeAltSrcFile(String path) {
   1.190 +        String pattern = getFieldString(null, "RelativeAltSrcInclude") +
   1.191 +            Util.sep;
   1.192 +        int altSrcInd = path.indexOf(pattern);
   1.193 +        if (altSrcInd == -1) {
   1.194 +            // not an AltSrc path
   1.195 +            return;
   1.196 +        }
   1.197 +
   1.198 +        altSrcInd += pattern.length();
   1.199 +        if (altSrcInd >= path.length()) {
   1.200 +            // not a valid AltSrc path
   1.201 +            return;
   1.202 +        }
   1.203 +
   1.204 +        String altSrcFile = path.substring(altSrcInd);
   1.205 +        Vector v = getFieldVector(null, "RelativeAltSrcFileList");
   1.206 +        if (v == null || !v.contains(altSrcFile)) {
   1.207 +            addFieldVector(null, "RelativeAltSrcFileList", altSrcFile);
   1.208 +        }
   1.209 +    }
   1.210 +
   1.211 +    void addTo(Hashtable ht, String key, String value) {
   1.212 +        ht.put(expandFormat(key), expandFormat(value));
   1.213 +    }
   1.214 +
   1.215 +    void initDefaultDefines(Vector defines) {
   1.216 +        Vector sysDefines = new Vector();
   1.217 +        sysDefines.add("WIN32");
   1.218 +        sysDefines.add("_WINDOWS");
   1.219 +        sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
   1.220 +        sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
   1.221 +        sysDefines.add("INCLUDE_TRACE=1");
   1.222 +        sysDefines.add("_JNI_IMPLEMENTATION_");
   1.223 +        if (vars.get("PlatformName").equals("Win32")) {
   1.224 +            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
   1.225 +        } else {
   1.226 +            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
   1.227 +        }
   1.228 +
   1.229 +        sysDefines.addAll(defines);
   1.230 +
   1.231 +        put("Define", sysDefines);
   1.232 +    }
   1.233 +
   1.234 +    String get(String key) {
   1.235 +        return (String)vars.get(key);
   1.236 +    }
   1.237 +
   1.238 +    Vector getV(String key) {
   1.239 +        return (Vector)vars.get(key);
   1.240 +    }
   1.241 +
   1.242 +    Object getO(String key) {
   1.243 +        return vars.get(key);
   1.244 +    }
   1.245 +
   1.246 +    Hashtable getH(String key) {
   1.247 +        return (Hashtable)vars.get(key);
   1.248 +    }
   1.249 +
   1.250 +    Object getFieldInContext(String field) {
   1.251 +        for (int i=0; i<context.length; i++) {
   1.252 +            Object rv = getField(context[i], field);
   1.253 +            if (rv != null) {
   1.254 +                return rv;
   1.255 +            }
   1.256 +        }
   1.257 +        return null;
   1.258 +    }
   1.259 +
   1.260 +    Object lookupHashFieldInContext(String field, String key) {
   1.261 +        for (int i=0; i<context.length; i++) {
   1.262 +            Hashtable ht = (Hashtable)getField(context[i], field);
   1.263 +            if (ht != null) {
   1.264 +                Object rv = ht.get(key);
   1.265 +                if (rv != null) {
   1.266 +                    return rv;
   1.267 +                }
   1.268 +            }
   1.269 +        }
   1.270 +        return null;
   1.271 +    }
   1.272 +
   1.273 +    void put(String key, String value) {
   1.274 +        vars.put(key, value);
   1.275 +    }
   1.276 +
   1.277 +    void put(String key, Vector vvalue) {
   1.278 +        vars.put(key, vvalue);
   1.279 +    }
   1.280 +
   1.281 +    void add(String key, Vector vvalue) {
   1.282 +        getV(key).addAll(vvalue);
   1.283 +    }
   1.284 +
   1.285 +    String flavour() {
   1.286 +        return get("Flavour");
   1.287 +    }
   1.288 +
   1.289 +    String build() {
   1.290 +        return get("Build");
   1.291 +    }
   1.292 +
   1.293 +    Object getSpecificField(String field) {
   1.294 +        return getField(get("Id"), field);
   1.295 +    }
   1.296 +
   1.297 +    void putSpecificField(String field, Object value) {
   1.298 +        putField(get("Id"), field, value);
   1.299 +    }
   1.300 +
   1.301 +    void collectRelevantVectors(Vector rv, String field) {
   1.302 +        for (String ctx : context) {
   1.303 +            Vector<String> v = getFieldVector(ctx, field);
   1.304 +            if (v != null) {
   1.305 +                for (String val : v) {
   1.306 +                    rv.add(expandFormat(val).replace('/', '\\'));
   1.307 +                }
   1.308 +            }
   1.309 +        }
   1.310 +    }
   1.311 +
   1.312 +    void collectRelevantHashes(Hashtable rv, String field) {
   1.313 +        for (String ctx : context) {
   1.314 +            Hashtable v = (Hashtable)getField(ctx, field);
   1.315 +            if (v != null) {
   1.316 +                for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
   1.317 +                    String key = (String)e.nextElement();
   1.318 +                    String val =  (String)v.get(key);
   1.319 +                    addTo(rv, key, val);
   1.320 +                }
   1.321 +            }
   1.322 +        }
   1.323 +    }
   1.324 +
   1.325 +
   1.326 +    Vector getDefines() {
   1.327 +        Vector rv = new Vector();
   1.328 +        collectRelevantVectors(rv, "Define");
   1.329 +        return rv;
   1.330 +    }
   1.331 +
   1.332 +    Vector getIncludes() {
   1.333 +        Vector rv = new Vector();
   1.334 +        collectRelevantVectors(rv, "AbsoluteInclude");
   1.335 +        rv.addAll(getSourceIncludes());
   1.336 +        return rv;
   1.337 +    }
   1.338 +
   1.339 +    private Vector getSourceIncludes() {
   1.340 +        Vector<String> rv = new Vector<String>();
   1.341 +        String sourceBase = getFieldString(null, "SourceBase");
   1.342 +
   1.343 +        // add relative alternate source include values:
   1.344 +        String relativeAltSrcInclude =
   1.345 +            getFieldString(null, "RelativeAltSrcInclude");
   1.346 +        Vector<String> asri = new Vector<String>();
   1.347 +        collectRelevantVectors(asri, "AltRelativeInclude");
   1.348 +        for (String f : asri) {
   1.349 +            rv.add(sourceBase + Util.sep + relativeAltSrcInclude +
   1.350 +                   Util.sep + f);
   1.351 +        }
   1.352 +
   1.353 +        Vector<String> ri = new Vector<String>();
   1.354 +        collectRelevantVectors(ri, "RelativeInclude");
   1.355 +        for (String f : ri) {
   1.356 +            rv.add(sourceBase + Util.sep + f);
   1.357 +        }
   1.358 +        return rv;
   1.359 +    }
   1.360 +
   1.361 +    static Hashtable cfgData = new Hashtable();
   1.362 +    static Hashtable globalData = new Hashtable();
   1.363 +
   1.364 +    static boolean appliesToTieredBuild(String cfg) {
   1.365 +        return (cfg != null &&
   1.366 +                (cfg.startsWith("compiler1") ||
   1.367 +                 cfg.startsWith("compiler2")));
   1.368 +    }
   1.369 +
   1.370 +    // Filters out the IgnoreFile and IgnorePaths since they are
   1.371 +    // handled specially for tiered builds.
   1.372 +    static boolean appliesToTieredBuild(String cfg, String key) {
   1.373 +        return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore"));
   1.374 +    }
   1.375 +
   1.376 +    static String getTieredBuildCfg(String cfg) {
   1.377 +        assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg;
   1.378 +        return "tiered" + cfg.substring(9);
   1.379 +    }
   1.380 +
   1.381 +    static Object getField(String cfg, String field) {
   1.382 +        if (cfg == null) {
   1.383 +            return globalData.get(field);
   1.384 +        }
   1.385 +
   1.386 +        Hashtable ht =  (Hashtable)cfgData.get(cfg);
   1.387 +        return ht == null ? null : ht.get(field);
   1.388 +    }
   1.389 +
   1.390 +    static String getFieldString(String cfg, String field) {
   1.391 +        return (String)getField(cfg, field);
   1.392 +    }
   1.393 +
   1.394 +    static Vector getFieldVector(String cfg, String field) {
   1.395 +        return (Vector)getField(cfg, field);
   1.396 +    }
   1.397 +
   1.398 +    static void putField(String cfg, String field, Object value) {
   1.399 +        putFieldImpl(cfg, field, value);
   1.400 +        if (appliesToTieredBuild(cfg, field)) {
   1.401 +            putFieldImpl(getTieredBuildCfg(cfg), field, value);
   1.402 +        }
   1.403 +    }
   1.404 +
   1.405 +    private static void putFieldImpl(String cfg, String field, Object value) {
   1.406 +        if (cfg == null) {
   1.407 +            globalData.put(field, value);
   1.408 +            return;
   1.409 +        }
   1.410 +
   1.411 +        Hashtable ht = (Hashtable)cfgData.get(cfg);
   1.412 +        if (ht == null) {
   1.413 +            ht = new Hashtable();
   1.414 +            cfgData.put(cfg, ht);
   1.415 +        }
   1.416 +
   1.417 +        ht.put(field, value);
   1.418 +    }
   1.419 +
   1.420 +    static Object getFieldHash(String cfg, String field, String name) {
   1.421 +        Hashtable ht = (Hashtable)getField(cfg, field);
   1.422 +
   1.423 +        return ht == null ? null : ht.get(name);
   1.424 +    }
   1.425 +
   1.426 +    static void putFieldHash(String cfg, String field, String name, Object val) {
   1.427 +        putFieldHashImpl(cfg, field, name, val);
   1.428 +        if (appliesToTieredBuild(cfg, field)) {
   1.429 +            putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
   1.430 +        }
   1.431 +    }
   1.432 +
   1.433 +    private static void putFieldHashImpl(String cfg, String field, String name, Object val) {
   1.434 +        Hashtable ht = (Hashtable)getField(cfg, field);
   1.435 +
   1.436 +        if (ht == null) {
   1.437 +            ht = new Hashtable();
   1.438 +            putFieldImpl(cfg, field, ht);
   1.439 +        }
   1.440 +
   1.441 +        ht.put(name, val);
   1.442 +    }
   1.443 +
   1.444 +    static void addFieldVector(String cfg, String field, String element) {
   1.445 +        addFieldVectorImpl(cfg, field, element);
   1.446 +        if (appliesToTieredBuild(cfg, field)) {
   1.447 +            addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
   1.448 +        }
   1.449 +    }
   1.450 +
   1.451 +    private static void addFieldVectorImpl(String cfg, String field, String element) {
   1.452 +        Vector v = (Vector)getField(cfg, field);
   1.453 +
   1.454 +        if (v == null) {
   1.455 +            v = new Vector();
   1.456 +            putFieldImpl(cfg, field, v);
   1.457 +        }
   1.458 +
   1.459 +        v.add(element);
   1.460 +    }
   1.461 +
   1.462 +    String expandFormat(String format) {
   1.463 +        if (format == null) {
   1.464 +            return null;
   1.465 +        }
   1.466 +
   1.467 +        if (format.indexOf('%') == -1) {
   1.468 +            return format;
   1.469 +        }
   1.470 +
   1.471 +        StringBuffer sb = new StringBuffer();
   1.472 +        int len = format.length();
   1.473 +        for (int i=0; i<len; i++) {
   1.474 +            char ch = format.charAt(i);
   1.475 +            if (ch == '%') {
   1.476 +                char ch1 = format.charAt(i+1);
   1.477 +                switch (ch1) {
   1.478 +                case '%':
   1.479 +                    sb.append(ch1);
   1.480 +                    break;
   1.481 +                case 'b':
   1.482 +                    sb.append(build());
   1.483 +                    break;
   1.484 +                case 'f':
   1.485 +                    sb.append(flavour());
   1.486 +                    break;
   1.487 +                default:
   1.488 +                    sb.append(ch);
   1.489 +                    sb.append(ch1);
   1.490 +                }
   1.491 +                i++;
   1.492 +            } else {
   1.493 +                sb.append(ch);
   1.494 +            }
   1.495 +        }
   1.496 +
   1.497 +        return sb.toString();
   1.498 +    }
   1.499 +}
   1.500 +
   1.501 +abstract class GenericDebugConfig extends BuildConfig {
   1.502 +    abstract String getOptFlag();
   1.503 +
   1.504 +    protected void init(Vector includes, Vector defines) {
   1.505 +        defines.add("_DEBUG");
   1.506 +        defines.add("ASSERT");
   1.507 +
   1.508 +        super.init(includes, defines);
   1.509 +
   1.510 +        getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag()));
   1.511 +        getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
   1.512 +   }
   1.513 +}
   1.514 +
   1.515 +abstract class GenericDebugNonKernelConfig extends GenericDebugConfig {
   1.516 +    protected void init(Vector includes, Vector defines) {
   1.517 +        super.init(includes, defines);
   1.518 +        getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags"));
   1.519 +   }
   1.520 +}
   1.521 +
   1.522 +class C1DebugConfig extends GenericDebugNonKernelConfig {
   1.523 +    String getOptFlag() {
   1.524 +        return getCI().getNoOptFlag();
   1.525 +    }
   1.526 +
   1.527 +    C1DebugConfig() {
   1.528 +        initNames("compiler1", "debug", "jvm.dll");
   1.529 +        init(getIncludes(), getDefines());
   1.530 +    }
   1.531 +}
   1.532 +
   1.533 +class C1FastDebugConfig extends GenericDebugNonKernelConfig {
   1.534 +    String getOptFlag() {
   1.535 +        return getCI().getOptFlag();
   1.536 +    }
   1.537 +
   1.538 +    C1FastDebugConfig() {
   1.539 +        initNames("compiler1", "fastdebug", "jvm.dll");
   1.540 +        init(getIncludes(), getDefines());
   1.541 +    }
   1.542 +}
   1.543 +
   1.544 +class C2DebugConfig extends GenericDebugNonKernelConfig {
   1.545 +    String getOptFlag() {
   1.546 +        return getCI().getNoOptFlag();
   1.547 +    }
   1.548 +
   1.549 +    C2DebugConfig() {
   1.550 +        initNames("compiler2", "debug", "jvm.dll");
   1.551 +        init(getIncludes(), getDefines());
   1.552 +    }
   1.553 +}
   1.554 +
   1.555 +class C2FastDebugConfig extends GenericDebugNonKernelConfig {
   1.556 +    String getOptFlag() {
   1.557 +        return getCI().getOptFlag();
   1.558 +    }
   1.559 +
   1.560 +    C2FastDebugConfig() {
   1.561 +        initNames("compiler2", "fastdebug", "jvm.dll");
   1.562 +        init(getIncludes(), getDefines());
   1.563 +    }
   1.564 +}
   1.565 +
   1.566 +class TieredDebugConfig extends GenericDebugNonKernelConfig {
   1.567 +    String getOptFlag() {
   1.568 +        return getCI().getNoOptFlag();
   1.569 +    }
   1.570 +
   1.571 +    TieredDebugConfig() {
   1.572 +        initNames("tiered", "debug", "jvm.dll");
   1.573 +        init(getIncludes(), getDefines());
   1.574 +    }
   1.575 +}
   1.576 +
   1.577 +class TieredFastDebugConfig extends GenericDebugNonKernelConfig {
   1.578 +    String getOptFlag() {
   1.579 +        return getCI().getOptFlag();
   1.580 +    }
   1.581 +
   1.582 +    TieredFastDebugConfig() {
   1.583 +        initNames("tiered", "fastdebug", "jvm.dll");
   1.584 +        init(getIncludes(), getDefines());
   1.585 +    }
   1.586 +}
   1.587 +
   1.588 +abstract class ProductConfig extends BuildConfig {
   1.589 +    protected void init(Vector includes, Vector defines) {
   1.590 +        defines.add("NDEBUG");
   1.591 +        defines.add("PRODUCT");
   1.592 +
   1.593 +        super.init(includes, defines);
   1.594 +
   1.595 +        getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
   1.596 +        getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
   1.597 +    }
   1.598 +}
   1.599 +
   1.600 +class C1ProductConfig extends ProductConfig {
   1.601 +    C1ProductConfig() {
   1.602 +        initNames("compiler1", "product", "jvm.dll");
   1.603 +        init(getIncludes(), getDefines());
   1.604 +    }
   1.605 +}
   1.606 +
   1.607 +class C2ProductConfig extends ProductConfig {
   1.608 +    C2ProductConfig() {
   1.609 +        initNames("compiler2", "product", "jvm.dll");
   1.610 +        init(getIncludes(), getDefines());
   1.611 +    }
   1.612 +}
   1.613 +
   1.614 +class TieredProductConfig extends ProductConfig {
   1.615 +    TieredProductConfig() {
   1.616 +        initNames("tiered", "product", "jvm.dll");
   1.617 +        init(getIncludes(), getDefines());
   1.618 +    }
   1.619 +}
   1.620 +
   1.621 +
   1.622 +abstract class CompilerInterface {
   1.623 +    abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
   1.624 +    abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
   1.625 +    abstract Vector getDebugCompilerFlags(String opt);
   1.626 +    abstract Vector getDebugLinkerFlags();
   1.627 +    abstract void   getAdditionalNonKernelLinkerFlags(Vector rv);
   1.628 +    abstract Vector getProductCompilerFlags();
   1.629 +    abstract Vector getProductLinkerFlags();
   1.630 +    abstract String getOptFlag();
   1.631 +    abstract String getNoOptFlag();
   1.632 +    abstract String makeCfgName(String flavourBuild, String platformName);
   1.633 +
   1.634 +    void addAttr(Vector receiver, String attr, String value) {
   1.635 +        receiver.add(attr); receiver.add(value);
   1.636 +    }
   1.637 +    void extAttr(Vector receiver, String attr, String value) {
   1.638 +        int attr_pos=receiver.indexOf(attr) ;
   1.639 +        if ( attr_pos == -1) {
   1.640 +          // If attr IS NOT present in the Vector - add it
   1.641 +          receiver.add(attr); receiver.add(value);
   1.642 +        } else {
   1.643 +          // If attr IS present in the Vector - append value to it
   1.644 +          receiver.set(attr_pos+1,receiver.get(attr_pos+1)+value);
   1.645 +        }
   1.646 +    }
   1.647 +}

mercurial