Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/BuildConfig.java @ 9691:bd5c6b3dedc5
implement inlining support for JSR 292
author | twisti |
---|---|
date | Tue, 14 May 2013 11:27:09 -0700 |
parents | b9a918201d47 |
children | 836a62f43af9 |
rev | line source |
---|---|
0 | 1 /* |
4878
2eeebe4b4213
7140909: Visual Studio project builds broken: need to define INCLUDE_TRACE
brutisso
parents:
2233
diff
changeset
|
2 * Copyright (c) 2005, 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:
844
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
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:
844
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.util.Enumeration; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
26 import java.util.Hashtable; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
27 import java.util.Vector; |
0 | 28 |
29 class BuildConfig { | |
6801 | 30 @SuppressWarnings("rawtypes") |
0 | 31 Hashtable vars; |
6801 | 32 Vector<String> basicNames, basicPaths; |
0 | 33 String[] context; |
34 | |
35 static CompilerInterface ci; | |
36 static CompilerInterface getCI() { | |
37 if (ci == null) { | |
38 String comp = (String)getField(null, "CompilerVersion"); | |
39 try { | |
40 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance(); | |
41 } catch (Exception cnfe) { | |
42 System.err.println("Cannot find support for compiler " + comp); | |
43 throw new RuntimeException(cnfe.toString()); | |
44 } | |
45 } | |
46 return ci; | |
47 } | |
48 | |
6801 | 49 @SuppressWarnings("rawtypes") |
0 | 50 protected void initNames(String flavour, String build, String outDll) { |
51 if (vars == null) vars = new Hashtable(); | |
52 | |
53 String flavourBuild = flavour + "_" + build; | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
54 String platformName = getFieldString(null, "PlatformName"); |
1972 | 55 System.out.println(); |
56 System.out.println(flavourBuild); | |
57 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
58 put("Name", getCI().makeCfgName(flavourBuild, platformName)); |
0 | 59 put("Flavour", flavour); |
60 put("Build", build); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
61 put("PlatformName", platformName); |
0 | 62 |
63 // ones mentioned above were needed to expand format | |
64 String buildBase = expandFormat(getFieldString(null, "BuildBase")); | |
65 String sourceBase = getFieldString(null, "SourceBase"); | |
6801 | 66 String buildSpace = getFieldString(null, "BuildSpace"); |
0 | 67 String outDir = buildBase; |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
68 String value = System.getenv("OUT_DIR"); |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
69 if (value != null) { |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
70 outDir = value; |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
71 } |
4597
8bc6f680a88d
fixed visual studio project files
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4572
diff
changeset
|
72 |
8bc6f680a88d
fixed visual studio project files
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4572
diff
changeset
|
73 int lastDirectorySeparator = Math.max(outDir.lastIndexOf("/"), outDir.lastIndexOf("\\")); |
8bc6f680a88d
fixed visual studio project files
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4572
diff
changeset
|
74 if (lastDirectorySeparator >= 0) { |
8bc6f680a88d
fixed visual studio project files
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4572
diff
changeset
|
75 outDir = outDir.substring(0, lastDirectorySeparator); |
4475
f400f9554f09
fixed windows build, filtered methodDataOop for reflection
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4474
diff
changeset
|
76 } |
f400f9554f09
fixed windows build, filtered methodDataOop for reflection
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4474
diff
changeset
|
77 |
4634
0f899c0b7e86
fixed VS project files
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4597
diff
changeset
|
78 outDir += Util.sep + build + Util.sep + "jre" + Util.sep + "bin"; |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
79 if (flavour.equals("graal")) { |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
80 outDir += Util.sep + "graal"; |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
81 } else if (flavour.equals("compiler1")) { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
82 outDir += Util.sep + "client"; |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
83 } else { |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
84 outDir += Util.sep + "server"; |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
85 } |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3543
diff
changeset
|
86 buildBase = outDir; |
0 | 87 |
88 put("Id", flavourBuild); | |
89 put("OutputDir", outDir); | |
90 put("SourceBase", sourceBase); | |
91 put("BuildBase", buildBase); | |
6801 | 92 put("BuildSpace", buildSpace); |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
93 put("OutputDll", outDir + Util.sep + outDll); |
0 | 94 |
95 context = new String [] {flavourBuild, flavour, build, null}; | |
96 } | |
97 | |
6801 | 98 protected void init(Vector<String> includes, Vector<String> defines) { |
0 | 99 initDefaultDefines(defines); |
100 initDefaultCompilerFlags(includes); | |
101 initDefaultLinkerFlags(); | |
6801 | 102 //handleDB(); |
0 | 103 } |
104 | |
105 | |
6801 | 106 protected void initDefaultCompilerFlags(Vector<String> includes) { |
0 | 107 Vector compilerFlags = new Vector(); |
108 | |
109 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), | |
110 includes, | |
111 get("OutputDir"))); | |
112 | |
113 put("CompilerFlags", compilerFlags); | |
114 } | |
115 | |
116 protected void initDefaultLinkerFlags() { | |
117 Vector linkerFlags = new Vector(); | |
118 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
119 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
0 | 120 |
121 put("LinkerFlags", linkerFlags); | |
122 } | |
123 | |
6801 | 124 public boolean matchesIgnoredPath(String path) { |
125 Vector<String> rv = new Vector<String>(); | |
1972 | 126 collectRelevantVectors(rv, "IgnorePath"); |
6801 | 127 for (String pathPart : rv) { |
128 if (path.contains(pathPart)) { | |
1972 | 129 return true; |
130 } | |
131 } | |
132 return false; | |
133 } | |
134 | |
6801 | 135 public boolean matchesHidePath(String path) { |
136 Vector<String> rv = new Vector<String>(); | |
137 collectRelevantVectors(rv, "HidePath"); | |
138 for (String pathPart : rv) { | |
139 if (path.contains(Util.normalize(pathPart))) { | |
140 return true; | |
141 } | |
142 } | |
143 return false; | |
144 } | |
145 | |
146 public Vector<String> matchesAdditionalGeneratedPath(String fullPath) { | |
147 Vector<String> rv = new Vector<String>(); | |
148 Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile"); | |
149 if (v != null) { | |
150 for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) { | |
151 String key = e.nextElement(); | |
152 String val = v.get(key); | |
153 | |
154 if (fullPath.endsWith(expandFormat(key))) { | |
155 rv.add(expandFormat(val)); | |
0 | 156 } |
157 } | |
158 } | |
6801 | 159 return rv; |
0 | 160 } |
161 | |
162 void addTo(Hashtable ht, String key, String value) { | |
163 ht.put(expandFormat(key), expandFormat(value)); | |
164 } | |
165 | |
166 void initDefaultDefines(Vector defines) { | |
167 Vector sysDefines = new Vector(); | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
168 |
2273 | 169 if( vars.get("PlatformName").equals("Win32")) { |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
170 sysDefines.add("WIN32"); |
1408
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
171 } else { |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
172 sysDefines.add("_AMD64_"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
173 sysDefines.add("AMD64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
174 sysDefines.add("_WIN64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
175 sysDefines.add("_LP64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
176 if (System.getenv("MSC_VER") != null) |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
177 sysDefines.add("MSC_VER=" + System.getenv("MSC_VER")); |
1408
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
178 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
179 } |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
180 |
0 | 181 sysDefines.add("_WINDOWS"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
182 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
0 | 183 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
4878
2eeebe4b4213
7140909: Visual Studio project builds broken: need to define INCLUDE_TRACE
brutisso
parents:
2233
diff
changeset
|
184 sysDefines.add("INCLUDE_TRACE"); |
0 | 185 sysDefines.add("_JNI_IMPLEMENTATION_"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
186 if (vars.get("PlatformName").equals("Win32")) { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
187 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
188 } else { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
189 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
190 } |
0 | 191 |
192 sysDefines.addAll(defines); | |
193 | |
194 put("Define", sysDefines); | |
195 } | |
196 | |
197 String get(String key) { | |
198 return (String)vars.get(key); | |
199 } | |
200 | |
201 Vector getV(String key) { | |
202 return (Vector)vars.get(key); | |
203 } | |
204 | |
205 Object getO(String key) { | |
206 return vars.get(key); | |
207 } | |
208 | |
209 Hashtable getH(String key) { | |
210 return (Hashtable)vars.get(key); | |
211 } | |
212 | |
213 Object getFieldInContext(String field) { | |
214 for (int i=0; i<context.length; i++) { | |
215 Object rv = getField(context[i], field); | |
216 if (rv != null) { | |
217 return rv; | |
218 } | |
219 } | |
220 return null; | |
221 } | |
222 | |
223 Object lookupHashFieldInContext(String field, String key) { | |
224 for (int i=0; i<context.length; i++) { | |
225 Hashtable ht = (Hashtable)getField(context[i], field); | |
226 if (ht != null) { | |
227 Object rv = ht.get(key); | |
228 if (rv != null) { | |
229 return rv; | |
230 } | |
231 } | |
232 } | |
233 return null; | |
234 } | |
235 | |
236 void put(String key, String value) { | |
237 vars.put(key, value); | |
238 } | |
239 | |
240 void put(String key, Vector vvalue) { | |
241 vars.put(key, vvalue); | |
242 } | |
243 | |
244 void add(String key, Vector vvalue) { | |
245 getV(key).addAll(vvalue); | |
246 } | |
247 | |
248 String flavour() { | |
249 return get("Flavour"); | |
250 } | |
251 | |
252 String build() { | |
253 return get("Build"); | |
254 } | |
255 | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
256 String outputDir() { |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
257 return get("OutputDir"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
258 } |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
259 |
0 | 260 Object getSpecificField(String field) { |
261 return getField(get("Id"), field); | |
262 } | |
263 | |
264 void putSpecificField(String field, Object value) { | |
265 putField(get("Id"), field, value); | |
266 } | |
267 | |
268 void collectRelevantVectors(Vector rv, String field) { | |
6801 | 269 for (String ctx : context) { |
270 Vector<String> v = getFieldVector(ctx, field); | |
0 | 271 if (v != null) { |
6801 | 272 for (String val : v) { |
273 rv.add(expandFormat(val).replace('/', '\\')); | |
0 | 274 } |
275 } | |
276 } | |
277 } | |
278 | |
279 void collectRelevantHashes(Hashtable rv, String field) { | |
6801 | 280 for (String ctx : context) { |
281 Hashtable v = (Hashtable)getField(ctx, field); | |
0 | 282 if (v != null) { |
283 for (Enumeration e=v.keys(); e.hasMoreElements(); ) { | |
284 String key = (String)e.nextElement(); | |
285 String val = (String)v.get(key); | |
286 addTo(rv, key, val); | |
287 } | |
288 } | |
289 } | |
290 } | |
291 | |
292 | |
293 Vector getDefines() { | |
294 Vector rv = new Vector(); | |
295 collectRelevantVectors(rv, "Define"); | |
296 return rv; | |
297 } | |
298 | |
299 Vector getIncludes() { | |
300 Vector rv = new Vector(); | |
301 collectRelevantVectors(rv, "AbsoluteInclude"); | |
1972 | 302 rv.addAll(getSourceIncludes()); |
303 return rv; | |
304 } | |
305 | |
306 private Vector getSourceIncludes() { | |
6801 | 307 Vector<String> rv = new Vector<String>(); |
308 Vector<String> ri = new Vector<String>(); | |
0 | 309 String sourceBase = getFieldString(null, "SourceBase"); |
310 collectRelevantVectors(ri, "RelativeInclude"); | |
6801 | 311 for (String f : ri) { |
0 | 312 rv.add(sourceBase + Util.sep + f); |
313 } | |
314 return rv; | |
315 } | |
316 | |
317 static Hashtable cfgData = new Hashtable(); | |
318 static Hashtable globalData = new Hashtable(); | |
319 | |
320 static boolean appliesToTieredBuild(String cfg) { | |
321 return (cfg != null && | |
322 (cfg.startsWith("compiler1") || | |
323 cfg.startsWith("compiler2"))); | |
324 } | |
325 | |
1972 | 326 // Filters out the IgnoreFile and IgnorePaths since they are |
327 // handled specially for tiered builds. | |
0 | 328 static boolean appliesToTieredBuild(String cfg, String key) { |
1972 | 329 return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore")); |
0 | 330 } |
331 | |
332 static String getTieredBuildCfg(String cfg) { | |
333 assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; | |
334 return "tiered" + cfg.substring(9); | |
335 } | |
336 | |
337 static Object getField(String cfg, String field) { | |
338 if (cfg == null) { | |
339 return globalData.get(field); | |
340 } | |
341 | |
342 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
343 return ht == null ? null : ht.get(field); | |
344 } | |
345 | |
346 static String getFieldString(String cfg, String field) { | |
347 return (String)getField(cfg, field); | |
348 } | |
349 | |
350 static Vector getFieldVector(String cfg, String field) { | |
351 return (Vector)getField(cfg, field); | |
352 } | |
353 | |
354 static void putField(String cfg, String field, Object value) { | |
355 putFieldImpl(cfg, field, value); | |
356 if (appliesToTieredBuild(cfg, field)) { | |
357 putFieldImpl(getTieredBuildCfg(cfg), field, value); | |
358 } | |
359 } | |
360 | |
361 private static void putFieldImpl(String cfg, String field, Object value) { | |
362 if (cfg == null) { | |
363 globalData.put(field, value); | |
364 return; | |
365 } | |
366 | |
367 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
368 if (ht == null) { | |
369 ht = new Hashtable(); | |
370 cfgData.put(cfg, ht); | |
371 } | |
372 | |
373 ht.put(field, value); | |
374 } | |
375 | |
376 static Object getFieldHash(String cfg, String field, String name) { | |
377 Hashtable ht = (Hashtable)getField(cfg, field); | |
378 | |
379 return ht == null ? null : ht.get(name); | |
380 } | |
381 | |
382 static void putFieldHash(String cfg, String field, String name, Object val) { | |
383 putFieldHashImpl(cfg, field, name, val); | |
1972 | 384 if (appliesToTieredBuild(cfg, field)) { |
0 | 385 putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); |
386 } | |
387 } | |
388 | |
389 private static void putFieldHashImpl(String cfg, String field, String name, Object val) { | |
390 Hashtable ht = (Hashtable)getField(cfg, field); | |
391 | |
392 if (ht == null) { | |
393 ht = new Hashtable(); | |
394 putFieldImpl(cfg, field, ht); | |
395 } | |
396 | |
397 ht.put(name, val); | |
398 } | |
399 | |
400 static void addFieldVector(String cfg, String field, String element) { | |
401 addFieldVectorImpl(cfg, field, element); | |
1972 | 402 if (appliesToTieredBuild(cfg, field)) { |
0 | 403 addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); |
404 } | |
405 } | |
406 | |
407 private static void addFieldVectorImpl(String cfg, String field, String element) { | |
408 Vector v = (Vector)getField(cfg, field); | |
409 | |
410 if (v == null) { | |
411 v = new Vector(); | |
412 putFieldImpl(cfg, field, v); | |
413 } | |
414 | |
415 v.add(element); | |
416 } | |
417 | |
418 String expandFormat(String format) { | |
419 if (format == null) { | |
420 return null; | |
421 } | |
422 | |
423 if (format.indexOf('%') == -1) { | |
424 return format; | |
425 } | |
426 | |
427 StringBuffer sb = new StringBuffer(); | |
428 int len = format.length(); | |
429 for (int i=0; i<len; i++) { | |
430 char ch = format.charAt(i); | |
431 if (ch == '%') { | |
432 char ch1 = format.charAt(i+1); | |
433 switch (ch1) { | |
434 case '%': | |
435 sb.append(ch1); | |
436 break; | |
437 case 'b': | |
438 sb.append(build()); | |
439 break; | |
440 case 'f': | |
441 sb.append(flavour()); | |
442 break; | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
443 case 'o': |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
444 sb.append(outputDir()); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
445 break; |
0 | 446 default: |
447 sb.append(ch); | |
448 sb.append(ch1); | |
449 } | |
450 i++; | |
451 } else { | |
452 sb.append(ch); | |
453 } | |
454 } | |
455 | |
456 return sb.toString(); | |
457 } | |
458 } | |
459 | |
460 abstract class GenericDebugConfig extends BuildConfig { | |
461 abstract String getOptFlag(); | |
462 | |
463 protected void init(Vector includes, Vector defines) { | |
464 defines.add("_DEBUG"); | |
465 defines.add("ASSERT"); | |
466 | |
467 super.init(includes, defines); | |
468 | |
469 getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag())); | |
470 getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags()); | |
471 } | |
472 } | |
473 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
474 abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
475 protected void init(Vector includes, Vector defines) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
476 super.init(includes, defines); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
477 getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
478 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
479 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
480 |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
481 class GraalDebugConfig extends GenericDebugNonKernelConfig { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
482 String getOptFlag() { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
483 return getCI().getNoOptFlag(); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
484 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
485 |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
486 GraalDebugConfig() { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
487 initNames("graal", "debug", "jvm.dll"); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
488 init(getIncludes(), getDefines()); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
489 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
490 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
491 |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
492 class GraalFastDebugConfig extends GenericDebugNonKernelConfig { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
493 String getOptFlag() { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
494 return getCI().getOptFlag(); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
495 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
496 |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
497 GraalFastDebugConfig() { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
498 initNames("graal", "fastdebug", "jvm.dll"); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
499 init(getIncludes(), getDefines()); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
500 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
501 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
502 |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
503 class C1DebugConfig extends GenericDebugNonKernelConfig { |
0 | 504 String getOptFlag() { |
505 return getCI().getNoOptFlag(); | |
506 } | |
507 | |
508 C1DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
509 initNames("compiler1", "debug", "jvm.dll"); |
0 | 510 init(getIncludes(), getDefines()); |
511 } | |
512 } | |
513 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
514 class C1FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 515 String getOptFlag() { |
516 return getCI().getOptFlag(); | |
517 } | |
518 | |
519 C1FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
520 initNames("compiler1", "fastdebug", "jvm.dll"); |
0 | 521 init(getIncludes(), getDefines()); |
522 } | |
523 } | |
524 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
525 class C2DebugConfig extends GenericDebugNonKernelConfig { |
0 | 526 String getOptFlag() { |
527 return getCI().getNoOptFlag(); | |
528 } | |
529 | |
530 C2DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
531 initNames("compiler2", "debug", "jvm.dll"); |
0 | 532 init(getIncludes(), getDefines()); |
533 } | |
534 } | |
535 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
536 class C2FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 537 String getOptFlag() { |
538 return getCI().getOptFlag(); | |
539 } | |
540 | |
541 C2FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
542 initNames("compiler2", "fastdebug", "jvm.dll"); |
0 | 543 init(getIncludes(), getDefines()); |
544 } | |
545 } | |
546 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
547 class TieredDebugConfig extends GenericDebugNonKernelConfig { |
0 | 548 String getOptFlag() { |
549 return getCI().getNoOptFlag(); | |
550 } | |
551 | |
552 TieredDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
553 initNames("tiered", "debug", "jvm.dll"); |
0 | 554 init(getIncludes(), getDefines()); |
555 } | |
556 } | |
557 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
558 class TieredFastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 559 String getOptFlag() { |
560 return getCI().getOptFlag(); | |
561 } | |
562 | |
563 TieredFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
564 initNames("tiered", "fastdebug", "jvm.dll"); |
0 | 565 init(getIncludes(), getDefines()); |
566 } | |
567 } | |
568 | |
569 abstract class ProductConfig extends BuildConfig { | |
570 protected void init(Vector includes, Vector defines) { | |
571 defines.add("NDEBUG"); | |
572 defines.add("PRODUCT"); | |
573 | |
574 super.init(includes, defines); | |
575 | |
576 getV("CompilerFlags").addAll(getCI().getProductCompilerFlags()); | |
577 getV("LinkerFlags").addAll(getCI().getProductLinkerFlags()); | |
578 } | |
579 } | |
580 | |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
581 class GraalProductConfig extends ProductConfig { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
582 GraalProductConfig() { |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
583 initNames("graal", "product", "jvm.dll"); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
584 init(getIncludes(), getDefines()); |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
585 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
586 } |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
587 |
0 | 588 class C1ProductConfig extends ProductConfig { |
589 C1ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
590 initNames("compiler1", "product", "jvm.dll"); |
0 | 591 init(getIncludes(), getDefines()); |
592 } | |
593 } | |
594 | |
595 class C2ProductConfig extends ProductConfig { | |
596 C2ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
597 initNames("compiler2", "product", "jvm.dll"); |
0 | 598 init(getIncludes(), getDefines()); |
599 } | |
600 } | |
601 | |
602 class TieredProductConfig extends ProductConfig { | |
603 TieredProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
604 initNames("tiered", "product", "jvm.dll"); |
0 | 605 init(getIncludes(), getDefines()); |
606 } | |
607 } | |
608 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
609 class CoreDebugConfig extends GenericDebugNonKernelConfig { |
0 | 610 String getOptFlag() { |
611 return getCI().getNoOptFlag(); | |
612 } | |
613 | |
614 CoreDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
615 initNames("core", "debug", "jvm.dll"); |
0 | 616 init(getIncludes(), getDefines()); |
617 } | |
618 } | |
619 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
620 class CoreFastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 621 String getOptFlag() { |
622 return getCI().getOptFlag(); | |
623 } | |
624 | |
625 CoreFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
626 initNames("core", "fastdebug", "jvm.dll"); |
0 | 627 init(getIncludes(), getDefines()); |
628 } | |
629 } | |
630 | |
631 class CoreProductConfig extends ProductConfig { | |
632 CoreProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
633 initNames("core", "product", "jvm.dll"); |
0 | 634 init(getIncludes(), getDefines()); |
635 } | |
636 } | |
637 | |
6801 | 638 |
0 | 639 abstract class CompilerInterface { |
640 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
641 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
0 | 642 abstract Vector getDebugCompilerFlags(String opt); |
643 abstract Vector getDebugLinkerFlags(); | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
644 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
0 | 645 abstract Vector getProductCompilerFlags(); |
646 abstract Vector getProductLinkerFlags(); | |
647 abstract String getOptFlag(); | |
648 abstract String getNoOptFlag(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
649 abstract String makeCfgName(String flavourBuild, String platformName); |
0 | 650 |
651 void addAttr(Vector receiver, String attr, String value) { | |
652 receiver.add(attr); receiver.add(value); | |
653 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
654 void extAttr(Vector receiver, String attr, String value) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
655 int attr_pos=receiver.indexOf(attr) ; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
656 if ( attr_pos == -1) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
657 // If attr IS NOT present in the Vector - add it |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
658 receiver.add(attr); receiver.add(value); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
659 } else { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
660 // If attr IS present in the Vector - append value to it |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
661 receiver.set(attr_pos+1,receiver.get(attr_pos+1)+value); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
662 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
663 } |
0 | 664 } |