author | vtewari |
Tue, 13 Sep 2016 17:00:06 +0530 | |
changeset 40937 | f72e61ec734b |
parent 38247 | 6ff550a6307e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
2 |
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
25 |
package build.tools.projectcreator; |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
26 |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
27 |
import java.util.Enumeration; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
28 |
import java.util.Hashtable; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
29 |
import java.util.Vector; |
1 | 30 |
|
31 |
class BuildConfig { |
|
13892 | 32 |
@SuppressWarnings("rawtypes") |
1 | 33 |
Hashtable vars; |
13892 | 34 |
Vector<String> basicNames, basicPaths; |
1 | 35 |
String[] context; |
36 |
||
37 |
static CompilerInterface ci; |
|
38 |
static CompilerInterface getCI() { |
|
39 |
if (ci == null) { |
|
40 |
String comp = (String)getField(null, "CompilerVersion"); |
|
41 |
try { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
42 |
ci = (CompilerInterface)Class.forName("build.tools.projectcreator.CompilerInterface" + comp).newInstance(); |
1 | 43 |
} catch (Exception cnfe) { |
44 |
System.err.println("Cannot find support for compiler " + comp); |
|
45 |
throw new RuntimeException(cnfe.toString()); |
|
46 |
} |
|
47 |
} |
|
48 |
return ci; |
|
49 |
} |
|
50 |
||
13892 | 51 |
@SuppressWarnings("rawtypes") |
1 | 52 |
protected void initNames(String flavour, String build, String outDll) { |
53 |
if (vars == null) vars = new Hashtable(); |
|
54 |
||
55 |
String flavourBuild = flavour + "_" + build; |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
56 |
String platformName = getFieldString(null, "PlatformName"); |
7397 | 57 |
System.out.println(); |
58 |
System.out.println(flavourBuild); |
|
59 |
||
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
60 |
put("Name", getCI().makeCfgName(flavourBuild, platformName)); |
1 | 61 |
put("Flavour", flavour); |
62 |
put("Build", build); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
63 |
put("PlatformName", platformName); |
1 | 64 |
|
65 |
// ones mentioned above were needed to expand format |
|
66 |
String buildBase = expandFormat(getFieldString(null, "BuildBase")); |
|
67 |
String sourceBase = getFieldString(null, "SourceBase"); |
|
13892 | 68 |
String buildSpace = getFieldString(null, "BuildSpace"); |
1 | 69 |
String outDir = buildBase; |
17382 | 70 |
String jdkTargetRoot = getFieldString(null, "JdkTargetRoot"); |
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
71 |
String makeBinary = getFieldString(null, "MakeBinary"); |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
72 |
String makeOutput = expandFormat(getFieldString(null, "MakeOutput")); |
1 | 73 |
|
74 |
put("Id", flavourBuild); |
|
75 |
put("OutputDir", outDir); |
|
76 |
put("SourceBase", sourceBase); |
|
77 |
put("BuildBase", buildBase); |
|
13892 | 78 |
put("BuildSpace", buildSpace); |
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
79 |
put("OutputDll", outDir + Util.sep + outDll); |
17382 | 80 |
put("JdkTargetRoot", jdkTargetRoot); |
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
81 |
put("MakeBinary", makeBinary); |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
82 |
put("MakeOutput", makeOutput); |
1 | 83 |
|
84 |
context = new String [] {flavourBuild, flavour, build, null}; |
|
85 |
} |
|
86 |
||
13892 | 87 |
protected void init(Vector<String> includes, Vector<String> defines) { |
1 | 88 |
initDefaultDefines(defines); |
89 |
initDefaultCompilerFlags(includes); |
|
90 |
initDefaultLinkerFlags(); |
|
13892 | 91 |
//handleDB(); |
1 | 92 |
} |
93 |
||
94 |
||
13892 | 95 |
protected void initDefaultCompilerFlags(Vector<String> includes) { |
1 | 96 |
Vector compilerFlags = new Vector(); |
97 |
||
98 |
compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), |
|
99 |
includes, |
|
100 |
get("OutputDir"))); |
|
101 |
||
102 |
put("CompilerFlags", compilerFlags); |
|
103 |
} |
|
104 |
||
105 |
protected void initDefaultLinkerFlags() { |
|
106 |
Vector linkerFlags = new Vector(); |
|
107 |
||
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
108 |
linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
1 | 109 |
|
110 |
put("LinkerFlags", linkerFlags); |
|
111 |
} |
|
112 |
||
13892 | 113 |
public boolean matchesIgnoredPath(String path) { |
114 |
Vector<String> rv = new Vector<String>(); |
|
7397 | 115 |
collectRelevantVectors(rv, "IgnorePath"); |
13892 | 116 |
for (String pathPart : rv) { |
117 |
if (path.contains(pathPart)) { |
|
7397 | 118 |
return true; |
119 |
} |
|
120 |
} |
|
121 |
return false; |
|
122 |
} |
|
123 |
||
13892 | 124 |
public boolean matchesHidePath(String path) { |
125 |
Vector<String> rv = new Vector<String>(); |
|
126 |
collectRelevantVectors(rv, "HidePath"); |
|
127 |
for (String pathPart : rv) { |
|
128 |
if (path.contains(Util.normalize(pathPart))) { |
|
129 |
return true; |
|
130 |
} |
|
131 |
} |
|
132 |
return false; |
|
133 |
} |
|
134 |
||
135 |
public Vector<String> matchesAdditionalGeneratedPath(String fullPath) { |
|
136 |
Vector<String> rv = new Vector<String>(); |
|
137 |
Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile"); |
|
138 |
if (v != null) { |
|
139 |
for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) { |
|
140 |
String key = e.nextElement(); |
|
141 |
String val = v.get(key); |
|
142 |
||
143 |
if (fullPath.endsWith(expandFormat(key))) { |
|
144 |
rv.add(expandFormat(val)); |
|
1 | 145 |
} |
146 |
} |
|
147 |
} |
|
13892 | 148 |
return rv; |
1 | 149 |
} |
150 |
||
19270
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
151 |
// Returns true if the specified path refers to a relative alternate |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
152 |
// source file. RelativeAltSrcInclude is usually "src\closed". |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
153 |
public static boolean matchesRelativeAltSrcInclude(String path) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
154 |
String relativeAltSrcInclude = |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
155 |
getFieldString(null, "RelativeAltSrcInclude"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
156 |
Vector<String> v = getFieldVector(null, "AltRelativeInclude"); |
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
157 |
if (v != null) { |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
158 |
for (String pathPart : v) { |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
159 |
if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) { |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
160 |
return true; |
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
161 |
} |
19270
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
162 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
163 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
164 |
return false; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
165 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
166 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
167 |
// Returns the relative alternate source file for the specified path. |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
168 |
// Null is returned if the specified path does not have a matching |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
169 |
// alternate source file. |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
170 |
public static String getMatchingRelativeAltSrcFile(String path) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
171 |
Vector<String> v = getFieldVector(null, "RelativeAltSrcFileList"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
172 |
if (v == null) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
173 |
return null; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
174 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
175 |
for (String pathPart : v) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
176 |
if (path.endsWith(pathPart)) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
177 |
String relativeAltSrcInclude = |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
178 |
getFieldString(null, "RelativeAltSrcInclude"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
179 |
return relativeAltSrcInclude + Util.sep + pathPart; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
180 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
181 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
182 |
return null; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
183 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
184 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
185 |
// Returns true if the specified path has a matching alternate |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
186 |
// source file. |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
187 |
public static boolean matchesRelativeAltSrcFile(String path) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
188 |
return getMatchingRelativeAltSrcFile(path) != null; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
189 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
190 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
191 |
// Track the specified alternate source file. The source file is |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
192 |
// tracked without the leading .*<sep><RelativeAltSrcFileList><sep> |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
193 |
// part to make matching regular source files easier. |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
194 |
public static void trackRelativeAltSrcFile(String path) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
195 |
String pattern = getFieldString(null, "RelativeAltSrcInclude") + |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
196 |
Util.sep; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
197 |
int altSrcInd = path.indexOf(pattern); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
198 |
if (altSrcInd == -1) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
199 |
// not an AltSrc path |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
200 |
return; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
201 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
202 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
203 |
altSrcInd += pattern.length(); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
204 |
if (altSrcInd >= path.length()) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
205 |
// not a valid AltSrc path |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
206 |
return; |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
207 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
208 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
209 |
String altSrcFile = path.substring(altSrcInd); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
210 |
Vector v = getFieldVector(null, "RelativeAltSrcFileList"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
211 |
if (v == null || !v.contains(altSrcFile)) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
212 |
addFieldVector(null, "RelativeAltSrcFileList", altSrcFile); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
213 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
214 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
215 |
|
1 | 216 |
void addTo(Hashtable ht, String key, String value) { |
217 |
ht.put(expandFormat(key), expandFormat(value)); |
|
218 |
} |
|
219 |
||
220 |
void initDefaultDefines(Vector defines) { |
|
221 |
Vector sysDefines = new Vector(); |
|
222 |
sysDefines.add("WIN32"); |
|
223 |
sysDefines.add("_WINDOWS"); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
224 |
sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
1 | 225 |
sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
18025 | 226 |
sysDefines.add("INCLUDE_TRACE=1"); |
1 | 227 |
sysDefines.add("_JNI_IMPLEMENTATION_"); |
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
228 |
if (vars.get("PlatformName").equals("Win32")) { |
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
229 |
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
230 |
} else { |
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
231 |
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
232 |
} |
35183
30271b37bd14
8145400: ProjectCreator broken after JEP 223 changes
ctornqvi
parents:
27652
diff
changeset
|
233 |
sysDefines.add("DEBUG_LEVEL=\\\"" + get("Build")+"\\\""); |
1 | 234 |
sysDefines.addAll(defines); |
235 |
||
236 |
put("Define", sysDefines); |
|
237 |
} |
|
238 |
||
239 |
String get(String key) { |
|
240 |
return (String)vars.get(key); |
|
241 |
} |
|
242 |
||
243 |
Vector getV(String key) { |
|
244 |
return (Vector)vars.get(key); |
|
245 |
} |
|
246 |
||
247 |
Object getO(String key) { |
|
248 |
return vars.get(key); |
|
249 |
} |
|
250 |
||
251 |
Hashtable getH(String key) { |
|
252 |
return (Hashtable)vars.get(key); |
|
253 |
} |
|
254 |
||
255 |
Object getFieldInContext(String field) { |
|
256 |
for (int i=0; i<context.length; i++) { |
|
257 |
Object rv = getField(context[i], field); |
|
258 |
if (rv != null) { |
|
259 |
return rv; |
|
260 |
} |
|
261 |
} |
|
262 |
return null; |
|
263 |
} |
|
264 |
||
265 |
Object lookupHashFieldInContext(String field, String key) { |
|
266 |
for (int i=0; i<context.length; i++) { |
|
267 |
Hashtable ht = (Hashtable)getField(context[i], field); |
|
268 |
if (ht != null) { |
|
269 |
Object rv = ht.get(key); |
|
270 |
if (rv != null) { |
|
271 |
return rv; |
|
272 |
} |
|
273 |
} |
|
274 |
} |
|
275 |
return null; |
|
276 |
} |
|
277 |
||
278 |
void put(String key, String value) { |
|
279 |
vars.put(key, value); |
|
280 |
} |
|
281 |
||
282 |
void put(String key, Vector vvalue) { |
|
283 |
vars.put(key, vvalue); |
|
284 |
} |
|
285 |
||
286 |
void add(String key, Vector vvalue) { |
|
287 |
getV(key).addAll(vvalue); |
|
288 |
} |
|
289 |
||
290 |
String flavour() { |
|
291 |
return get("Flavour"); |
|
292 |
} |
|
293 |
||
294 |
String build() { |
|
295 |
return get("Build"); |
|
296 |
} |
|
297 |
||
298 |
Object getSpecificField(String field) { |
|
299 |
return getField(get("Id"), field); |
|
300 |
} |
|
301 |
||
302 |
void putSpecificField(String field, Object value) { |
|
303 |
putField(get("Id"), field, value); |
|
304 |
} |
|
305 |
||
306 |
void collectRelevantVectors(Vector rv, String field) { |
|
13892 | 307 |
for (String ctx : context) { |
308 |
Vector<String> v = getFieldVector(ctx, field); |
|
1 | 309 |
if (v != null) { |
13892 | 310 |
for (String val : v) { |
311 |
rv.add(expandFormat(val).replace('/', '\\')); |
|
1 | 312 |
} |
313 |
} |
|
314 |
} |
|
315 |
} |
|
316 |
||
317 |
void collectRelevantHashes(Hashtable rv, String field) { |
|
13892 | 318 |
for (String ctx : context) { |
319 |
Hashtable v = (Hashtable)getField(ctx, field); |
|
1 | 320 |
if (v != null) { |
321 |
for (Enumeration e=v.keys(); e.hasMoreElements(); ) { |
|
322 |
String key = (String)e.nextElement(); |
|
323 |
String val = (String)v.get(key); |
|
324 |
addTo(rv, key, val); |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
||
330 |
||
331 |
Vector getDefines() { |
|
332 |
Vector rv = new Vector(); |
|
333 |
collectRelevantVectors(rv, "Define"); |
|
334 |
return rv; |
|
335 |
} |
|
336 |
||
337 |
Vector getIncludes() { |
|
338 |
Vector rv = new Vector(); |
|
339 |
collectRelevantVectors(rv, "AbsoluteInclude"); |
|
7397 | 340 |
rv.addAll(getSourceIncludes()); |
341 |
return rv; |
|
342 |
} |
|
343 |
||
344 |
private Vector getSourceIncludes() { |
|
13892 | 345 |
Vector<String> rv = new Vector<String>(); |
19270
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
346 |
String sourceBase = getFieldString(null, "SourceBase"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
347 |
|
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
348 |
// add relative alternate source include values: |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
349 |
String relativeAltSrcInclude = |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
350 |
getFieldString(null, "RelativeAltSrcInclude"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
351 |
Vector<String> asri = new Vector<String>(); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
352 |
collectRelevantVectors(asri, "AltRelativeInclude"); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
353 |
for (String f : asri) { |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
354 |
rv.add(sourceBase + Util.sep + relativeAltSrcInclude + |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
355 |
Util.sep + f); |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
356 |
} |
607d97508c60
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents:
18025
diff
changeset
|
357 |
|
13892 | 358 |
Vector<String> ri = new Vector<String>(); |
1 | 359 |
collectRelevantVectors(ri, "RelativeInclude"); |
13892 | 360 |
for (String f : ri) { |
1 | 361 |
rv.add(sourceBase + Util.sep + f); |
362 |
} |
|
363 |
return rv; |
|
364 |
} |
|
365 |
||
366 |
static Hashtable cfgData = new Hashtable(); |
|
367 |
static Hashtable globalData = new Hashtable(); |
|
368 |
||
369 |
static boolean appliesToTieredBuild(String cfg) { |
|
370 |
return (cfg != null && |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
371 |
cfg.startsWith("server")); |
1 | 372 |
} |
373 |
||
7397 | 374 |
// Filters out the IgnoreFile and IgnorePaths since they are |
375 |
// handled specially for tiered builds. |
|
1 | 376 |
static boolean appliesToTieredBuild(String cfg, String key) { |
7397 | 377 |
return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore")); |
1 | 378 |
} |
379 |
||
380 |
static String getTieredBuildCfg(String cfg) { |
|
381 |
assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
382 |
return "server"; |
1 | 383 |
} |
384 |
||
385 |
static Object getField(String cfg, String field) { |
|
386 |
if (cfg == null) { |
|
387 |
return globalData.get(field); |
|
388 |
} |
|
389 |
||
390 |
Hashtable ht = (Hashtable)cfgData.get(cfg); |
|
391 |
return ht == null ? null : ht.get(field); |
|
392 |
} |
|
393 |
||
394 |
static String getFieldString(String cfg, String field) { |
|
395 |
return (String)getField(cfg, field); |
|
396 |
} |
|
397 |
||
398 |
static Vector getFieldVector(String cfg, String field) { |
|
399 |
return (Vector)getField(cfg, field); |
|
400 |
} |
|
401 |
||
402 |
static void putField(String cfg, String field, Object value) { |
|
403 |
putFieldImpl(cfg, field, value); |
|
404 |
if (appliesToTieredBuild(cfg, field)) { |
|
405 |
putFieldImpl(getTieredBuildCfg(cfg), field, value); |
|
406 |
} |
|
407 |
} |
|
408 |
||
409 |
private static void putFieldImpl(String cfg, String field, Object value) { |
|
410 |
if (cfg == null) { |
|
411 |
globalData.put(field, value); |
|
412 |
return; |
|
413 |
} |
|
414 |
||
415 |
Hashtable ht = (Hashtable)cfgData.get(cfg); |
|
416 |
if (ht == null) { |
|
417 |
ht = new Hashtable(); |
|
418 |
cfgData.put(cfg, ht); |
|
419 |
} |
|
420 |
||
421 |
ht.put(field, value); |
|
422 |
} |
|
423 |
||
424 |
static Object getFieldHash(String cfg, String field, String name) { |
|
425 |
Hashtable ht = (Hashtable)getField(cfg, field); |
|
426 |
||
427 |
return ht == null ? null : ht.get(name); |
|
428 |
} |
|
429 |
||
430 |
static void putFieldHash(String cfg, String field, String name, Object val) { |
|
431 |
putFieldHashImpl(cfg, field, name, val); |
|
7397 | 432 |
if (appliesToTieredBuild(cfg, field)) { |
1 | 433 |
putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); |
434 |
} |
|
435 |
} |
|
436 |
||
437 |
private static void putFieldHashImpl(String cfg, String field, String name, Object val) { |
|
438 |
Hashtable ht = (Hashtable)getField(cfg, field); |
|
439 |
||
440 |
if (ht == null) { |
|
441 |
ht = new Hashtable(); |
|
442 |
putFieldImpl(cfg, field, ht); |
|
443 |
} |
|
444 |
||
445 |
ht.put(name, val); |
|
446 |
} |
|
447 |
||
448 |
static void addFieldVector(String cfg, String field, String element) { |
|
449 |
addFieldVectorImpl(cfg, field, element); |
|
7397 | 450 |
if (appliesToTieredBuild(cfg, field)) { |
1 | 451 |
addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); |
452 |
} |
|
453 |
} |
|
454 |
||
455 |
private static void addFieldVectorImpl(String cfg, String field, String element) { |
|
456 |
Vector v = (Vector)getField(cfg, field); |
|
457 |
||
458 |
if (v == null) { |
|
459 |
v = new Vector(); |
|
460 |
putFieldImpl(cfg, field, v); |
|
461 |
} |
|
462 |
||
463 |
v.add(element); |
|
464 |
} |
|
465 |
||
466 |
String expandFormat(String format) { |
|
467 |
if (format == null) { |
|
468 |
return null; |
|
469 |
} |
|
470 |
||
471 |
if (format.indexOf('%') == -1) { |
|
472 |
return format; |
|
473 |
} |
|
474 |
||
475 |
StringBuffer sb = new StringBuffer(); |
|
476 |
int len = format.length(); |
|
477 |
for (int i=0; i<len; i++) { |
|
478 |
char ch = format.charAt(i); |
|
479 |
if (ch == '%') { |
|
480 |
char ch1 = format.charAt(i+1); |
|
481 |
switch (ch1) { |
|
482 |
case '%': |
|
483 |
sb.append(ch1); |
|
484 |
break; |
|
485 |
case 'b': |
|
486 |
sb.append(build()); |
|
487 |
break; |
|
488 |
case 'f': |
|
489 |
sb.append(flavour()); |
|
490 |
break; |
|
491 |
default: |
|
492 |
sb.append(ch); |
|
493 |
sb.append(ch1); |
|
494 |
} |
|
495 |
i++; |
|
496 |
} else { |
|
497 |
sb.append(ch); |
|
498 |
} |
|
499 |
} |
|
500 |
||
501 |
return sb.toString(); |
|
502 |
} |
|
503 |
} |
|
504 |
||
505 |
abstract class GenericDebugConfig extends BuildConfig { |
|
506 |
abstract String getOptFlag(); |
|
507 |
||
508 |
protected void init(Vector includes, Vector defines) { |
|
509 |
defines.add("_DEBUG"); |
|
510 |
defines.add("ASSERT"); |
|
511 |
||
512 |
super.init(includes, defines); |
|
513 |
||
26293
5c7a054e59fe
8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents:
19270
diff
changeset
|
514 |
getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag(), get("PlatformName"))); |
1 | 515 |
getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags()); |
516 |
} |
|
517 |
} |
|
518 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
519 |
abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
520 |
protected void init(Vector includes, Vector defines) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
521 |
super.init(includes, defines); |
27652
b07e72c58aef
8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents:
26293
diff
changeset
|
522 |
if (get("PlatformName").equals("Win32")) { |
b07e72c58aef
8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents:
26293
diff
changeset
|
523 |
getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); |
b07e72c58aef
8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents:
26293
diff
changeset
|
524 |
} |
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
525 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
526 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
527 |
|
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
528 |
class C1DebugConfig extends GenericDebugNonKernelConfig { |
1 | 529 |
String getOptFlag() { |
530 |
return getCI().getNoOptFlag(); |
|
531 |
} |
|
532 |
||
533 |
C1DebugConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
534 |
initNames("client", "debug", "jvm.dll"); |
1 | 535 |
init(getIncludes(), getDefines()); |
536 |
} |
|
537 |
} |
|
538 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
539 |
class C1FastDebugConfig extends GenericDebugNonKernelConfig { |
1 | 540 |
String getOptFlag() { |
541 |
return getCI().getOptFlag(); |
|
542 |
} |
|
543 |
||
544 |
C1FastDebugConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
545 |
initNames("client", "fastdebug", "jvm.dll"); |
1 | 546 |
init(getIncludes(), getDefines()); |
547 |
} |
|
548 |
} |
|
549 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
550 |
class TieredDebugConfig extends GenericDebugNonKernelConfig { |
1 | 551 |
String getOptFlag() { |
552 |
return getCI().getNoOptFlag(); |
|
553 |
} |
|
554 |
||
555 |
TieredDebugConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
556 |
initNames("server", "debug", "jvm.dll"); |
1 | 557 |
init(getIncludes(), getDefines()); |
558 |
} |
|
559 |
} |
|
560 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
561 |
class TieredFastDebugConfig extends GenericDebugNonKernelConfig { |
1 | 562 |
String getOptFlag() { |
563 |
return getCI().getOptFlag(); |
|
564 |
} |
|
565 |
||
566 |
TieredFastDebugConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
567 |
initNames("server", "fastdebug", "jvm.dll"); |
1 | 568 |
init(getIncludes(), getDefines()); |
569 |
} |
|
570 |
} |
|
571 |
||
572 |
abstract class ProductConfig extends BuildConfig { |
|
573 |
protected void init(Vector includes, Vector defines) { |
|
574 |
defines.add("NDEBUG"); |
|
575 |
defines.add("PRODUCT"); |
|
576 |
||
577 |
super.init(includes, defines); |
|
578 |
||
579 |
getV("CompilerFlags").addAll(getCI().getProductCompilerFlags()); |
|
580 |
getV("LinkerFlags").addAll(getCI().getProductLinkerFlags()); |
|
581 |
} |
|
582 |
} |
|
583 |
||
584 |
class C1ProductConfig extends ProductConfig { |
|
585 |
C1ProductConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
586 |
initNames("client", "product", "jvm.dll"); |
1 | 587 |
init(getIncludes(), getDefines()); |
588 |
} |
|
589 |
} |
|
590 |
||
591 |
class TieredProductConfig extends ProductConfig { |
|
592 |
TieredProductConfig() { |
|
38247
6ff550a6307e
8156018: Hotspot visual studio project generation broken
erikj
parents:
35183
diff
changeset
|
593 |
initNames("server", "product", "jvm.dll"); |
1 | 594 |
init(getIncludes(), getDefines()); |
595 |
} |
|
596 |
} |
|
597 |
||
13892 | 598 |
|
1 | 599 |
abstract class CompilerInterface { |
600 |
abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
601 |
abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
26293
5c7a054e59fe
8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents:
19270
diff
changeset
|
602 |
abstract Vector getDebugCompilerFlags(String opt, String platformName); |
1 | 603 |
abstract Vector getDebugLinkerFlags(); |
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
604 |
abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
1 | 605 |
abstract Vector getProductCompilerFlags(); |
606 |
abstract Vector getProductLinkerFlags(); |
|
607 |
abstract String getOptFlag(); |
|
608 |
abstract String getNoOptFlag(); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
609 |
abstract String makeCfgName(String flavourBuild, String platformName); |
1 | 610 |
|
611 |
void addAttr(Vector receiver, String attr, String value) { |
|
612 |
receiver.add(attr); receiver.add(value); |
|
613 |
} |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
614 |
void extAttr(Vector receiver, String attr, String value) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
615 |
int attr_pos=receiver.indexOf(attr) ; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
616 |
if ( attr_pos == -1) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
617 |
// If attr IS NOT present in the Vector - add it |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
618 |
receiver.add(attr); receiver.add(value); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
619 |
} else { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
620 |
// If attr IS present in the Vector - append value to it |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
621 |
receiver.set(attr_pos+1,receiver.get(attr_pos+1)+value); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
622 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
623 |
} |
1 | 624 |
} |