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