hotspot/src/share/tools/MakeDeps/WinGammaPlatform.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 5547 f4b087cbb361
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
import java.io.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
abstract class HsArgHandler extends ArgHandler {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
    static final int STRING = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
    static final int VECTOR = 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
    static final int HASH   = 3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
    boolean nextNotKey(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
        if (it.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
            String s = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
            return (s.length() == 0) || (s.charAt(0) != '-');
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    void empty(String key, String message) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
        if (key != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
            System.err.println("** Error: empty " + key);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
        if (message != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
            System.err.println(message);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        WinGammaPlatform.usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    static String getCfg(String val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        int under = val.indexOf('_');
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        int len = val.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        if (under != -1 && under < len - 1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
            return val.substring(under+1, len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
            return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
class ArgRuleSpecific extends ArgRule {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    ArgRuleSpecific(String arg, ArgHandler handler) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        super(arg, handler);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    boolean match(String rulePattern, String arg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        return rulePattern.startsWith(arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
class SpecificHsArgHandler extends HsArgHandler {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    String message, argKey, valKey;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    int type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
        String cfg = getCfg(it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
            String val = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
            switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
            case VECTOR:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                BuildConfig.addFieldVector(cfg, valKey, val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
                break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
            case HASH:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
                BuildConfig.putFieldHash(cfg, valKey, val, "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
                break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
            case STRING:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
                BuildConfig.putField(cfg, valKey, val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
                break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
            default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                empty(valKey, "Unknown type: "+type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
            it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
            empty(argKey, message);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    SpecificHsArgHandler(String argKey, String valKey, String message, int type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
        this.argKey = argKey;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
        this.valKey = valKey;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
        this.message = message;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
        this.type = type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
class HsArgRule extends ArgRuleSpecific {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    HsArgRule(String argKey, String valKey, String message, int type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        super(argKey, new SpecificHsArgHandler(argKey, valKey, message, type));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
public abstract class WinGammaPlatform extends Platform {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    public void setupFileTemplates() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        inclFileTemplate = new FileName(this,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
            "incls\\", "_", "",                      ".incl", "", ""
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
        giFileTemplate = new FileName(this,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
            "incls\\", "",  "_precompiled", ".incl", "", ""
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
        gdFileTemplate = new FileName(this,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
            "", "",  "Dependencies",         "",      "", ""
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
        );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    private static String[] suffixes = { ".cpp", ".c" };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    public String[] outerSuffixes() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        return suffixes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    public String objFileSuffix() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
        return ".obj";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    public String asmFileSuffix() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
        return ".i";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    public String dependentPrefix() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
        return "$(VM_PATH)";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    public boolean includeGIInEachIncl() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    public boolean fileNameStringEquality(String s1, String s2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
        return s1.equalsIgnoreCase(s2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    static void usage() throws IllegalArgumentException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        System.err.println("WinGammaPlatform platform-specific options:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        System.err.println("  -sourceBase <path to directory (workspace) " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
                           "containing source files; no trailing slash>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
        System.err.println("  -projectFileName <full pathname to which project file " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
                           "will be written; all parent directories must " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
                           "already exist>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
        System.err.println("  If any of the above are specified, "+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
                           "they must all be.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        System.err.println("  Additional, optional arguments, which can be " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
                           "specified multiple times:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        System.err.println("    -absoluteInclude <string containing absolute " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
                           "path to include directory>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
        System.err.println("    -relativeInclude <string containing include " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
                           "directory relative to -sourceBase>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
        System.err.println("    -define <preprocessor flag to be #defined " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
                           "(note: doesn't yet support " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
                           "#define (flag) (value))>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
        System.err.println("    -startAt <subdir of sourceBase>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
        System.err.println("    -additionalFile <file not in database but " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
                           "which should show up in project file, like " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
                           "includeDB_core>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
        System.err.println("    -additionalGeneratedFile <absolute path to " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
                           "directory containing file; no trailing slash> " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
                           "<name of file generated later in the build process>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
        throw new IllegalArgumentException();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    public void addPerFileLine(Hashtable table,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
                               String fileName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
                               String line) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        Vector v = (Vector) table.get(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
        if (v != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
            v.add(line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
            v = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
            v.add(line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
            table.put(fileName, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    protected static class PerFileCondData {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        public String releaseString;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
        public String debugString;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    protected void addConditionalPerFileLine(Hashtable table,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
                                           String fileName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
                                           String releaseLine,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
                                           String debugLine) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        PerFileCondData data = new PerFileCondData();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        data.releaseString = releaseLine;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        data.debugString = debugLine;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        Vector v = (Vector) table.get(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        if (v != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
            v.add(data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
            v = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
            v.add(data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
            table.put(fileName, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    protected static class PrelinkCommandData {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
      String description;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
      String commands;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    protected void addPrelinkCommand(Hashtable table,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
                                     String build,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
                                     String description,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
                                     String commands) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
      PrelinkCommandData data = new PrelinkCommandData();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
      data.description = description;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
      data.commands = commands;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      table.put(build, data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    public boolean findString(Vector v, String s) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        for (Iterator iter = v.iterator(); iter.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
            if (((String) iter.next()).equals(s)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
                return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    /* This returns a String containing the full path to the passed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
       file name, or null if an error occurred. If the file was not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
       found or was a duplicate and couldn't be resolved using the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
       preferred paths, the file name is added to the appropriate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
       Vector of Strings. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    private String findFileInDirectory(String fileName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
                                       DirectoryTree directory,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
                                       Vector preferredPaths,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
                                       Vector filesNotFound,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
                                       Vector filesDuplicate) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
        List locationsInTree = directory.findFile(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
        int  rootNameLength = directory.getRootNodeName().length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
        String name = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
        if ((locationsInTree == null) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
            (locationsInTree.size() == 0)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
            filesNotFound.add(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
        } else if (locationsInTree.size() > 1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
            // We shouldn't have duplicate file names in our workspace.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
            System.err.println();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
            System.err.println("There are multiple files named as: " + fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
            System.exit(-1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
            // The following code could be safely removed if we don't need duplicate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
            // file names.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
            // Iterate through them, trying to find one with a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
            // preferred path
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
        search:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
            {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
                for (Iterator locIter = locationsInTree.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
                     locIter.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
                    DirectoryTreeNode node =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
                        (DirectoryTreeNode) locIter.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
                    String tmpName = node.getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
                    for (Iterator prefIter = preferredPaths.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
                         prefIter.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
                        // We need to make sure the preferred path is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
                        // found from the file path not including the root node name.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
                        if (tmpName.indexOf((String)prefIter.next(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
                                            rootNameLength) != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
                            name = tmpName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
                            break search;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
            if (name == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
                filesDuplicate.add(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
            name = ((DirectoryTreeNode) locationsInTree.get(0)).getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
        return name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
    protected boolean databaseAllFilesEqual(Database previousDB,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
                                            Database currentDB) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
        Iterator i1 = previousDB.getAllFiles().iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
        Iterator i2 = currentDB.getAllFiles().iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
        while (i1.hasNext() && i2.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
            FileList fl1 = (FileList) i1.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
            FileList fl2 = (FileList) i2.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
            if (!fl1.getName().equals(fl2.getName())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
                return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
        if (i1.hasNext() != i2.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
            // Different lengths
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
    protected String envVarPrefixedFileName(String fileName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
                                            int sourceBaseLen,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
                                            DirectoryTree tree,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
                                            Vector preferredPaths,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
                                            Vector filesNotFound,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
                                            Vector filesDuplicate) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
        String fullName = findFileInDirectory(fileName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
                                              tree,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
                                              preferredPaths,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
                                              filesNotFound,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
                                              filesDuplicate);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
        return fullName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
     String getProjectName(String fullPath, String extension)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
        throws IllegalArgumentException, IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
        File file = new File(fullPath).getCanonicalFile();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
        fullPath = file.getCanonicalPath();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
        String parent = file.getParent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        if (!fullPath.endsWith(extension)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
            throw new IllegalArgumentException("project file name \"" +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
                                               fullPath +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
                                               "\" does not end in "+extension);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
        if ((parent != null) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
            (!fullPath.startsWith(parent))) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
            throw new RuntimeException(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
                "Internal error: parent of file name \"" + parent +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
                "\" does not match file name \"" + fullPath + "\""
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
        int len = parent.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
        if (!parent.endsWith(Util.sep)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
            len += Util.sep.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
        int end = fullPath.length() - extension.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        if (len == end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
            throw new RuntimeException(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
                "Internal error: file name was empty"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
        return fullPath.substring(len, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    protected abstract String getProjectExt();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    public void writePlatformSpecificFiles(Database previousDB,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
                                           Database currentDB, String[] args)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
        throws IllegalArgumentException, IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        parseArguments(args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        String projectFileName = BuildConfig.getFieldString(null, "ProjectFileName");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
        String ext = getProjectExt();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
        // Compare contents of allFiles of previousDB and includeDB.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
        // If these haven't changed, then skip writing the .vcproj file.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
        if (false && databaseAllFilesEqual(previousDB, currentDB) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
            new File(projectFileName).exists()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
            System.out.println(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
                               "    Databases unchanged; skipping overwrite of "+ext+" file."
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
                               );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
        String projectName = getProjectName(projectFileName, ext);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
        writeProjectFile(projectFileName, projectName, createAllConfigs());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    protected void writePrologue(String[] args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
        System.err.println("WinGammaPlatform platform-specific arguments:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
        for (int i = 0; i < args.length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
            System.err.print(args[i] + " ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
        System.err.println();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    void setInclFileTemplate(FileName val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
        this.inclFileTemplate = val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    void setGIFileTemplate(FileName val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
        this.giFileTemplate = val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    void parseArguments(String[] args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
        new ArgsParser(args,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
                       new ArgRule[]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
            {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
                new HsArgRule("-sourceBase",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
                              "SourceBase",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
                              "   (Did you set the HotSpotWorkSpace environment variable?)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
                new HsArgRule("-buildBase",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
                              "BuildBase",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
                              "   (Did you set the HotSpotBuildSpace environment variable?)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
                new HsArgRule("-projectFileName",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
                              "ProjectFileName",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
                new HsArgRule("-jdkTargetRoot",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
                              "JdkTargetRoot",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
                              "   (Did you set the HotSpotJDKDist environment variable?)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
                new HsArgRule("-compiler",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
                              "CompilerVersion",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
                              "   (Did you set the VcVersion correctly?)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
                new HsArgRule("-platform",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
                              "Platform",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
                new HsArgRule("-absoluteInclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
                              "AbsoluteInclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
                              HsArgHandler.VECTOR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
                new HsArgRule("-relativeInclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
                              "RelativeInclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
                              HsArgHandler.VECTOR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
                new HsArgRule("-define",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
                              "Define",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
                              HsArgHandler.VECTOR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
                new HsArgRule("-useToGeneratePch",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
                              "UseToGeneratePch",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
                new ArgRuleSpecific("-perFileLine",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
                            new HsArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
                                public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
                                    String cfg = getCfg(it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
                                    if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
                                        String fileName = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
                                        if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
                                            String line = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
                                            BuildConfig.putFieldHash(cfg, "PerFileLine", fileName, line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
                                            it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
                                            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
                                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
                                    empty(null, "** Error: wrong number of args to -perFileLine");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
                            ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
                new ArgRuleSpecific("-conditionalPerFileLine",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
                            new HsArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
                                public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
                                    String cfg = getCfg(it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
                                    if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
                                        String fileName = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
                                        if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
                                            String productLine = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
                                            if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
                                                String debugLine = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
                                                BuildConfig.putFieldHash(cfg+"_debug", "CondPerFileLine",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
                                                                         fileName, debugLine);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
                                                BuildConfig.putFieldHash(cfg+"_product", "CondPerFileLine",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
                                                                         fileName, productLine);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
                                                it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
                                                return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
                                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
                                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
                                    empty(null, "** Error: wrong number of args to -conditionalPerFileLine");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
                            ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
                new HsArgRule("-disablePch",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
                              "DisablePch",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
                              HsArgHandler.HASH
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
                new ArgRule("-startAt",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
                            new HsArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
                                public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
                                    if (BuildConfig.getField(null, "StartAt") != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
                                        empty(null, "** Error: multiple -startAt");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
                                    if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
                                        BuildConfig.putField(null, "StartAt", it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
                                        it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
                                    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
                                        empty("-startAt", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
                            ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
                new HsArgRule("-ignoreFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
                                      "IgnoreFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
                                      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
                                      HsArgHandler.HASH
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
                                      ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
                new HsArgRule("-additionalFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
                              "AdditionalFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
                              HsArgHandler.VECTOR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
                new ArgRuleSpecific("-additionalGeneratedFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
                            new HsArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
                                public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
                                    String cfg = getCfg(it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
                                    if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
                                        String dir = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
                                        if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
                                            String fileName = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
                                            // we ignore files that we know are generated, so we coudn't
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
                                            // find them in sources
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
                                            BuildConfig.putFieldHash(cfg, "IgnoreFile",  fileName, "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
                                            BuildConfig.putFieldHash(cfg, "AdditionalGeneratedFile",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
                                                                     Util.normalize(dir + Util.sep + fileName),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
                                                                     fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
                                            it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
                                            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
                                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
                                    empty(null, "** Error: wrong number of args to -additionalGeneratedFile");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
                            ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
                new HsArgRule("-includeDB",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
                              "IncludeDB",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
                              null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
                              HsArgHandler.STRING
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
                              ),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
                new ArgRule("-prelink",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
                            new HsArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
                                public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
                                    if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
                                        String build = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
                                        if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
                                            String description = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
                                            if (nextNotKey(it)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
                                                String command = it.get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
                                                BuildConfig.putField(null, "PrelinkDescription", description);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
                                                BuildConfig.putField(null, "PrelinkCommand", command);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
                                                it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
                                                return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
                                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
                                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
                                    empty(null,  "** Error: wrong number of args to -prelink");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
                            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
                            )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
            },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
                                       new ArgHandler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
                                           public void handle(ArgIterator it) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
                                               throw new RuntimeException("Arg Parser: unrecognized option "+it.get());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
                                           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
                                       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
                                       );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
        if (BuildConfig.getField(null, "SourceBase") == null      ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
            BuildConfig.getField(null, "BuildBase") == null       ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
            BuildConfig.getField(null, "ProjectFileName") == null ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
            BuildConfig.getField(null, "CompilerVersion") == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
            usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
        if (BuildConfig.getField(null, "UseToGeneratePch") == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
            throw new RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
        BuildConfig.putField(null, "PlatformObject", this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
    Vector createAllConfigs() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
        Vector allConfigs = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
        allConfigs.add(new C1DebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
        boolean b = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
        if (b) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
            allConfigs.add(new C1FastDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
            allConfigs.add(new C1ProductConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
            allConfigs.add(new C2DebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
            allConfigs.add(new C2FastDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
            allConfigs.add(new C2ProductConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
            allConfigs.add(new TieredDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
            allConfigs.add(new TieredFastDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
            allConfigs.add(new TieredProductConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
            allConfigs.add(new CoreDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
            allConfigs.add(new CoreFastDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
            allConfigs.add(new CoreProductConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
            allConfigs.add(new KernelDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
            allConfigs.add(new KernelFastDebugConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
            allConfigs.add(new KernelProductConfig());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
        return allConfigs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
    class FileAttribute {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
        int     numConfigs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
        Vector  configs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
        String  shortName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
        boolean noPch, pchRoot;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
        FileAttribute(String shortName, BuildConfig cfg, int numConfigs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
            this.shortName = shortName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
            this.noPch =  (cfg.lookupHashFieldInContext("DisablePch", shortName) != null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
            this.pchRoot = shortName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
            this.numConfigs = numConfigs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
            configs = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
            add(cfg.get("Name"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
        void add(String confName) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
            configs.add(confName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
            // if presented in all configs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
            if (configs.size() == numConfigs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
                configs = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
    class FileInfo implements Comparable {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
        String        full;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
        FileAttribute attr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
        FileInfo(String full, FileAttribute  attr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
            this.full = full;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
            this.attr = attr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
        public int compareTo(Object o) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
            FileInfo oo = (FileInfo)o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
            // Don't squelch identical short file names where the full
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
            // paths are different
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
            if (!attr.shortName.equals(oo.attr.shortName))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
              return attr.shortName.compareTo(oo.attr.shortName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
            return full.compareTo(oo.full);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
        boolean isHeader() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
            return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
    TreeSet sortFiles(Hashtable allFiles) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
        TreeSet rv = new TreeSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
        Enumeration e = allFiles.keys();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
        while (e.hasMoreElements()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
            String fullPath = (String)e.nextElement();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
            rv.add(new FileInfo(fullPath, (FileAttribute)allFiles.get(fullPath)));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
    Hashtable computeAttributedFiles(Vector allConfigs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
        Hashtable ht = new Hashtable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
        int numConfigs = allConfigs.size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
        for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
            BuildConfig bc = (BuildConfig)i.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
            Hashtable  confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
            String confName = bc.get("Name");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
            for (Enumeration e=confFiles.keys(); e.hasMoreElements(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
                String filePath = (String)e.nextElement();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
                FileAttribute fa = (FileAttribute)ht.get(filePath);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
                if (fa == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
                    fa = new FileAttribute((String)confFiles.get(filePath), bc, numConfigs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
                    ht.put(filePath, fa);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
                } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
                    fa.add(confName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
        return ht;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
     Hashtable computeAttributedFiles(BuildConfig bc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
        Hashtable ht = new Hashtable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
        Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
        for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
            String filePath = (String)e.nextElement();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
            ht.put(filePath,  new FileAttribute((String)confFiles.get(filePath), bc, 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
        return ht;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
    PrintWriter printWriter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
    public void writeProjectFile(String projectFileName, String projectName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
                                 Vector allConfigs) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
        throw new RuntimeException("use compiler version specific version");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
}