Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/WinGammaPlatform.java @ 8079:ad736b4683b4
8004867: VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
Summary: Added few checks and early bailout from Superword optimization to avoid such cases in a future.
Reviewed-by: roland, twisti
author | kvn |
---|---|
date | Mon, 18 Feb 2013 16:47:15 -0800 |
parents | b9a9ed0f8eeb |
children | e522a00b91aa 6b748c9e1845 |
rev | line source |
---|---|
0 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6801
diff
changeset
|
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
25 import java.io.File; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
26 import java.io.IOException; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
27 import java.io.PrintWriter; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
28 import java.util.Enumeration; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
29 import java.util.Hashtable; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
30 import java.util.Iterator; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
31 import java.util.List; |
6801 | 32 import java.util.Stack; |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
33 import java.util.TreeSet; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
34 import java.util.Vector; |
0 | 35 |
36 abstract class HsArgHandler extends ArgHandler { | |
37 static final int STRING = 1; | |
38 static final int VECTOR = 2; | |
39 static final int HASH = 3; | |
40 | |
41 boolean nextNotKey(ArgIterator it) { | |
42 if (it.next()) { | |
43 String s = it.get(); | |
44 return (s.length() == 0) || (s.charAt(0) != '-'); | |
45 } else { | |
46 return false; | |
47 } | |
48 } | |
49 | |
50 void empty(String key, String message) { | |
51 if (key != null) { | |
52 System.err.println("** Error: empty " + key); | |
53 } | |
54 if (message != null) { | |
55 System.err.println(message); | |
56 } | |
57 WinGammaPlatform.usage(); | |
58 } | |
59 | |
60 static String getCfg(String val) { | |
61 int under = val.indexOf('_'); | |
62 int len = val.length(); | |
63 if (under != -1 && under < len - 1) { | |
64 return val.substring(under+1, len); | |
65 } else { | |
66 return null; | |
67 } | |
68 } | |
69 } | |
70 | |
71 class ArgRuleSpecific extends ArgRule { | |
72 ArgRuleSpecific(String arg, ArgHandler handler) { | |
73 super(arg, handler); | |
74 } | |
75 | |
76 boolean match(String rulePattern, String arg) { | |
77 return rulePattern.startsWith(arg); | |
78 } | |
79 } | |
80 | |
81 | |
82 class SpecificHsArgHandler extends HsArgHandler { | |
83 | |
84 String message, argKey, valKey; | |
85 int type; | |
86 | |
87 public void handle(ArgIterator it) { | |
88 String cfg = getCfg(it.get()); | |
89 if (nextNotKey(it)) { | |
90 String val = it.get(); | |
91 switch (type) { | |
92 case VECTOR: | |
93 BuildConfig.addFieldVector(cfg, valKey, val); | |
94 break; | |
95 case HASH: | |
96 BuildConfig.putFieldHash(cfg, valKey, val, "1"); | |
97 break; | |
98 case STRING: | |
99 BuildConfig.putField(cfg, valKey, val); | |
100 break; | |
101 default: | |
102 empty(valKey, "Unknown type: "+type); | |
103 } | |
104 it.next(); | |
105 | |
106 } else { | |
107 empty(argKey, message); | |
108 } | |
109 } | |
110 | |
111 SpecificHsArgHandler(String argKey, String valKey, String message, int type) { | |
112 this.argKey = argKey; | |
113 this.valKey = valKey; | |
114 this.message = message; | |
115 this.type = type; | |
116 } | |
117 } | |
118 | |
119 | |
120 class HsArgRule extends ArgRuleSpecific { | |
121 | |
122 HsArgRule(String argKey, String valKey, String message, int type) { | |
123 super(argKey, new SpecificHsArgHandler(argKey, valKey, message, type)); | |
124 } | |
125 | |
126 } | |
127 | |
1972 | 128 public abstract class WinGammaPlatform { |
0 | 129 |
130 public boolean fileNameStringEquality(String s1, String s2) { | |
131 return s1.equalsIgnoreCase(s2); | |
132 } | |
133 | |
134 static void usage() throws IllegalArgumentException { | |
135 System.err.println("WinGammaPlatform platform-specific options:"); | |
136 System.err.println(" -sourceBase <path to directory (workspace) " + | |
137 "containing source files; no trailing slash>"); | |
138 System.err.println(" -projectFileName <full pathname to which project file " + | |
139 "will be written; all parent directories must " + | |
140 "already exist>"); | |
141 System.err.println(" If any of the above are specified, "+ | |
142 "they must all be."); | |
143 System.err.println(" Additional, optional arguments, which can be " + | |
144 "specified multiple times:"); | |
145 System.err.println(" -absoluteInclude <string containing absolute " + | |
146 "path to include directory>"); | |
147 System.err.println(" -relativeInclude <string containing include " + | |
148 "directory relative to -sourceBase>"); | |
149 System.err.println(" -define <preprocessor flag to be #defined " + | |
150 "(note: doesn't yet support " + | |
151 "#define (flag) (value))>"); | |
152 System.err.println(" -startAt <subdir of sourceBase>"); | |
153 System.err.println(" -additionalFile <file not in database but " + | |
1972 | 154 "which should show up in project file>"); |
0 | 155 System.err.println(" -additionalGeneratedFile <absolute path to " + |
156 "directory containing file; no trailing slash> " + | |
157 "<name of file generated later in the build process>"); | |
158 throw new IllegalArgumentException(); | |
159 } | |
160 | |
161 | |
162 public void addPerFileLine(Hashtable table, | |
163 String fileName, | |
164 String line) { | |
165 Vector v = (Vector) table.get(fileName); | |
166 if (v != null) { | |
167 v.add(line); | |
168 } else { | |
169 v = new Vector(); | |
170 v.add(line); | |
171 table.put(fileName, v); | |
172 } | |
173 } | |
174 | |
175 protected static class PerFileCondData { | |
176 public String releaseString; | |
177 public String debugString; | |
178 } | |
179 | |
180 protected void addConditionalPerFileLine(Hashtable table, | |
181 String fileName, | |
182 String releaseLine, | |
183 String debugLine) { | |
184 PerFileCondData data = new PerFileCondData(); | |
185 data.releaseString = releaseLine; | |
186 data.debugString = debugLine; | |
187 Vector v = (Vector) table.get(fileName); | |
188 if (v != null) { | |
189 v.add(data); | |
190 } else { | |
191 v = new Vector(); | |
192 v.add(data); | |
193 table.put(fileName, v); | |
194 } | |
195 } | |
196 | |
197 protected static class PrelinkCommandData { | |
198 String description; | |
199 String commands; | |
200 } | |
201 | |
202 protected void addPrelinkCommand(Hashtable table, | |
203 String build, | |
204 String description, | |
205 String commands) { | |
206 PrelinkCommandData data = new PrelinkCommandData(); | |
207 data.description = description; | |
208 data.commands = commands; | |
209 table.put(build, data); | |
210 } | |
211 | |
212 public boolean findString(Vector v, String s) { | |
213 for (Iterator iter = v.iterator(); iter.hasNext(); ) { | |
214 if (((String) iter.next()).equals(s)) { | |
215 return true; | |
216 } | |
217 } | |
218 | |
219 return false; | |
220 } | |
221 | |
222 String getProjectName(String fullPath, String extension) | |
223 throws IllegalArgumentException, IOException { | |
224 File file = new File(fullPath).getCanonicalFile(); | |
225 fullPath = file.getCanonicalPath(); | |
226 String parent = file.getParent(); | |
227 | |
228 if (!fullPath.endsWith(extension)) { | |
229 throw new IllegalArgumentException("project file name \"" + | |
230 fullPath + | |
231 "\" does not end in "+extension); | |
232 } | |
233 | |
234 if ((parent != null) && | |
235 (!fullPath.startsWith(parent))) { | |
236 throw new RuntimeException( | |
237 "Internal error: parent of file name \"" + parent + | |
238 "\" does not match file name \"" + fullPath + "\"" | |
239 ); | |
240 } | |
241 | |
242 int len = parent.length(); | |
243 if (!parent.endsWith(Util.sep)) { | |
244 len += Util.sep.length(); | |
245 } | |
246 | |
247 int end = fullPath.length() - extension.length(); | |
248 | |
249 if (len == end) { | |
250 throw new RuntimeException( | |
251 "Internal error: file name was empty" | |
252 ); | |
253 } | |
254 | |
255 return fullPath.substring(len, end); | |
256 } | |
257 | |
258 protected abstract String getProjectExt(); | |
259 | |
1972 | 260 public void createVcproj(String[] args) |
0 | 261 throws IllegalArgumentException, IOException { |
262 | |
263 parseArguments(args); | |
264 | |
265 String projectFileName = BuildConfig.getFieldString(null, "ProjectFileName"); | |
266 String ext = getProjectExt(); | |
267 | |
268 String projectName = getProjectName(projectFileName, ext); | |
269 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
270 writeProjectFile(projectFileName, projectName, createAllConfigs(BuildConfig.getFieldString(null, "PlatformName"))); |
0 | 271 } |
272 | |
273 protected void writePrologue(String[] args) { | |
274 System.err.println("WinGammaPlatform platform-specific arguments:"); | |
275 for (int i = 0; i < args.length; i++) { | |
276 System.err.print(args[i] + " "); | |
277 } | |
278 System.err.println(); | |
279 } | |
280 | |
281 | |
282 void parseArguments(String[] args) { | |
283 new ArgsParser(args, | |
284 new ArgRule[] | |
285 { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
286 new ArgRule("-sourceBase", |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
287 new HsArgHandler() { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
288 public void handle(ArgIterator it) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
289 String cfg = getCfg(it.get()); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
290 if (nextNotKey(it)) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
291 String sb = (String) it.get(); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
292 if (sb.endsWith(Util.sep)) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
293 sb = sb.substring(0, sb.length() - 1); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
294 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
295 BuildConfig.putField(cfg, "SourceBase", sb); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
296 it.next(); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
297 } else { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
298 empty("-sourceBase", null); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
299 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
300 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
301 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
302 ), |
0 | 303 |
304 new HsArgRule("-buildBase", | |
305 "BuildBase", | |
306 " (Did you set the HotSpotBuildSpace environment variable?)", | |
307 HsArgHandler.STRING | |
308 ), | |
309 | |
6801 | 310 new HsArgRule("-buildSpace", |
311 "BuildSpace", | |
312 null, | |
313 HsArgHandler.STRING | |
314 ), | |
315 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
316 new HsArgRule("-platformName", |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
317 "PlatformName", |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
318 null, |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
319 HsArgHandler.STRING |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
320 ), |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
321 |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
322 new HsArgRule("-projectFileName", |
0 | 323 "ProjectFileName", |
324 null, | |
325 HsArgHandler.STRING | |
326 ), | |
327 | |
328 new HsArgRule("-jdkTargetRoot", | |
329 "JdkTargetRoot", | |
330 " (Did you set the HotSpotJDKDist environment variable?)", | |
331 HsArgHandler.STRING | |
332 ), | |
333 | |
334 new HsArgRule("-compiler", | |
335 "CompilerVersion", | |
336 " (Did you set the VcVersion correctly?)", | |
337 HsArgHandler.STRING | |
338 ), | |
339 | |
340 new HsArgRule("-absoluteInclude", | |
341 "AbsoluteInclude", | |
342 null, | |
343 HsArgHandler.VECTOR | |
344 ), | |
345 | |
346 new HsArgRule("-relativeInclude", | |
347 "RelativeInclude", | |
348 null, | |
349 HsArgHandler.VECTOR | |
350 ), | |
351 | |
6801 | 352 new HsArgRule("-absoluteSrcInclude", |
353 "AbsoluteSrcInclude", | |
354 null, | |
355 HsArgHandler.VECTOR | |
356 ), | |
357 | |
358 new HsArgRule("-relativeSrcInclude", | |
359 "RelativeSrcInclude", | |
360 null, | |
361 HsArgHandler.VECTOR | |
362 ), | |
363 | |
0 | 364 new HsArgRule("-define", |
365 "Define", | |
366 null, | |
367 HsArgHandler.VECTOR | |
368 ), | |
369 | |
370 new HsArgRule("-useToGeneratePch", | |
371 "UseToGeneratePch", | |
372 null, | |
373 HsArgHandler.STRING | |
374 ), | |
375 | |
376 new ArgRuleSpecific("-perFileLine", | |
377 new HsArgHandler() { | |
378 public void handle(ArgIterator it) { | |
379 String cfg = getCfg(it.get()); | |
380 if (nextNotKey(it)) { | |
381 String fileName = it.get(); | |
382 if (nextNotKey(it)) { | |
383 String line = it.get(); | |
384 BuildConfig.putFieldHash(cfg, "PerFileLine", fileName, line); | |
385 it.next(); | |
386 return; | |
387 } | |
388 } | |
389 empty(null, "** Error: wrong number of args to -perFileLine"); | |
390 } | |
391 } | |
392 ), | |
393 | |
394 new ArgRuleSpecific("-conditionalPerFileLine", | |
395 new HsArgHandler() { | |
396 public void handle(ArgIterator it) { | |
397 String cfg = getCfg(it.get()); | |
398 if (nextNotKey(it)) { | |
399 String fileName = it.get(); | |
400 if (nextNotKey(it)) { | |
401 String productLine = it.get(); | |
402 if (nextNotKey(it)) { | |
403 String debugLine = it.get(); | |
404 BuildConfig.putFieldHash(cfg+"_debug", "CondPerFileLine", | |
405 fileName, debugLine); | |
406 BuildConfig.putFieldHash(cfg+"_product", "CondPerFileLine", | |
407 fileName, productLine); | |
408 it.next(); | |
409 return; | |
410 } | |
411 } | |
412 } | |
413 | |
414 empty(null, "** Error: wrong number of args to -conditionalPerFileLine"); | |
415 } | |
416 } | |
417 ), | |
418 | |
419 new HsArgRule("-disablePch", | |
420 "DisablePch", | |
421 null, | |
422 HsArgHandler.HASH | |
423 ), | |
424 | |
425 new ArgRule("-startAt", | |
426 new HsArgHandler() { | |
427 public void handle(ArgIterator it) { | |
428 if (BuildConfig.getField(null, "StartAt") != null) { | |
429 empty(null, "** Error: multiple -startAt"); | |
430 } | |
431 if (nextNotKey(it)) { | |
432 BuildConfig.putField(null, "StartAt", it.get()); | |
433 it.next(); | |
434 } else { | |
435 empty("-startAt", null); | |
436 } | |
437 } | |
438 } | |
439 ), | |
440 | |
441 new HsArgRule("-ignoreFile", | |
442 "IgnoreFile", | |
443 null, | |
444 HsArgHandler.HASH | |
445 ), | |
446 | |
1972 | 447 new HsArgRule("-ignorePath", |
448 "IgnorePath", | |
449 null, | |
450 HsArgHandler.VECTOR | |
451 ), | |
452 | |
6801 | 453 new HsArgRule("-hidePath", |
454 "HidePath", | |
455 null, | |
456 HsArgHandler.VECTOR | |
457 ), | |
458 | |
0 | 459 new HsArgRule("-additionalFile", |
460 "AdditionalFile", | |
461 null, | |
462 HsArgHandler.VECTOR | |
463 ), | |
464 | |
465 new ArgRuleSpecific("-additionalGeneratedFile", | |
466 new HsArgHandler() { | |
467 public void handle(ArgIterator it) { | |
468 String cfg = getCfg(it.get()); | |
469 if (nextNotKey(it)) { | |
470 String dir = it.get(); | |
471 if (nextNotKey(it)) { | |
472 String fileName = it.get(); | |
473 BuildConfig.putFieldHash(cfg, "AdditionalGeneratedFile", | |
474 Util.normalize(dir + Util.sep + fileName), | |
475 fileName); | |
476 it.next(); | |
477 return; | |
478 } | |
479 } | |
480 empty(null, "** Error: wrong number of args to -additionalGeneratedFile"); | |
481 } | |
482 } | |
483 ), | |
484 | |
485 new ArgRule("-prelink", | |
486 new HsArgHandler() { | |
487 public void handle(ArgIterator it) { | |
488 if (nextNotKey(it)) { | |
489 if (nextNotKey(it)) { | |
490 String description = it.get(); | |
491 if (nextNotKey(it)) { | |
492 String command = it.get(); | |
493 BuildConfig.putField(null, "PrelinkDescription", description); | |
494 BuildConfig.putField(null, "PrelinkCommand", command); | |
495 it.next(); | |
496 return; | |
497 } | |
498 } | |
499 } | |
500 | |
501 empty(null, "** Error: wrong number of args to -prelink"); | |
502 } | |
503 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
504 ), |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
505 |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
506 new ArgRule("-postbuild", |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
507 new HsArgHandler() { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
508 public void handle(ArgIterator it) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
509 if (nextNotKey(it)) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
510 if (nextNotKey(it)) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
511 String description = it.get(); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
512 if (nextNotKey(it)) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
513 String command = it.get(); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
514 BuildConfig.putField(null, "PostbuildDescription", description); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
515 BuildConfig.putField(null, "PostbuildCommand", command); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
516 it.next(); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
517 return; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
518 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
519 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
520 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
521 |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
522 empty(null, "** Error: wrong number of args to -postbuild"); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
523 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
524 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
525 ), |
0 | 526 }, |
527 new ArgHandler() { | |
528 public void handle(ArgIterator it) { | |
529 | |
530 throw new RuntimeException("Arg Parser: unrecognized option "+it.get()); | |
531 } | |
532 } | |
533 ); | |
534 if (BuildConfig.getField(null, "SourceBase") == null || | |
535 BuildConfig.getField(null, "BuildBase") == null || | |
536 BuildConfig.getField(null, "ProjectFileName") == null || | |
537 BuildConfig.getField(null, "CompilerVersion") == null) { | |
538 usage(); | |
539 } | |
540 | |
541 if (BuildConfig.getField(null, "UseToGeneratePch") == null) { | |
542 throw new RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag"); | |
543 } | |
544 | |
545 BuildConfig.putField(null, "PlatformObject", this); | |
546 } | |
547 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
548 Vector createAllConfigs(String platform) { |
0 | 549 Vector allConfigs = new Vector(); |
550 | |
551 allConfigs.add(new C1DebugConfig()); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
552 allConfigs.add(new C1FastDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
553 allConfigs.add(new C1ProductConfig()); |
0 | 554 |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
555 allConfigs.add(new C2DebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
556 allConfigs.add(new C2FastDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
557 allConfigs.add(new C2ProductConfig()); |
0 | 558 |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
559 allConfigs.add(new TieredDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
560 allConfigs.add(new TieredFastDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
561 allConfigs.add(new TieredProductConfig()); |
0 | 562 |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
563 allConfigs.add(new CoreDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
564 allConfigs.add(new CoreFastDebugConfig()); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
565 allConfigs.add(new CoreProductConfig()); |
0 | 566 |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
567 if (platform.equals("Win32")) { |
0 | 568 allConfigs.add(new KernelDebugConfig()); |
569 allConfigs.add(new KernelFastDebugConfig()); | |
570 allConfigs.add(new KernelProductConfig()); | |
571 } | |
572 | |
573 return allConfigs; | |
574 } | |
575 | |
576 PrintWriter printWriter; | |
577 | |
578 public void writeProjectFile(String projectFileName, String projectName, | |
2393 | 579 Vector<BuildConfig> allConfigs) throws IOException { |
0 | 580 throw new RuntimeException("use compiler version specific version"); |
581 } | |
6801 | 582 |
583 int indent; | |
584 private Stack<String> tagStack = new Stack<String>(); | |
585 | |
586 private void startTagPrim(String name, String[] attrs, boolean close) { | |
587 startTagPrim(name, attrs, close, true); | |
588 } | |
589 | |
590 private void startTagPrim(String name, String[] attrs, boolean close, | |
591 boolean newline) { | |
592 doIndent(); | |
593 printWriter.print("<" + name); | |
594 indent++; | |
595 | |
596 if (attrs != null && attrs.length > 0) { | |
597 for (int i = 0; i < attrs.length; i += 2) { | |
598 printWriter.print(" " + attrs[i] + "=\"" + attrs[i + 1] + "\""); | |
599 if (i < attrs.length - 2) { | |
600 } | |
601 } | |
602 } | |
603 | |
604 if (close) { | |
605 indent--; | |
606 printWriter.print(" />"); | |
607 } else { | |
608 // TODO push tag name, and change endTag to pop and print. | |
609 tagStack.push(name); | |
610 printWriter.print(">"); | |
611 } | |
612 if (newline) { | |
613 printWriter.println(); | |
614 } | |
615 } | |
616 | |
617 void startTag(String name, String... attrs) { | |
618 startTagPrim(name, attrs, false); | |
619 } | |
620 | |
621 void startTagV(String name, Vector attrs) { | |
622 String s[] = new String[attrs.size()]; | |
623 for (int i = 0; i < attrs.size(); i++) { | |
624 s[i] = (String) attrs.elementAt(i); | |
625 } | |
626 startTagPrim(name, s, false); | |
627 } | |
628 | |
629 void endTag() { | |
630 String name = tagStack.pop(); | |
631 indent--; | |
632 doIndent(); | |
633 printWriter.println("</" + name + ">"); | |
634 } | |
635 | |
636 private void endTagNoIndent() { | |
637 String name = tagStack.pop(); | |
638 indent--; | |
639 printWriter.println("</" + name + ">"); | |
640 } | |
641 | |
642 void tag(String name, String... attrs) { | |
643 startTagPrim(name, attrs, true); | |
644 } | |
645 | |
646 void tagData(String name, String data) { | |
647 startTagPrim(name, null, false, false); | |
648 printWriter.print(data); | |
649 endTagNoIndent(); | |
650 } | |
651 | |
652 void tagData(String name, String data, String... attrs) { | |
653 startTagPrim(name, attrs, false, false); | |
654 printWriter.print(data); | |
655 endTagNoIndent(); | |
656 } | |
657 | |
658 void tagV(String name, Vector attrs) { | |
659 String s[] = new String[attrs.size()]; | |
660 for (int i = 0; i < attrs.size(); i++) { | |
661 s[i] = (String) attrs.elementAt(i); | |
662 } | |
663 startTagPrim(name, s, true); | |
664 } | |
665 | |
666 void doIndent() { | |
667 for (int i = 0; i < indent; i++) { | |
668 printWriter.print(" "); | |
669 } | |
670 } | |
671 | |
672 | |
0 | 673 } |