annotate src/share/tools/ProjectCreator/WinGammaPlatform.java @ 12014:31f3b1e1c5e5

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