Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/BuildConfig.java @ 20710:c5e86c5cd22e
8066964: ppc64: argument and return type profiling, fix problem with popframe
Reviewed-by: roland, kvn
author | goetz |
---|---|
date | Fri, 12 Dec 2014 08:48:56 +0100 |
parents | 31f3b1e1c5e5 |
children | 3cce976666d9 |
rev | line source |
---|---|
0 | 1 /* |
10405 | 2 * Copyright (c) 2005, 2013, 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; |
10277 | 68 String jdkTargetRoot = getFieldString(null, "JdkTargetRoot"); |
0 | 69 |
70 put("Id", flavourBuild); | |
71 put("OutputDir", outDir); | |
72 put("SourceBase", sourceBase); | |
73 put("BuildBase", buildBase); | |
6801 | 74 put("BuildSpace", buildSpace); |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
75 put("OutputDll", outDir + Util.sep + outDll); |
10277 | 76 put("JdkTargetRoot", jdkTargetRoot); |
0 | 77 |
78 context = new String [] {flavourBuild, flavour, build, null}; | |
79 } | |
80 | |
6801 | 81 protected void init(Vector<String> includes, Vector<String> defines) { |
0 | 82 initDefaultDefines(defines); |
83 initDefaultCompilerFlags(includes); | |
84 initDefaultLinkerFlags(); | |
6801 | 85 //handleDB(); |
0 | 86 } |
87 | |
88 | |
6801 | 89 protected void initDefaultCompilerFlags(Vector<String> includes) { |
0 | 90 Vector compilerFlags = new Vector(); |
91 | |
92 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), | |
93 includes, | |
94 get("OutputDir"))); | |
95 | |
96 put("CompilerFlags", compilerFlags); | |
97 } | |
98 | |
99 protected void initDefaultLinkerFlags() { | |
100 Vector linkerFlags = new Vector(); | |
101 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
102 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
0 | 103 |
104 put("LinkerFlags", linkerFlags); | |
105 } | |
106 | |
6801 | 107 public boolean matchesIgnoredPath(String path) { |
108 Vector<String> rv = new Vector<String>(); | |
1972 | 109 collectRelevantVectors(rv, "IgnorePath"); |
6801 | 110 for (String pathPart : rv) { |
111 if (path.contains(pathPart)) { | |
1972 | 112 return true; |
113 } | |
114 } | |
115 return false; | |
116 } | |
117 | |
6801 | 118 public boolean matchesHidePath(String path) { |
119 Vector<String> rv = new Vector<String>(); | |
120 collectRelevantVectors(rv, "HidePath"); | |
121 for (String pathPart : rv) { | |
122 if (path.contains(Util.normalize(pathPart))) { | |
123 return true; | |
124 } | |
125 } | |
126 return false; | |
127 } | |
128 | |
129 public Vector<String> matchesAdditionalGeneratedPath(String fullPath) { | |
130 Vector<String> rv = new Vector<String>(); | |
131 Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile"); | |
132 if (v != null) { | |
133 for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) { | |
134 String key = e.nextElement(); | |
135 String val = v.get(key); | |
136 | |
137 if (fullPath.endsWith(expandFormat(key))) { | |
138 rv.add(expandFormat(val)); | |
0 | 139 } |
140 } | |
141 } | |
6801 | 142 return rv; |
0 | 143 } |
144 | |
12014
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
145 // Returns true if the specified path refers to a relative alternate |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
146 // source file. RelativeAltSrcInclude is usually "src\closed". |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
147 public static boolean matchesRelativeAltSrcInclude(String path) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
148 String relativeAltSrcInclude = |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
149 getFieldString(null, "RelativeAltSrcInclude"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
150 Vector<String> v = getFieldVector(null, "AltRelativeInclude"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
151 for (String pathPart : v) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
152 if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
153 return true; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
154 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
155 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
156 return false; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
157 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
158 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
159 // Returns the relative alternate source file for the specified path. |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
160 // Null is returned if the specified path does not have a matching |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
161 // alternate source file. |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
162 public static String getMatchingRelativeAltSrcFile(String path) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
163 Vector<String> v = getFieldVector(null, "RelativeAltSrcFileList"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
164 if (v == null) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
165 return null; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
166 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
167 for (String pathPart : v) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
168 if (path.endsWith(pathPart)) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
169 String relativeAltSrcInclude = |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
170 getFieldString(null, "RelativeAltSrcInclude"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
171 return relativeAltSrcInclude + Util.sep + pathPart; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
172 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
173 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
174 return null; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
175 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
176 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
177 // Returns true if the specified path has a matching alternate |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
178 // source file. |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
179 public static boolean matchesRelativeAltSrcFile(String path) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
180 return getMatchingRelativeAltSrcFile(path) != null; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
181 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
182 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
183 // Track the specified alternate source file. The source file is |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
184 // tracked without the leading .*<sep><RelativeAltSrcFileList><sep> |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
185 // part to make matching regular source files easier. |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
186 public static void trackRelativeAltSrcFile(String path) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
187 String pattern = getFieldString(null, "RelativeAltSrcInclude") + |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
188 Util.sep; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
189 int altSrcInd = path.indexOf(pattern); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
190 if (altSrcInd == -1) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
191 // not an AltSrc path |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
192 return; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
193 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
194 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
195 altSrcInd += pattern.length(); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
196 if (altSrcInd >= path.length()) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
197 // not a valid AltSrc path |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
198 return; |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
199 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
200 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
201 String altSrcFile = path.substring(altSrcInd); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
202 Vector v = getFieldVector(null, "RelativeAltSrcFileList"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
203 if (v == null || !v.contains(altSrcFile)) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
204 addFieldVector(null, "RelativeAltSrcFileList", altSrcFile); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
205 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
206 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
207 |
0 | 208 void addTo(Hashtable ht, String key, String value) { |
209 ht.put(expandFormat(key), expandFormat(value)); | |
210 } | |
211 | |
212 void initDefaultDefines(Vector defines) { | |
213 Vector sysDefines = new Vector(); | |
214 sysDefines.add("WIN32"); | |
215 sysDefines.add("_WINDOWS"); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
216 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
0 | 217 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
10405 | 218 sysDefines.add("INCLUDE_TRACE=1"); |
0 | 219 sysDefines.add("_JNI_IMPLEMENTATION_"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
220 if (vars.get("PlatformName").equals("Win32")) { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
221 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
222 } else { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
223 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
224 } |
0 | 225 |
226 sysDefines.addAll(defines); | |
227 | |
228 put("Define", sysDefines); | |
229 } | |
230 | |
231 String get(String key) { | |
232 return (String)vars.get(key); | |
233 } | |
234 | |
235 Vector getV(String key) { | |
236 return (Vector)vars.get(key); | |
237 } | |
238 | |
239 Object getO(String key) { | |
240 return vars.get(key); | |
241 } | |
242 | |
243 Hashtable getH(String key) { | |
244 return (Hashtable)vars.get(key); | |
245 } | |
246 | |
247 Object getFieldInContext(String field) { | |
248 for (int i=0; i<context.length; i++) { | |
249 Object rv = getField(context[i], field); | |
250 if (rv != null) { | |
251 return rv; | |
252 } | |
253 } | |
254 return null; | |
255 } | |
256 | |
257 Object lookupHashFieldInContext(String field, String key) { | |
258 for (int i=0; i<context.length; i++) { | |
259 Hashtable ht = (Hashtable)getField(context[i], field); | |
260 if (ht != null) { | |
261 Object rv = ht.get(key); | |
262 if (rv != null) { | |
263 return rv; | |
264 } | |
265 } | |
266 } | |
267 return null; | |
268 } | |
269 | |
270 void put(String key, String value) { | |
271 vars.put(key, value); | |
272 } | |
273 | |
274 void put(String key, Vector vvalue) { | |
275 vars.put(key, vvalue); | |
276 } | |
277 | |
278 void add(String key, Vector vvalue) { | |
279 getV(key).addAll(vvalue); | |
280 } | |
281 | |
282 String flavour() { | |
283 return get("Flavour"); | |
284 } | |
285 | |
286 String build() { | |
287 return get("Build"); | |
288 } | |
289 | |
290 Object getSpecificField(String field) { | |
291 return getField(get("Id"), field); | |
292 } | |
293 | |
294 void putSpecificField(String field, Object value) { | |
295 putField(get("Id"), field, value); | |
296 } | |
297 | |
298 void collectRelevantVectors(Vector rv, String field) { | |
6801 | 299 for (String ctx : context) { |
300 Vector<String> v = getFieldVector(ctx, field); | |
0 | 301 if (v != null) { |
6801 | 302 for (String val : v) { |
303 rv.add(expandFormat(val).replace('/', '\\')); | |
0 | 304 } |
305 } | |
306 } | |
307 } | |
308 | |
309 void collectRelevantHashes(Hashtable rv, String field) { | |
6801 | 310 for (String ctx : context) { |
311 Hashtable v = (Hashtable)getField(ctx, field); | |
0 | 312 if (v != null) { |
313 for (Enumeration e=v.keys(); e.hasMoreElements(); ) { | |
314 String key = (String)e.nextElement(); | |
315 String val = (String)v.get(key); | |
316 addTo(rv, key, val); | |
317 } | |
318 } | |
319 } | |
320 } | |
321 | |
322 | |
323 Vector getDefines() { | |
324 Vector rv = new Vector(); | |
325 collectRelevantVectors(rv, "Define"); | |
326 return rv; | |
327 } | |
328 | |
329 Vector getIncludes() { | |
330 Vector rv = new Vector(); | |
331 collectRelevantVectors(rv, "AbsoluteInclude"); | |
1972 | 332 rv.addAll(getSourceIncludes()); |
333 return rv; | |
334 } | |
335 | |
336 private Vector getSourceIncludes() { | |
6801 | 337 Vector<String> rv = new Vector<String>(); |
12014
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
338 String sourceBase = getFieldString(null, "SourceBase"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
339 |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
340 // add relative alternate source include values: |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
341 String relativeAltSrcInclude = |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
342 getFieldString(null, "RelativeAltSrcInclude"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
343 Vector<String> asri = new Vector<String>(); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
344 collectRelevantVectors(asri, "AltRelativeInclude"); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
345 for (String f : asri) { |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
346 rv.add(sourceBase + Util.sep + relativeAltSrcInclude + |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
347 Util.sep + f); |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
348 } |
31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
10405
diff
changeset
|
349 |
6801 | 350 Vector<String> ri = new Vector<String>(); |
0 | 351 collectRelevantVectors(ri, "RelativeInclude"); |
6801 | 352 for (String f : ri) { |
0 | 353 rv.add(sourceBase + Util.sep + f); |
354 } | |
355 return rv; | |
356 } | |
357 | |
358 static Hashtable cfgData = new Hashtable(); | |
359 static Hashtable globalData = new Hashtable(); | |
360 | |
361 static boolean appliesToTieredBuild(String cfg) { | |
362 return (cfg != null && | |
363 (cfg.startsWith("compiler1") || | |
364 cfg.startsWith("compiler2"))); | |
365 } | |
366 | |
1972 | 367 // Filters out the IgnoreFile and IgnorePaths since they are |
368 // handled specially for tiered builds. | |
0 | 369 static boolean appliesToTieredBuild(String cfg, String key) { |
1972 | 370 return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore")); |
0 | 371 } |
372 | |
373 static String getTieredBuildCfg(String cfg) { | |
374 assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; | |
375 return "tiered" + cfg.substring(9); | |
376 } | |
377 | |
378 static Object getField(String cfg, String field) { | |
379 if (cfg == null) { | |
380 return globalData.get(field); | |
381 } | |
382 | |
383 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
384 return ht == null ? null : ht.get(field); | |
385 } | |
386 | |
387 static String getFieldString(String cfg, String field) { | |
388 return (String)getField(cfg, field); | |
389 } | |
390 | |
391 static Vector getFieldVector(String cfg, String field) { | |
392 return (Vector)getField(cfg, field); | |
393 } | |
394 | |
395 static void putField(String cfg, String field, Object value) { | |
396 putFieldImpl(cfg, field, value); | |
397 if (appliesToTieredBuild(cfg, field)) { | |
398 putFieldImpl(getTieredBuildCfg(cfg), field, value); | |
399 } | |
400 } | |
401 | |
402 private static void putFieldImpl(String cfg, String field, Object value) { | |
403 if (cfg == null) { | |
404 globalData.put(field, value); | |
405 return; | |
406 } | |
407 | |
408 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
409 if (ht == null) { | |
410 ht = new Hashtable(); | |
411 cfgData.put(cfg, ht); | |
412 } | |
413 | |
414 ht.put(field, value); | |
415 } | |
416 | |
417 static Object getFieldHash(String cfg, String field, String name) { | |
418 Hashtable ht = (Hashtable)getField(cfg, field); | |
419 | |
420 return ht == null ? null : ht.get(name); | |
421 } | |
422 | |
423 static void putFieldHash(String cfg, String field, String name, Object val) { | |
424 putFieldHashImpl(cfg, field, name, val); | |
1972 | 425 if (appliesToTieredBuild(cfg, field)) { |
0 | 426 putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); |
427 } | |
428 } | |
429 | |
430 private static void putFieldHashImpl(String cfg, String field, String name, Object val) { | |
431 Hashtable ht = (Hashtable)getField(cfg, field); | |
432 | |
433 if (ht == null) { | |
434 ht = new Hashtable(); | |
435 putFieldImpl(cfg, field, ht); | |
436 } | |
437 | |
438 ht.put(name, val); | |
439 } | |
440 | |
441 static void addFieldVector(String cfg, String field, String element) { | |
442 addFieldVectorImpl(cfg, field, element); | |
1972 | 443 if (appliesToTieredBuild(cfg, field)) { |
0 | 444 addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); |
445 } | |
446 } | |
447 | |
448 private static void addFieldVectorImpl(String cfg, String field, String element) { | |
449 Vector v = (Vector)getField(cfg, field); | |
450 | |
451 if (v == null) { | |
452 v = new Vector(); | |
453 putFieldImpl(cfg, field, v); | |
454 } | |
455 | |
456 v.add(element); | |
457 } | |
458 | |
459 String expandFormat(String format) { | |
460 if (format == null) { | |
461 return null; | |
462 } | |
463 | |
464 if (format.indexOf('%') == -1) { | |
465 return format; | |
466 } | |
467 | |
468 StringBuffer sb = new StringBuffer(); | |
469 int len = format.length(); | |
470 for (int i=0; i<len; i++) { | |
471 char ch = format.charAt(i); | |
472 if (ch == '%') { | |
473 char ch1 = format.charAt(i+1); | |
474 switch (ch1) { | |
475 case '%': | |
476 sb.append(ch1); | |
477 break; | |
478 case 'b': | |
479 sb.append(build()); | |
480 break; | |
481 case 'f': | |
482 sb.append(flavour()); | |
483 break; | |
484 default: | |
485 sb.append(ch); | |
486 sb.append(ch1); | |
487 } | |
488 i++; | |
489 } else { | |
490 sb.append(ch); | |
491 } | |
492 } | |
493 | |
494 return sb.toString(); | |
495 } | |
496 } | |
497 | |
498 abstract class GenericDebugConfig extends BuildConfig { | |
499 abstract String getOptFlag(); | |
500 | |
501 protected void init(Vector includes, Vector defines) { | |
502 defines.add("_DEBUG"); | |
503 defines.add("ASSERT"); | |
504 | |
505 super.init(includes, defines); | |
506 | |
507 getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag())); | |
508 getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags()); | |
509 } | |
510 } | |
511 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
512 abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
513 protected void init(Vector includes, Vector defines) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
514 super.init(includes, defines); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
515 getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
516 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
517 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
518 |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
519 class C1DebugConfig extends GenericDebugNonKernelConfig { |
0 | 520 String getOptFlag() { |
521 return getCI().getNoOptFlag(); | |
522 } | |
523 | |
524 C1DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
525 initNames("compiler1", "debug", "jvm.dll"); |
0 | 526 init(getIncludes(), getDefines()); |
527 } | |
528 } | |
529 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
530 class C1FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 531 String getOptFlag() { |
532 return getCI().getOptFlag(); | |
533 } | |
534 | |
535 C1FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
536 initNames("compiler1", "fastdebug", "jvm.dll"); |
0 | 537 init(getIncludes(), getDefines()); |
538 } | |
539 } | |
540 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
541 class C2DebugConfig extends GenericDebugNonKernelConfig { |
0 | 542 String getOptFlag() { |
543 return getCI().getNoOptFlag(); | |
544 } | |
545 | |
546 C2DebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
547 initNames("compiler2", "debug", "jvm.dll"); |
0 | 548 init(getIncludes(), getDefines()); |
549 } | |
550 } | |
551 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
552 class C2FastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 553 String getOptFlag() { |
554 return getCI().getOptFlag(); | |
555 } | |
556 | |
557 C2FastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
558 initNames("compiler2", "fastdebug", "jvm.dll"); |
0 | 559 init(getIncludes(), getDefines()); |
560 } | |
561 } | |
562 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
563 class TieredDebugConfig extends GenericDebugNonKernelConfig { |
0 | 564 String getOptFlag() { |
565 return getCI().getNoOptFlag(); | |
566 } | |
567 | |
568 TieredDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
569 initNames("tiered", "debug", "jvm.dll"); |
0 | 570 init(getIncludes(), getDefines()); |
571 } | |
572 } | |
573 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
574 class TieredFastDebugConfig extends GenericDebugNonKernelConfig { |
0 | 575 String getOptFlag() { |
576 return getCI().getOptFlag(); | |
577 } | |
578 | |
579 TieredFastDebugConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
580 initNames("tiered", "fastdebug", "jvm.dll"); |
0 | 581 init(getIncludes(), getDefines()); |
582 } | |
583 } | |
584 | |
585 abstract class ProductConfig extends BuildConfig { | |
586 protected void init(Vector includes, Vector defines) { | |
587 defines.add("NDEBUG"); | |
588 defines.add("PRODUCT"); | |
589 | |
590 super.init(includes, defines); | |
591 | |
592 getV("CompilerFlags").addAll(getCI().getProductCompilerFlags()); | |
593 getV("LinkerFlags").addAll(getCI().getProductLinkerFlags()); | |
594 } | |
595 } | |
596 | |
597 class C1ProductConfig extends ProductConfig { | |
598 C1ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
599 initNames("compiler1", "product", "jvm.dll"); |
0 | 600 init(getIncludes(), getDefines()); |
601 } | |
602 } | |
603 | |
604 class C2ProductConfig extends ProductConfig { | |
605 C2ProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
606 initNames("compiler2", "product", "jvm.dll"); |
0 | 607 init(getIncludes(), getDefines()); |
608 } | |
609 } | |
610 | |
611 class TieredProductConfig extends ProductConfig { | |
612 TieredProductConfig() { | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
613 initNames("tiered", "product", "jvm.dll"); |
0 | 614 init(getIncludes(), getDefines()); |
615 } | |
616 } | |
617 | |
6801 | 618 |
0 | 619 abstract class CompilerInterface { |
620 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
|
621 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
0 | 622 abstract Vector getDebugCompilerFlags(String opt); |
623 abstract Vector getDebugLinkerFlags(); | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
624 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
0 | 625 abstract Vector getProductCompilerFlags(); |
626 abstract Vector getProductLinkerFlags(); | |
627 abstract String getOptFlag(); | |
628 abstract String getNoOptFlag(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
629 abstract String makeCfgName(String flavourBuild, String platformName); |
0 | 630 |
631 void addAttr(Vector receiver, String attr, String value) { | |
632 receiver.add(attr); receiver.add(value); | |
633 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
634 void extAttr(Vector receiver, String attr, String value) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
635 int attr_pos=receiver.indexOf(attr) ; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
636 if ( attr_pos == -1) { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
637 // 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
|
638 receiver.add(attr); receiver.add(value); |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
639 } else { |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
640 // 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
|
641 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
|
642 } |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
643 } |
0 | 644 } |