Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/BuildConfig.java @ 3537:e54641d0d012
Fix IGV to no longer access properties that are not available in the new node structure.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 10 Aug 2011 16:30:51 +0200 |
parents | 2ab52cda08e5 |
children | 344264424174 |
rev | line source |
---|---|
0 | 1 /* |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
2 * Copyright (c) 2005, 2011, 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 | |
25 import java.io.File; | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
26 import java.util.Enumeration; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
27 import java.util.Hashtable; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
28 import java.util.Iterator; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
29 import java.util.Vector; |
0 | 30 |
31 class BuildConfig { | |
32 Hashtable vars; | |
33 Vector basicNames, basicPaths; | |
34 String[] context; | |
35 | |
36 static CompilerInterface ci; | |
37 static CompilerInterface getCI() { | |
38 if (ci == null) { | |
39 String comp = (String)getField(null, "CompilerVersion"); | |
40 try { | |
41 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance(); | |
42 } catch (Exception cnfe) { | |
43 System.err.println("Cannot find support for compiler " + comp); | |
44 throw new RuntimeException(cnfe.toString()); | |
45 } | |
46 } | |
47 return ci; | |
48 } | |
49 | |
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"); | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
66 String outDir = sourceBase + Util.sep + "java"; |
2273 | 67 if (!platformName.equals("Win32")) { |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
68 outDir += "64"; |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
69 } |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
70 if (!build.equals("product")) { |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
71 outDir += Util.sep + "fastdebug"; |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
72 } |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
73 outDir += Util.sep + "jre" + Util.sep + "bin"; |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
74 if (flavour.equals("compiler1")) { |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
75 outDir += Util.sep + "client"; |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
76 } else { |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
77 outDir += Util.sep + "server"; |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
78 } |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
79 buildBase = outDir; |
0 | 80 |
81 put("Id", flavourBuild); | |
82 put("OutputDir", outDir); | |
83 put("SourceBase", sourceBase); | |
84 put("BuildBase", buildBase); | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
85 put("OutputDll", outDir + Util.sep + outDll); |
0 | 86 |
87 context = new String [] {flavourBuild, flavour, build, null}; | |
88 } | |
89 | |
90 protected void init(Vector includes, Vector defines) { | |
91 initDefaultDefines(defines); | |
92 initDefaultCompilerFlags(includes); | |
93 initDefaultLinkerFlags(); | |
1972 | 94 handleDB(); |
0 | 95 } |
96 | |
97 | |
98 protected void initDefaultCompilerFlags(Vector includes) { | |
99 Vector compilerFlags = new Vector(); | |
100 | |
101 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), | |
102 includes, | |
103 get("OutputDir"))); | |
104 | |
105 put("CompilerFlags", compilerFlags); | |
106 } | |
107 | |
108 protected void initDefaultLinkerFlags() { | |
109 Vector linkerFlags = new Vector(); | |
110 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
111 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
0 | 112 |
113 put("LinkerFlags", linkerFlags); | |
114 } | |
115 | |
116 DirectoryTree getSourceTree(String sourceBase, String startAt) { | |
117 DirectoryTree tree = new DirectoryTree(); | |
118 | |
119 tree.addSubdirToIgnore("Codemgr_wsdata"); | |
120 tree.addSubdirToIgnore("deleted_files"); | |
121 tree.addSubdirToIgnore("SCCS"); | |
122 tree.setVerbose(true); | |
123 if (startAt != null) { | |
124 tree.readDirectory(sourceBase + File.separator + startAt); | |
125 } else { | |
126 tree.readDirectory(sourceBase); | |
127 } | |
128 | |
129 return tree; | |
130 } | |
131 | |
132 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
133 Vector getPreferredPaths() { |
0 | 134 Vector preferredPaths = new Vector(); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
135 |
0 | 136 // In the case of multiple files with the same name in |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
137 // different subdirectories, prefer these versions |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
138 preferredPaths.add("windows"); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
139 preferredPaths.add("x86"); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
140 preferredPaths.add("closed"); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
141 |
0 | 142 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp |
143 preferredPaths.add("opto"); | |
144 | |
145 return preferredPaths; | |
146 } | |
147 | |
148 | |
1972 | 149 void handleDB() { |
0 | 150 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); |
151 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
152 putSpecificField("AllFilesHash", computeAllFiles(platform)); |
0 | 153 } |
154 | |
155 | |
1972 | 156 private boolean matchesIgnoredPath(String prefixedName) { |
157 Vector rv = new Vector(); | |
158 collectRelevantVectors(rv, "IgnorePath"); | |
159 for (Iterator i = rv.iterator(); i.hasNext(); ) { | |
160 String pathPart = (String) i.next(); | |
161 if (prefixedName.contains(Util.normalize(pathPart))) { | |
162 return true; | |
163 } | |
164 } | |
165 return false; | |
166 } | |
167 | |
0 | 168 void addAll(Iterator i, Hashtable hash, |
169 WinGammaPlatform platform, DirectoryTree tree, | |
170 Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) { | |
171 for (; i.hasNext(); ) { | |
172 String fileName = (String) i.next(); | |
173 if (lookupHashFieldInContext("IgnoreFile", fileName) == null) { | |
174 String prefixedName = platform.envVarPrefixedFileName(fileName, | |
175 0, /* ignored */ | |
176 tree, | |
177 preferredPaths, | |
178 filesNotFound, | |
179 filesDuplicate); | |
180 if (prefixedName != null) { | |
1972 | 181 prefixedName = Util.normalize(prefixedName); |
182 if (!matchesIgnoredPath(prefixedName)) { | |
183 addTo(hash, prefixedName, fileName); | |
184 } | |
0 | 185 } |
186 } | |
187 } | |
188 } | |
189 | |
190 void addTo(Hashtable ht, String key, String value) { | |
191 ht.put(expandFormat(key), expandFormat(value)); | |
192 } | |
193 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
194 Hashtable computeAllFiles(WinGammaPlatform platform) { |
0 | 195 Hashtable rv = new Hashtable(); |
196 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
197 Vector preferredPaths = getPreferredPaths(); |
0 | 198 |
199 // Hold errors until end | |
200 Vector filesNotFound = new Vector(); | |
201 Vector filesDuplicate = new Vector(); | |
202 | |
1972 | 203 Vector includedFiles = new Vector(); |
0 | 204 |
205 // find all files | |
1972 | 206 Vector dirs = getSourceIncludes(); |
207 for (Iterator i = dirs.iterator(); i.hasNext(); ) { | |
208 String dir = (String)i.next(); | |
209 DirectoryTree subtree = getSourceTree(dir, null); | |
210 for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) { | |
211 String name = ((File)fi.next()).getName(); | |
212 includedFiles.add(name); | |
213 } | |
0 | 214 } |
1972 | 215 addAll(includedFiles.iterator(), rv, |
0 | 216 platform, tree, |
217 preferredPaths, filesNotFound, filesDuplicate); | |
218 | |
219 Vector addFiles = new Vector(); | |
220 collectRelevantVectors(addFiles, "AdditionalFile"); | |
221 addAll(addFiles.iterator(), rv, | |
222 platform, tree, | |
223 preferredPaths, filesNotFound, filesDuplicate); | |
224 | |
225 collectRelevantHashes(rv, "AdditionalGeneratedFile"); | |
226 | |
227 if ((filesNotFound.size() != 0) || | |
228 (filesDuplicate.size() != 0)) { | |
229 System.err.println("Error: some files were not found or " + | |
230 "appeared in multiple subdirectories of " + | |
231 "directory " + get("SourceBase") + " and could not " + | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
232 "be resolved with os_family and arch."); |
0 | 233 if (filesNotFound.size() != 0) { |
234 System.err.println("Files not found:"); | |
235 for (Iterator iter = filesNotFound.iterator(); | |
236 iter.hasNext(); ) { | |
237 System.err.println(" " + (String) iter.next()); | |
238 } | |
239 } | |
240 if (filesDuplicate.size() != 0) { | |
241 System.err.println("Duplicate files:"); | |
242 for (Iterator iter = filesDuplicate.iterator(); | |
243 iter.hasNext(); ) { | |
244 System.err.println(" " + (String) iter.next()); | |
245 } | |
246 } | |
247 throw new RuntimeException(); | |
248 } | |
249 | |
250 return rv; | |
251 } | |
252 | |
253 void initDefaultDefines(Vector defines) { | |
254 Vector sysDefines = new Vector(); | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
255 |
2273 | 256 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
|
257 sysDefines.add("WIN32"); |
1408
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
258 } else { |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
259 sysDefines.add("_AMD64_"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
260 sysDefines.add("AMD64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
261 sysDefines.add("_WIN64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
262 sysDefines.add("_LP64"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
263 if (System.getenv("MSC_VER") != null) |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
264 sysDefines.add("MSC_VER=" + System.getenv("MSC_VER")); |
1408
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
265 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
0ba67bb5392c
added c1x build directory, added MSVC Win64 project support
lstadler
parents:
844
diff
changeset
|
266 } |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
267 |
0 | 268 sysDefines.add("_WINDOWS"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
269 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
0 | 270 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
271 sysDefines.add("_JNI_IMPLEMENTATION_"); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
272 if (vars.get("PlatformName").equals("Win32")) { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
273 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
274 } else { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
275 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
276 } |
0 | 277 |
278 sysDefines.addAll(defines); | |
279 | |
280 put("Define", sysDefines); | |
281 } | |
282 | |
283 String get(String key) { | |
284 return (String)vars.get(key); | |
285 } | |
286 | |
287 Vector getV(String key) { | |
288 return (Vector)vars.get(key); | |
289 } | |
290 | |
291 Object getO(String key) { | |
292 return vars.get(key); | |
293 } | |
294 | |
295 Hashtable getH(String key) { | |
296 return (Hashtable)vars.get(key); | |
297 } | |
298 | |
299 Object getFieldInContext(String field) { | |
300 for (int i=0; i<context.length; i++) { | |
301 Object rv = getField(context[i], field); | |
302 if (rv != null) { | |
303 return rv; | |
304 } | |
305 } | |
306 return null; | |
307 } | |
308 | |
309 Object lookupHashFieldInContext(String field, String key) { | |
310 for (int i=0; i<context.length; i++) { | |
311 Hashtable ht = (Hashtable)getField(context[i], field); | |
312 if (ht != null) { | |
313 Object rv = ht.get(key); | |
314 if (rv != null) { | |
315 return rv; | |
316 } | |
317 } | |
318 } | |
319 return null; | |
320 } | |
321 | |
322 void put(String key, String value) { | |
323 vars.put(key, value); | |
324 } | |
325 | |
326 void put(String key, Vector vvalue) { | |
327 vars.put(key, vvalue); | |
328 } | |
329 | |
330 void add(String key, Vector vvalue) { | |
331 getV(key).addAll(vvalue); | |
332 } | |
333 | |
334 String flavour() { | |
335 return get("Flavour"); | |
336 } | |
337 | |
338 String build() { | |
339 return get("Build"); | |
340 } | |
341 | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
342 String outputDir() { |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
343 return get("OutputDir"); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
344 } |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
345 |
0 | 346 Object getSpecificField(String field) { |
347 return getField(get("Id"), field); | |
348 } | |
349 | |
350 void putSpecificField(String field, Object value) { | |
351 putField(get("Id"), field, value); | |
352 } | |
353 | |
354 void collectRelevantVectors(Vector rv, String field) { | |
355 for (int i = 0; i < context.length; i++) { | |
356 Vector v = getFieldVector(context[i], field); | |
357 if (v != null) { | |
358 for (Iterator j=v.iterator(); j.hasNext(); ) { | |
359 String val = (String)j.next(); | |
360 rv.add(expandFormat(val)); | |
361 } | |
362 } | |
363 } | |
364 } | |
365 | |
366 void collectRelevantHashes(Hashtable rv, String field) { | |
367 for (int i = 0; i < context.length; i++) { | |
368 Hashtable v = (Hashtable)getField(context[i], field); | |
369 if (v != null) { | |
370 for (Enumeration e=v.keys(); e.hasMoreElements(); ) { | |
371 String key = (String)e.nextElement(); | |
372 String val = (String)v.get(key); | |
373 addTo(rv, key, val); | |
374 } | |
375 } | |
376 } | |
377 } | |
378 | |
379 | |
380 Vector getDefines() { | |
381 Vector rv = new Vector(); | |
382 collectRelevantVectors(rv, "Define"); | |
383 return rv; | |
384 } | |
385 | |
386 Vector getIncludes() { | |
387 Vector rv = new Vector(); | |
388 | |
389 collectRelevantVectors(rv, "AbsoluteInclude"); | |
390 | |
1972 | 391 rv.addAll(getSourceIncludes()); |
392 | |
393 return rv; | |
394 } | |
395 | |
396 private Vector getSourceIncludes() { | |
397 Vector rv = new Vector(); | |
0 | 398 Vector ri = new Vector(); |
399 String sourceBase = getFieldString(null, "SourceBase"); | |
400 collectRelevantVectors(ri, "RelativeInclude"); | |
401 for (Iterator i = ri.iterator(); i.hasNext(); ) { | |
402 String f = (String)i.next(); | |
403 rv.add(sourceBase + Util.sep + f); | |
404 } | |
405 return rv; | |
406 } | |
407 | |
408 static Hashtable cfgData = new Hashtable(); | |
409 static Hashtable globalData = new Hashtable(); | |
410 | |
411 static boolean appliesToTieredBuild(String cfg) { | |
412 return (cfg != null && | |
413 (cfg.startsWith("compiler1") || | |
414 cfg.startsWith("compiler2"))); | |
415 } | |
416 | |
1972 | 417 // Filters out the IgnoreFile and IgnorePaths since they are |
418 // handled specially for tiered builds. | |
0 | 419 static boolean appliesToTieredBuild(String cfg, String key) { |
1972 | 420 return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore")); |
0 | 421 } |
422 | |
423 static String getTieredBuildCfg(String cfg) { | |
424 assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; | |
425 return "tiered" + cfg.substring(9); | |
426 } | |
427 | |
428 static Object getField(String cfg, String field) { | |
429 if (cfg == null) { | |
430 return globalData.get(field); | |
431 } | |
432 | |
433 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
434 return ht == null ? null : ht.get(field); | |
435 } | |
436 | |
437 static String getFieldString(String cfg, String field) { | |
438 return (String)getField(cfg, field); | |
439 } | |
440 | |
441 static Vector getFieldVector(String cfg, String field) { | |
442 return (Vector)getField(cfg, field); | |
443 } | |
444 | |
445 static void putField(String cfg, String field, Object value) { | |
446 putFieldImpl(cfg, field, value); | |
447 if (appliesToTieredBuild(cfg, field)) { | |
448 putFieldImpl(getTieredBuildCfg(cfg), field, value); | |
449 } | |
450 } | |
451 | |
452 private static void putFieldImpl(String cfg, String field, Object value) { | |
453 if (cfg == null) { | |
454 globalData.put(field, value); | |
455 return; | |
456 } | |
457 | |
458 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
459 if (ht == null) { | |
460 ht = new Hashtable(); | |
461 cfgData.put(cfg, ht); | |
462 } | |
463 | |
464 ht.put(field, value); | |
465 } | |
466 | |
467 static Object getFieldHash(String cfg, String field, String name) { | |
468 Hashtable ht = (Hashtable)getField(cfg, field); | |
469 | |
470 return ht == null ? null : ht.get(name); | |
471 } | |
472 | |
473 static void putFieldHash(String cfg, String field, String name, Object val) { | |
474 putFieldHashImpl(cfg, field, name, val); | |
1972 | 475 if (appliesToTieredBuild(cfg, field)) { |
0 | 476 putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); |
477 } | |
478 } | |
479 | |
480 private static void putFieldHashImpl(String cfg, String field, String name, Object val) { | |
481 Hashtable ht = (Hashtable)getField(cfg, field); | |
482 | |
483 if (ht == null) { | |
484 ht = new Hashtable(); | |
485 putFieldImpl(cfg, field, ht); | |
486 } | |
487 | |
488 ht.put(name, val); | |
489 } | |
490 | |
491 static void addFieldVector(String cfg, String field, String element) { | |
492 addFieldVectorImpl(cfg, field, element); | |
1972 | 493 if (appliesToTieredBuild(cfg, field)) { |
0 | 494 addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); |
495 } | |
496 } | |
497 | |
498 private static void addFieldVectorImpl(String cfg, String field, String element) { | |
499 Vector v = (Vector)getField(cfg, field); | |
500 | |
501 if (v == null) { | |
502 v = new Vector(); | |
503 putFieldImpl(cfg, field, v); | |
504 } | |
505 | |
506 v.add(element); | |
507 } | |
508 | |
509 String expandFormat(String format) { | |
510 if (format == null) { | |
511 return null; | |
512 } | |
513 | |
514 if (format.indexOf('%') == -1) { | |
515 return format; | |
516 } | |
517 | |
518 StringBuffer sb = new StringBuffer(); | |
519 int len = format.length(); | |
520 for (int i=0; i<len; i++) { | |
521 char ch = format.charAt(i); | |
522 if (ch == '%') { | |
523 char ch1 = format.charAt(i+1); | |
524 switch (ch1) { | |
525 case '%': | |
526 sb.append(ch1); | |
527 break; | |
528 case 'b': | |
529 sb.append(build()); | |
530 break; | |
531 case 'f': | |
532 sb.append(flavour()); | |
533 break; | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
534 case 'o': |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
535 sb.append(outputDir()); |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2044
diff
changeset
|
536 break; |
0 | 537 default: |
538 sb.append(ch); | |
539 sb.append(ch1); | |
540 } | |
541 i++; | |
542 } else { | |
543 sb.append(ch); | |
544 } | |
545 } | |
546 | |
547 return sb.toString(); | |
548 } | |
549 } | |
550 | |
551 abstract class GenericDebugConfig extends BuildConfig { | |
552 abstract String getOptFlag(); | |
553 | |
554 protected void init(Vector includes, Vector defines) { | |
555 defines.add("_DEBUG"); | |
556 defines.add("ASSERT"); | |
557 | |
558 super.init(includes, defines); | |
559 | |
560 getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag())); | |
561 getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags()); | |
562 } | |
563 } | |
564 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
565 abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
566 protected void init(Vector includes, Vector defines) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
567 super.init(includes, defines); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
568 getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
569 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
570 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
571 |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
572 class C1DebugConfig extends GenericDebugNonKernelConfig { |
0 | 573 String getOptFlag() { |
574 return getCI().getNoOptFlag(); | |
575 } | |
576 | |
577 C1DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
578 initNames("compiler1", "debug", "jvm.dll"); |
0 | 579 init(getIncludes(), getDefines()); |
580 } | |
581 } | |
582 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
583 class C1FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 584 String getOptFlag() { |
585 return getCI().getOptFlag(); | |
586 } | |
587 | |
588 C1FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
589 initNames("compiler1", "fastdebug", "jvm.dll"); |
0 | 590 init(getIncludes(), getDefines()); |
591 } | |
592 } | |
593 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
594 class C2DebugConfig extends GenericDebugNonKernelConfig { |
0 | 595 String getOptFlag() { |
596 return getCI().getNoOptFlag(); | |
597 } | |
598 | |
599 C2DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
600 initNames("compiler2", "debug", "jvm.dll"); |
0 | 601 init(getIncludes(), getDefines()); |
602 } | |
603 } | |
604 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
605 class C2FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 606 String getOptFlag() { |
607 return getCI().getOptFlag(); | |
608 } | |
609 | |
610 C2FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
611 initNames("compiler2", "fastdebug", "jvm.dll"); |
0 | 612 init(getIncludes(), getDefines()); |
613 } | |
614 } | |
615 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
616 class TieredDebugConfig extends GenericDebugNonKernelConfig { |
0 | 617 String getOptFlag() { |
618 return getCI().getNoOptFlag(); | |
619 } | |
620 | |
621 TieredDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
622 initNames("tiered", "debug", "jvm.dll"); |
0 | 623 init(getIncludes(), getDefines()); |
624 } | |
625 } | |
626 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
627 class TieredFastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 628 String getOptFlag() { |
629 return getCI().getOptFlag(); | |
630 } | |
631 | |
632 TieredFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
633 initNames("tiered", "fastdebug", "jvm.dll"); |
0 | 634 init(getIncludes(), getDefines()); |
635 } | |
636 } | |
637 | |
638 | |
639 abstract class ProductConfig extends BuildConfig { | |
640 protected void init(Vector includes, Vector defines) { | |
641 defines.add("NDEBUG"); | |
642 defines.add("PRODUCT"); | |
643 | |
644 super.init(includes, defines); | |
645 | |
646 getV("CompilerFlags").addAll(getCI().getProductCompilerFlags()); | |
647 getV("LinkerFlags").addAll(getCI().getProductLinkerFlags()); | |
648 } | |
649 } | |
650 | |
651 class C1ProductConfig extends ProductConfig { | |
652 C1ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
653 initNames("compiler1", "product", "jvm.dll"); |
0 | 654 init(getIncludes(), getDefines()); |
655 } | |
656 } | |
657 | |
658 class C2ProductConfig extends ProductConfig { | |
659 C2ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
660 initNames("compiler2", "product", "jvm.dll"); |
0 | 661 init(getIncludes(), getDefines()); |
662 } | |
663 } | |
664 | |
665 class TieredProductConfig extends ProductConfig { | |
666 TieredProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
667 initNames("tiered", "product", "jvm.dll"); |
0 | 668 init(getIncludes(), getDefines()); |
669 } | |
670 } | |
671 | |
672 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
673 class CoreDebugConfig extends GenericDebugNonKernelConfig { |
0 | 674 String getOptFlag() { |
675 return getCI().getNoOptFlag(); | |
676 } | |
677 | |
678 CoreDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
679 initNames("core", "debug", "jvm.dll"); |
0 | 680 init(getIncludes(), getDefines()); |
681 } | |
682 } | |
683 | |
684 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
685 class CoreFastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 686 String getOptFlag() { |
687 return getCI().getOptFlag(); | |
688 } | |
689 | |
690 CoreFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
691 initNames("core", "fastdebug", "jvm.dll"); |
0 | 692 init(getIncludes(), getDefines()); |
693 } | |
694 } | |
695 | |
696 | |
697 class CoreProductConfig extends ProductConfig { | |
698 CoreProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
699 initNames("core", "product", "jvm.dll"); |
0 | 700 init(getIncludes(), getDefines()); |
701 } | |
702 } | |
703 | |
704 class KernelDebugConfig extends GenericDebugConfig { | |
705 String getOptFlag() { | |
706 return getCI().getNoOptFlag(); | |
707 } | |
708 | |
709 KernelDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
710 initNames("kernel", "debug", "jvm.dll"); |
0 | 711 init(getIncludes(), getDefines()); |
712 } | |
713 } | |
714 | |
715 | |
716 class KernelFastDebugConfig extends GenericDebugConfig { | |
717 String getOptFlag() { | |
718 return getCI().getOptFlag(); | |
719 } | |
720 | |
721 KernelFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
722 initNames("kernel", "fastdebug", "jvm.dll"); |
0 | 723 init(getIncludes(), getDefines()); |
724 } | |
725 } | |
726 | |
727 | |
728 class KernelProductConfig extends ProductConfig { | |
729 KernelProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
730 initNames("kernel", "product", "jvm.dll"); |
0 | 731 init(getIncludes(), getDefines()); |
732 } | |
733 } | |
734 abstract class CompilerInterface { | |
735 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
|
736 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
0 | 737 abstract Vector getDebugCompilerFlags(String opt); |
738 abstract Vector getDebugLinkerFlags(); | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
739 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
0 | 740 abstract Vector getProductCompilerFlags(); |
741 abstract Vector getProductLinkerFlags(); | |
742 abstract String getOptFlag(); | |
743 abstract String getNoOptFlag(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
744 abstract String makeCfgName(String flavourBuild, String platformName); |
0 | 745 |
746 void addAttr(Vector receiver, String attr, String value) { | |
747 receiver.add(attr); receiver.add(value); | |
748 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
749 void extAttr(Vector receiver, String attr, String value) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
750 int attr_pos=receiver.indexOf(attr) ; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
751 if ( attr_pos == -1) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
752 // 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
|
753 receiver.add(attr); receiver.add(value); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
754 } else { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
755 // 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
|
756 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
|
757 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
758 } |
0 | 759 } |