hotspot/src/share/tools/MakeDeps/WinGammaPlatformVC7.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 2271 ff6d122287cb
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 2005-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
public class WinGammaPlatformVC7 extends WinGammaPlatform {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
    public void writeProjectFile(String projectFileName, String projectName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
                                 Vector allConfigs) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
        System.out.println();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
        System.out.println("    Writing .vcproj file...");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
        // If we got this far without an error, we're safe to actually
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
        // write the .vcproj file
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
        printWriter = new PrintWriter(new FileWriter(projectFileName));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
        printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
        startTag(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
            "VisualStudioProject",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
                "ProjectType", "Visual C++",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
                "Version", "7.10",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
                "Name", projectName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
                "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
                "SccProjectName", "",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
                "SccLocalPath", ""
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
        startTag("Platforms", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
        tag("Platform", new String[] {"Name", Util.os});
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        endTag("Platforms");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        startTag("Configurations", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
            writeConfiguration((BuildConfig)i.next());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
        endTag("Configurations");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        tag("References", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        writeFiles(allConfigs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        tag("Globals", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        endTag("VisualStudioProject");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        printWriter.close();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        System.out.println("    Done.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    abstract class NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        protected String fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
        abstract boolean match(FileInfo fi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        String  filterString() { return ""; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
        String name() { return this.fname;}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    class DirectoryFilter extends NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
        String dir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        int baseLen, dirLen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
        DirectoryFilter(String dir, String sbase) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
            this.dir = dir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
            this.baseLen = sbase.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
            this.dirLen = dir.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
            this.fname = dir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
        DirectoryFilter(String fname, String dir, String sbase) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
            this.dir = dir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
            this.baseLen = sbase.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
            this.dirLen = dir.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
            this.fname = fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
        boolean match(FileInfo fi) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
            return fi.full.regionMatches(true, baseLen, dir, 0, dirLen);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    class TypeFilter extends NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        String[] exts;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
        TypeFilter(String fname, String[] exts) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
            this.fname = fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
            this.exts = exts;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
        boolean match(FileInfo fi) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
            for (int i=0; i<exts.length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
                if (fi.full.endsWith(exts[i])) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
                    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
        String  filterString() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
            return Util.join(";", exts);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    class TerminatorFilter extends NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
        TerminatorFilter(String fname) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
            this.fname = fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        boolean match(FileInfo fi) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
            return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    class SpecificNameFilter extends NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
        String pats[];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
        SpecificNameFilter(String fname, String[] pats) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
            this.fname = fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
            this.pats = pats;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
        boolean match(FileInfo fi) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
            for (int i=0; i<pats.length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
                if (fi.attr.shortName.matches(pats[i])) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
                    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    class ContainerFilter extends NameFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
        Vector children;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
        ContainerFilter(String fname) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
            this.fname = fname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
            children = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
        boolean match(FileInfo fi) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
        Iterator babies() { return children.iterator(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
        void add(NameFilter f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
            children.add(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    void writeCustomToolConfig(Vector configs, String[] customToolAttrs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
        for (Iterator i = configs.iterator(); i.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
            startTag("FileConfiguration",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
                     new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
                         "Name",  (String)i.next()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
                     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
                     );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
            tag("Tool", customToolAttrs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
            endTag("FileConfiguration");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    // Basically there are two types of entities - container filters and real filters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    //   - container filter just provides a container to group together real filters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    //   - real filter can select elements from the set according to some rule, put it into XML
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    //     and remove from the list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    Vector makeFilters(TreeSet files) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
        String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
        ContainerFilter rt = new ContainerFilter("Runtime");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
        rt.add(new DirectoryFilter("share/vm/prims", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
        rt.add(new DirectoryFilter("share/vm/runtime", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        rt.add(new DirectoryFilter("share/vm/oops", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
        rv.add(rt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
        ContainerFilter gc = new ContainerFilter("GC");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        gc.add(new DirectoryFilter("share/vm/memory", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        gc.add(new DirectoryFilter("share/vm/gc_interface", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        ContainerFilter gc_impl = new ContainerFilter("Implementations");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        gc_impl.add(new DirectoryFilter("CMS",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
                                        "share/vm/gc_implementation/concurrentMarkSweep",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
                                        sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
        gc_impl.add(new DirectoryFilter("Parallel Scavenge",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
                                        "share/vm/gc_implementation/parallelScavenge",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
                                        sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
        gc_impl.add(new DirectoryFilter("Shared",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
                                        "share/vm/gc_implementation/shared",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
                                        sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
        // for all leftovers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
        gc_impl.add(new DirectoryFilter("Misc",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
                                        "share/vm/gc_implementation",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
                                        sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        gc.add(gc_impl);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
        rv.add(gc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
        rv.add(new DirectoryFilter("C1", "share/vm/c1", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        ContainerFilter c2 = new ContainerFilter("C2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
        //c2.add(new DirectoryFilter("share/vm/adlc", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
        c2.add(new DirectoryFilter("share/vm/opto", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
        c2.add(new SpecificNameFilter("Generated", new String[] {"^ad_.+", "^dfa_.+", "^adGlobals.+"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
        rv.add(c2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        ContainerFilter comp = new ContainerFilter("Compiler Common");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
        comp.add(new DirectoryFilter("share/vm/asm", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
        comp.add(new DirectoryFilter("share/vm/ci", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
        comp.add(new DirectoryFilter("share/vm/code", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
        comp.add(new DirectoryFilter("share/vm/compiler", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
        rv.add(comp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
        rv.add(new DirectoryFilter("Interpreter",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
                                   "share/vm/interpreter",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                                   sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
        ContainerFilter misc = new ContainerFilter("Misc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
        //misc.add(new DirectoryFilter("share/vm/launch", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        misc.add(new DirectoryFilter("share/vm/libadt", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
        misc.add(new DirectoryFilter("share/vm/services", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
        misc.add(new DirectoryFilter("share/vm/utilities", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
        rv.add(misc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        rv.add(new DirectoryFilter("os_cpu", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
        rv.add(new DirectoryFilter("cpu", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
        rv.add(new DirectoryFilter("os", sbase));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
        rv.add(new SpecificNameFilter("JVMTI Generated", new String[] {"^jvmti.+"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
        rv.add(new SpecificNameFilter("C++ Interpreter Generated", new String[] {"^bytecodeInterpreterWithChecks.+"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
        rv.add(new SpecificNameFilter("Include DBs", new String[] {"^includeDB_.+"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
        // this one is to catch files not caught by other filters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
        //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
        rv.add(new TerminatorFilter("Source Files"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    void writeFiles(Vector allConfigs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
        Hashtable allFiles = computeAttributedFiles(allConfigs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
        Vector allConfigNames = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
        for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
            allConfigNames.add(((BuildConfig)i.next()).get("Name"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
        TreeSet sortedFiles = sortFiles(allFiles);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
        startTag("Files", null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
        for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
            doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next());
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
        startTag("Filter",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
                 new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
                     "Name", "Resource Files",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
                     "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
                 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
                 );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
        endTag("Filter");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
        endTag("Files");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
        startTag("Filter",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
                 new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
                     "Name",   filter.name(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
                     "Filter", filter.filterString()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
                 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
                 );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
        if (filter instanceof ContainerFilter) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
            Iterator i = ((ContainerFilter)filter).babies();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
            while (i.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
                doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
            Iterator i = allFiles.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
            while (i.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
                FileInfo fi = (FileInfo)i.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
                if (!filter.match(fi)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
                    continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
                startTag("File",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
                         new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
                             "RelativePath", fi.full.replace('/', '\\')
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
                         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
                         );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
                FileAttribute a = fi.attr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
                if (a.pchRoot) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
                    writeCustomToolConfig(allConfigNames,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
                                          new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
                                              "Name", "VCCLCompilerTool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
                                              "UsePrecompiledHeader", "1"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
                                          });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
                if (a.noPch) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
                    writeCustomToolConfig(allConfigNames,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
                                          new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
                                              "Name", "VCCLCompilerTool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
                                              "UsePrecompiledHeader", "0"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
                                          });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
                if (a.configs != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
                    for (Iterator j=allConfigNames.iterator(); j.hasNext();) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
                        String cfg = (String)j.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
                        if (!a.configs.contains(cfg)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
                            startTag("FileConfiguration",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
                                     new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
                                         "Name", cfg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
                                         "ExcludedFromBuild", "TRUE"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
                                     });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
                            tag("Tool", new String[] {"Name", "VCCLCompilerTool"});
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
                            endTag("FileConfiguration");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
                endTag("File");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
                // we not gonna look at this file anymore
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
                i.remove();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
        endTag("Filter");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    void writeConfiguration(BuildConfig cfg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        startTag("Configuration",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
                 new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
                     "Name", cfg.get("Name"),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
                     "OutputDirectory",  cfg.get("OutputDir"),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
                     "IntermediateDirectory",  cfg.get("OutputDir"),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
                     "ConfigurationType", "2",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
                     "UseOfMFC", "0",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
                     "ATLMinimizesCRunTimeLibraryUsage", "FALSE"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
                 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
                 );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
        tagV("Tool", cfg.getV("CompilerFlags"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
                "Name", "VCCustomBuildTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
        tagV("Tool", cfg.getV("LinkerFlags"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
                "Name", "VCPostBuildEventTool"
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
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
                "Name", "VCPreBuildEventTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
                "Name", "VCPreLinkEventTool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
                "Description", BuildConfig.getFieldString(null, "PrelinkDescription"),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
                "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace('\t', '\n'))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
                "Name", "VCResourceCompilerTool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
                // XXX???
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
                "PreprocessorDefinitions", "NDEBUG",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
                "Culture", "1033"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
              "Name", "VCWebServiceProxyGeneratorTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
        tag ("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
             new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
              "Name", "VCXMLDataGeneratorTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
             );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
              "Name", "VCWebDeploymentTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
             new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
            "Name", "VCManagedWrapperGeneratorTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
              "Name", "VCAuxiliaryManagedWrapperGeneratorTool"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
        tag("Tool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
            new String[] {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
                "Name", "VCMIDLTool",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
                "PreprocessorDefinitions", "NDEBUG",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
                "MkTypLibCompatible", "TRUE",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
                "SuppressStartupBanner", "TRUE",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
                "TargetEnvironment", "1",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
                "TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
                "HeaderFileName", ""
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
            );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
        endTag("Configuration");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
    int indent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    private void startTagPrim(String name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
                              String[] attrs,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
                              boolean close) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
        doIndent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
        printWriter.print("<"+name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
        indent++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
        if (attrs != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
            printWriter.println();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
            for (int i=0; i<attrs.length; i+=2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
                doIndent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
                printWriter.println(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
        if (close) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
            indent--;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
            //doIndent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
            printWriter.println("/>");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
            //doIndent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
            printWriter.println(">");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
    void startTag(String name, String[] attrs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
        startTagPrim(name, attrs, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
    void startTagV(String name, Vector attrs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
        String s[] = new String [attrs.size()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
         for (int i=0; i<attrs.size(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
             s[i] = (String)attrs.elementAt(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
        startTagPrim(name, s, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
    void endTag(String name) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
        indent--;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
        doIndent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
        printWriter.println("</"+name+">");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
    void tag(String name, String[] attrs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
        startTagPrim(name, attrs, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
     void tagV(String name, Vector attrs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
         String s[] = new String [attrs.size()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
         for (int i=0; i<attrs.size(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
             s[i] = (String)attrs.elementAt(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
         startTagPrim(name, s, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
    void doIndent() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
        for (int i=0; i<indent; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
            printWriter.print("    ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
    protected String getProjectExt() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
        return ".vcproj";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
class CompilerInterfaceVC7 extends CompilerInterface {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
        // advanced M$ IDE (2003) can only recognize name if it's first or
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
        // second attribute in the tag - go guess
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
        addAttr(rv, "Name", "VCCLCompilerTool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
        addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
        addAttr(rv, "PreprocessorDefinitions", Util.join(";", defines).replace("\"","&quot;"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
        addAttr(rv, "UsePrecompiledHeader", "3");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
        addAttr(rv, "PrecompiledHeaderThrough", "incls"+Util.sep+"_precompiled.incl");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
        addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
        addAttr(rv, "AssemblerListingLocation", outDir);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
        addAttr(rv, "ObjectFile", outDir+Util.sep);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
        addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
        addAttr(rv, "SuppressStartupBanner", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
        addAttr(rv, "CompileAs", "0");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
        addAttr(rv, "WarningLevel", "3");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
        addAttr(rv, "WarnAsError", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
        addAttr(rv, "BufferSecurityCheck", "FALSE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
        addAttr(rv, "ExceptionHandling", "FALSE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    Vector getBaseLinkerFlags(String outDir, String outDll) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
        addAttr(rv, "Name", "VCLinkerTool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
        addAttr(rv, "AdditionalOptions",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
                "/export:JNI_GetDefaultJavaVMInitArgs " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
                "/export:JNI_CreateJavaVM " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
                "/export:JNI_GetCreatedJavaVMs "+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
                "/export:jio_snprintf /export:jio_printf "+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
                "/export:jio_fprintf /export:jio_vfprintf "+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
                "/export:jio_vsnprintf ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
        addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
        addAttr(rv, "OutputFile", outDll);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
        addAttr(rv, "LinkIncremental", "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
        addAttr(rv, "SuppressStartupBanner", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
        addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
        addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
        addAttr(rv, "SubSystem", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
        addAttr(rv, "BaseAddress", "0x8000000");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
        addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
        addAttr(rv, "TargetMachine", "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
    Vector getDebugCompilerFlags(String opt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
        addAttr(rv, "Optimization", opt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
        addAttr(rv, "OptimizeForProcessor", "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
        addAttr(rv, "DebugInformationFormat", "3");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
        addAttr(rv, "RuntimeLibrary", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
        addAttr(rv, "BrowseInformation", "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
        addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
    Vector getDebugLinkerFlags() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
        addAttr(rv, "GenerateDebugInformation", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
    Vector getProductCompilerFlags() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
        addAttr(rv, "Optimization", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
        addAttr(rv, "InlineFunctionExpansion", "1");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
        addAttr(rv, "StringPooling", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
        addAttr(rv, "RuntimeLibrary", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
        addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
    Vector getProductLinkerFlags() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
        Vector rv = new Vector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
        addAttr(rv, "OptimizeReferences", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
        addAttr(rv, "EnableCOMDATFolding", "2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
        return rv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
    String getOptFlag() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
        return "2";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
    String getNoOptFlag() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
        return "0";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
    String makeCfgName(String flavourBuild) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
        return  flavourBuild + "|" + Util.os;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
}