1 /*
2 * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
143
144 class SpecificNameFilter extends NameFilter {
145 String pats[];
146
147 SpecificNameFilter(String fname, String[] pats) {
148 this.fname = fname;
149 this.pats = pats;
150 }
151
152 boolean match(FileInfo fi) {
153 for (int i=0; i<pats.length; i++) {
154 if (fi.attr.shortName.matches(pats[i])) {
155 return true;
156 }
157 }
158 return false;
159 }
160
161 }
162
163 class ContainerFilter extends NameFilter {
164 Vector children;
165
166 ContainerFilter(String fname) {
167 this.fname = fname;
168 children = new Vector();
169
170 }
171 boolean match(FileInfo fi) {
172 return false;
173 }
174
175 Iterator babies() { return children.iterator(); }
176
177 void add(NameFilter f) {
178 children.add(f);
179 }
180 }
181
182
215 ContainerFilter gc_impl = new ContainerFilter("Implementations");
216 gc_impl.add(new DirectoryFilter("CMS",
217 "share/vm/gc_implementation/concurrentMarkSweep",
218 sbase));
219 gc_impl.add(new DirectoryFilter("Parallel Scavenge",
220 "share/vm/gc_implementation/parallelScavenge",
221 sbase));
222 gc_impl.add(new DirectoryFilter("Shared",
223 "share/vm/gc_implementation/shared",
224 sbase));
225 // for all leftovers
226 gc_impl.add(new DirectoryFilter("Misc",
227 "share/vm/gc_implementation",
228 sbase));
229
230 gc.add(gc_impl);
231 rv.add(gc);
232
233 rv.add(new DirectoryFilter("C1", "share/vm/c1", sbase));
234
235 ContainerFilter c2 = new ContainerFilter("C2");
236 //c2.add(new DirectoryFilter("share/vm/adlc", sbase));
237 c2.add(new DirectoryFilter("share/vm/opto", sbase));
238 c2.add(new SpecificNameFilter("Generated", new String[] {"^ad_.+", "^dfa_.+", "^adGlobals.+"}));
239 rv.add(c2);
240
241 ContainerFilter comp = new ContainerFilter("Compiler Common");
242 comp.add(new DirectoryFilter("share/vm/asm", sbase));
243 comp.add(new DirectoryFilter("share/vm/ci", sbase));
244 comp.add(new DirectoryFilter("share/vm/code", sbase));
245 comp.add(new DirectoryFilter("share/vm/compiler", sbase));
246 rv.add(comp);
247
248 rv.add(new DirectoryFilter("Interpreter",
249 "share/vm/interpreter",
250 sbase));
251
252 ContainerFilter misc = new ContainerFilter("Misc");
253 //misc.add(new DirectoryFilter("share/vm/launch", sbase));
254 misc.add(new DirectoryFilter("share/vm/libadt", sbase));
255 misc.add(new DirectoryFilter("share/vm/services", sbase));
256 misc.add(new DirectoryFilter("share/vm/utilities", sbase));
257 rv.add(misc);
258
259 rv.add(new DirectoryFilter("os_cpu", sbase));
260
261 rv.add(new DirectoryFilter("cpu", sbase));
262
263 rv.add(new DirectoryFilter("os", sbase));
264
265 rv.add(new SpecificNameFilter("JVMTI Generated", new String[] {"^jvmti.+"}));
266
267 rv.add(new SpecificNameFilter("C++ Interpreter Generated", new String[] {"^bytecodeInterpreterWithChecks.+"}));
268
269 rv.add(new SpecificNameFilter("Include DBs", new String[] {"^includeDB_.+"}));
270
271 // this one is to catch files not caught by other filters
272 //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
273 rv.add(new TerminatorFilter("Source Files"));
274
275 return rv;
276 }
277
278 void writeFiles(Vector allConfigs) {
279
280 Hashtable allFiles = computeAttributedFiles(allConfigs);
281
282 Vector allConfigNames = new Vector();
283 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
284 allConfigNames.add(((BuildConfig)i.next()).get("Name"));
285 }
286
287 TreeSet sortedFiles = sortFiles(allFiles);
288
289 startTag("Files", null);
472 "HeaderFileName", ""
473 }
474 );
475
476 endTag("Configuration");
477 }
478
479 int indent;
480
481 private void startTagPrim(String name,
482 String[] attrs,
483 boolean close) {
484 doIndent();
485 printWriter.print("<"+name);
486 indent++;
487
488 if (attrs != null) {
489 printWriter.println();
490 for (int i=0; i<attrs.length; i+=2) {
491 doIndent();
492 printWriter.println(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
493 }
494 }
495
496 if (close) {
497 indent--;
498 //doIndent();
499 printWriter.println("/>");
500 } else {
501 //doIndent();
502 printWriter.println(">");
503 }
504 }
505
506 void startTag(String name, String[] attrs) {
507 startTagPrim(name, attrs, false);
508 }
509
510 void startTagV(String name, Vector attrs) {
511 String s[] = new String [attrs.size()];
512 for (int i=0; i<attrs.size(); i++) {
537 void doIndent() {
538 for (int i=0; i<indent; i++) {
539 printWriter.print(" ");
540 }
541 }
542
543 protected String getProjectExt() {
544 return ".vcproj";
545 }
546 }
547
548 class CompilerInterfaceVC7 extends CompilerInterface {
549 void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) {
550
551 // advanced M$ IDE (2003) can only recognize name if it's first or
552 // second attribute in the tag - go guess
553 addAttr(rv, "Name", "VCCLCompilerTool");
554 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
555 addAttr(rv, "PreprocessorDefinitions",
556 Util.join(";", defines).replace("\"","""));
557 addAttr(rv, "PrecompiledHeaderThrough",
558 "incls"+Util.sep+"_precompiled.incl");
559 addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
560 addAttr(rv, "AssemblerListingLocation", outDir);
561 addAttr(rv, "ObjectFile", outDir+Util.sep);
562 addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
563 // Set /nologo optin
564 addAttr(rv, "SuppressStartupBanner", "TRUE");
565 // Surpass the default /Tc or /Tp. 0 is compileAsDefault
566 addAttr(rv, "CompileAs", "0");
567 // Set /W3 option. 3 is warningLevel_3
568 addAttr(rv, "WarningLevel", "3");
569 // Set /WX option,
570 addAttr(rv, "WarnAsError", "TRUE");
571 // Set /GS option
572 addAttr(rv, "BufferSecurityCheck", "FALSE");
573 // Set /Zi option. 3 is debugEnabled
574 addAttr(rv, "DebugInformationFormat", "3");
575 }
576 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
577 Vector rv = new Vector();
578
|
1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
143
144 class SpecificNameFilter extends NameFilter {
145 String pats[];
146
147 SpecificNameFilter(String fname, String[] pats) {
148 this.fname = fname;
149 this.pats = pats;
150 }
151
152 boolean match(FileInfo fi) {
153 for (int i=0; i<pats.length; i++) {
154 if (fi.attr.shortName.matches(pats[i])) {
155 return true;
156 }
157 }
158 return false;
159 }
160
161 }
162
163 class SpecificPathFilter extends NameFilter {
164 String pats[];
165
166 SpecificPathFilter(String fname, String[] pats) {
167 this.fname = fname;
168 this.pats = pats;
169 }
170
171 boolean match(FileInfo fi) {
172 for (int i=0; i<pats.length; i++) {
173 if (fi.full.matches(pats[i])) {
174 return true;
175 }
176 }
177 return false;
178 }
179
180 }
181
182 class ContainerFilter extends NameFilter {
183 Vector children;
184
185 ContainerFilter(String fname) {
186 this.fname = fname;
187 children = new Vector();
188
189 }
190 boolean match(FileInfo fi) {
191 return false;
192 }
193
194 Iterator babies() { return children.iterator(); }
195
196 void add(NameFilter f) {
197 children.add(f);
198 }
199 }
200
201
234 ContainerFilter gc_impl = new ContainerFilter("Implementations");
235 gc_impl.add(new DirectoryFilter("CMS",
236 "share/vm/gc_implementation/concurrentMarkSweep",
237 sbase));
238 gc_impl.add(new DirectoryFilter("Parallel Scavenge",
239 "share/vm/gc_implementation/parallelScavenge",
240 sbase));
241 gc_impl.add(new DirectoryFilter("Shared",
242 "share/vm/gc_implementation/shared",
243 sbase));
244 // for all leftovers
245 gc_impl.add(new DirectoryFilter("Misc",
246 "share/vm/gc_implementation",
247 sbase));
248
249 gc.add(gc_impl);
250 rv.add(gc);
251
252 rv.add(new DirectoryFilter("C1", "share/vm/c1", sbase));
253
254 rv.add(new DirectoryFilter("C2", "share/vm/opto", sbase));
255
256 ContainerFilter comp = new ContainerFilter("Compiler Common");
257 comp.add(new DirectoryFilter("share/vm/asm", sbase));
258 comp.add(new DirectoryFilter("share/vm/ci", sbase));
259 comp.add(new DirectoryFilter("share/vm/code", sbase));
260 comp.add(new DirectoryFilter("share/vm/compiler", sbase));
261 rv.add(comp);
262
263 rv.add(new DirectoryFilter("Interpreter",
264 "share/vm/interpreter",
265 sbase));
266
267 ContainerFilter misc = new ContainerFilter("Misc");
268 misc.add(new DirectoryFilter("share/vm/libadt", sbase));
269 misc.add(new DirectoryFilter("share/vm/services", sbase));
270 misc.add(new DirectoryFilter("share/vm/utilities", sbase));
271 misc.add(new DirectoryFilter("share/vm/classfile", sbase));
272 rv.add(misc);
273
274 rv.add(new DirectoryFilter("os_cpu", sbase));
275
276 rv.add(new DirectoryFilter("cpu", sbase));
277
278 rv.add(new DirectoryFilter("os", sbase));
279
280 ContainerFilter generated = new ContainerFilter("Generated");
281 ContainerFilter c1Generated = new ContainerFilter("C1");
282 c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
283 c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"}));
284 generated.add(c1Generated);
285 ContainerFilter c2Generated = new ContainerFilter("C2");
286 c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
287 c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"}));
288 c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"}));
289 generated.add(c2Generated);
290 ContainerFilter coreGenerated = new ContainerFilter("Core");
291 coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
292 coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"}));
293 generated.add(coreGenerated);
294 ContainerFilter tieredGenerated = new ContainerFilter("Tiered");
295 tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
296 tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"}));
297 tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"}));
298 generated.add(tieredGenerated);
299 ContainerFilter kernelGenerated = new ContainerFilter("Kernel");
300 kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
301 kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"}));
302 generated.add(kernelGenerated);
303 rv.add(generated);
304
305 rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"}));
306
307 // this one is to catch files not caught by other filters
308 //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
309 rv.add(new TerminatorFilter("Source Files"));
310
311 return rv;
312 }
313
314 void writeFiles(Vector allConfigs) {
315
316 Hashtable allFiles = computeAttributedFiles(allConfigs);
317
318 Vector allConfigNames = new Vector();
319 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
320 allConfigNames.add(((BuildConfig)i.next()).get("Name"));
321 }
322
323 TreeSet sortedFiles = sortFiles(allFiles);
324
325 startTag("Files", null);
508 "HeaderFileName", ""
509 }
510 );
511
512 endTag("Configuration");
513 }
514
515 int indent;
516
517 private void startTagPrim(String name,
518 String[] attrs,
519 boolean close) {
520 doIndent();
521 printWriter.print("<"+name);
522 indent++;
523
524 if (attrs != null) {
525 printWriter.println();
526 for (int i=0; i<attrs.length; i+=2) {
527 doIndent();
528 printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
529 if (i < attrs.length - 2) {
530 printWriter.println();
531 }
532 }
533 }
534
535 if (close) {
536 indent--;
537 //doIndent();
538 printWriter.println("/>");
539 } else {
540 //doIndent();
541 printWriter.println(">");
542 }
543 }
544
545 void startTag(String name, String[] attrs) {
546 startTagPrim(name, attrs, false);
547 }
548
549 void startTagV(String name, Vector attrs) {
550 String s[] = new String [attrs.size()];
551 for (int i=0; i<attrs.size(); i++) {
576 void doIndent() {
577 for (int i=0; i<indent; i++) {
578 printWriter.print(" ");
579 }
580 }
581
582 protected String getProjectExt() {
583 return ".vcproj";
584 }
585 }
586
587 class CompilerInterfaceVC7 extends CompilerInterface {
588 void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) {
589
590 // advanced M$ IDE (2003) can only recognize name if it's first or
591 // second attribute in the tag - go guess
592 addAttr(rv, "Name", "VCCLCompilerTool");
593 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
594 addAttr(rv, "PreprocessorDefinitions",
595 Util.join(";", defines).replace("\"","""));
596 addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp");
597 addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
598 addAttr(rv, "AssemblerListingLocation", outDir);
599 addAttr(rv, "ObjectFile", outDir+Util.sep);
600 addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
601 // Set /nologo optin
602 addAttr(rv, "SuppressStartupBanner", "TRUE");
603 // Surpass the default /Tc or /Tp. 0 is compileAsDefault
604 addAttr(rv, "CompileAs", "0");
605 // Set /W3 option. 3 is warningLevel_3
606 addAttr(rv, "WarningLevel", "3");
607 // Set /WX option,
608 addAttr(rv, "WarnAsError", "TRUE");
609 // Set /GS option
610 addAttr(rv, "BufferSecurityCheck", "FALSE");
611 // Set /Zi option. 3 is debugEnabled
612 addAttr(rv, "DebugInformationFormat", "3");
613 }
614 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
615 Vector rv = new Vector();
616
|