]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-2005 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks;\r | |
18 | \r | |
19 | import java.io.File;\r | |
20 | import java.io.IOException;\r | |
21 | import java.util.Enumeration;\r | |
22 | import java.util.Hashtable;\r | |
23 | import java.util.Iterator;\r | |
24 | import java.util.Vector;\r | |
25 | \r | |
26 | import net.sf.antcontrib.cpptasks.compiler.AslcompilerConfiguration;\r | |
27 | import net.sf.antcontrib.cpptasks.compiler.AssemblerConfiguration;\r | |
28 | import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;\r | |
29 | import net.sf.antcontrib.cpptasks.compiler.LinkType;\r | |
30 | import net.sf.antcontrib.cpptasks.compiler.Linker;\r | |
31 | import net.sf.antcontrib.cpptasks.compiler.LinkerConfiguration;\r | |
32 | import net.sf.antcontrib.cpptasks.compiler.Processor;\r | |
33 | import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;\r | |
34 | import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;\r | |
35 | import net.sf.antcontrib.cpptasks.types.AssemblerArgument;\r | |
36 | import net.sf.antcontrib.cpptasks.types.CompilerArgument;\r | |
37 | import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;\r | |
38 | import net.sf.antcontrib.cpptasks.types.DefineSet;\r | |
39 | import net.sf.antcontrib.cpptasks.types.IncludePath;\r | |
40 | import net.sf.antcontrib.cpptasks.types.LibrarySet;\r | |
41 | import net.sf.antcontrib.cpptasks.types.LinkerArgument;\r | |
42 | import net.sf.antcontrib.cpptasks.types.SystemIncludePath;\r | |
43 | import net.sf.antcontrib.cpptasks.types.SystemLibrarySet;\r | |
44 | import net.sf.antcontrib.cpptasks.userdefine.UserDefineCompiler;\r | |
45 | import net.sf.antcontrib.cpptasks.userdefine.UserDefineDef;\r | |
46 | import net.sf.antcontrib.cpptasks.VersionInfo;\r | |
47 | \r | |
48 | import org.apache.tools.ant.BuildException;\r | |
49 | import org.apache.tools.ant.Project;\r | |
50 | import org.apache.tools.ant.Task;\r | |
51 | import org.apache.tools.ant.types.Environment;\r | |
52 | \r | |
53 | /**\r | |
54 | * Compile, link, assembler and asl compile task.\r | |
55 | * \r | |
56 | * <p>\r | |
57 | * This task can compile various source languages and produce executables,\r | |
58 | * shared libraries (aka DLL's) and static libraries. Compiler adaptors are\r | |
59 | * currently available for several C/C++ compilers, FORTRAN, MIDL and Windows\r | |
60 | * Resource files. Assembler adaptors are currently available for MASM and GAS.\r | |
61 | * And aslcompiler support to ASL and IASL command.\r | |
62 | * </p>\r | |
63 | * \r | |
64 | * \r | |
65 | * <p>\r | |
66 | * Copyright (c) 2001-2005, The Ant-Contrib project.\r | |
67 | * </p>\r | |
68 | * \r | |
69 | * <p>\r | |
70 | * Licensed under the Apache Software License 2.0,\r | |
71 | * http://www.apache.org/licenses/LICENSE-2.0.\r | |
72 | * </p>\r | |
73 | * \r | |
74 | * <p>\r | |
75 | * For use with Apache Ant 1.5 or later. This software is not a product of the\r | |
76 | * of the Apache Software Foundation and no endorsement is implied.\r | |
77 | * </p>\r | |
78 | * \r | |
79 | * <p>\r | |
80 | * THIS SOFTWARE IS PROVIDED 'AS-IS', See\r | |
81 | * http://www.apache.org/licenses/LICENSE-2.0 for additional disclaimers.\r | |
82 | * </p>\r | |
83 | * \r | |
84 | * To use:\r | |
85 | * <ol>\r | |
86 | * <li>Place cpptasks.jar into the lib directory of Ant 1.5 or later.</li>\r | |
87 | * <li>Add <taskdef resource="cpptasks.tasks"/> and <typedef\r | |
88 | * resource="cpptasks.types"/> to build.xml.</li>\r | |
89 | * <li>Add <cc/>, <compiler/> <linker/> <assembler/>\r | |
90 | * and <aslcompiler/> elements to project.</li>\r | |
91 | * <li>Set path and environment variables to be able to run compiler from\r | |
92 | * command line.</li>\r | |
93 | * <li>Build project.</li>\r | |
94 | * </ol>\r | |
95 | * \r | |
96 | * @author Adam Murdoch\r | |
97 | * @author Curt Arnold\r | |
98 | */\r | |
99 | public class CCTask extends Task {\r | |
100 | private class SystemLibraryCollector implements FileVisitor {\r | |
101 | private Hashtable libraries;\r | |
102 | \r | |
103 | private Linker linker;\r | |
104 | \r | |
105 | public SystemLibraryCollector (Linker linker, Hashtable libraries) {\r | |
106 | this.linker = linker;\r | |
107 | this.libraries = libraries;\r | |
108 | }\r | |
109 | \r | |
110 | public void visit(File basedir, String filename) {\r | |
111 | if (linker.bid(filename) > 0) {\r | |
112 | File libfile = new File(basedir, filename);\r | |
113 | String key = linker.getLibraryKey(libfile);\r | |
114 | libraries.put(key, libfile);\r | |
115 | }\r | |
116 | }\r | |
117 | }\r | |
118 | \r | |
119 | private static final ProcessorConfiguration[] EMPTY_CONFIG_ARRAY = new ProcessorConfiguration[0];\r | |
120 | \r | |
121 | /**\r | |
122 | * Builds a Hashtable to targets needing to be rebuilt keyed by compiler\r | |
123 | * configuration\r | |
124 | */\r | |
125 | public static Hashtable getTargetsToBuildByConfiguration(Hashtable targets) {\r | |
126 | Hashtable targetsByConfig = new Hashtable();\r | |
127 | Enumeration targetEnum = targets.elements();\r | |
128 | while (targetEnum.hasMoreElements()) {\r | |
129 | TargetInfo target = (TargetInfo) targetEnum.nextElement();\r | |
130 | if (target.getRebuild()) {\r | |
131 | Vector targetsForSameConfig = (Vector) targetsByConfig\r | |
132 | .get(target.getConfiguration());\r | |
133 | if (targetsForSameConfig != null) {\r | |
134 | targetsForSameConfig.addElement(target);\r | |
135 | } else {\r | |
136 | targetsForSameConfig = new Vector();\r | |
137 | targetsForSameConfig.addElement(target);\r | |
138 | targetsByConfig.put(target.getConfiguration(),\r | |
139 | targetsForSameConfig);\r | |
140 | }\r | |
141 | }\r | |
142 | }\r | |
143 | return targetsByConfig;\r | |
144 | }\r | |
145 | \r | |
146 | /** The userdefine definitions. */\r | |
147 | private Vector _userdefines = new Vector();\r | |
148 | \r | |
149 | /** The compiler definitions. */\r | |
150 | private Vector _compilers = new Vector();\r | |
151 | \r | |
152 | /** The output file type. */\r | |
153 | // private LinkType _linkType = LinkType.EXECUTABLE;\r | |
154 | /** The library sets. */\r | |
155 | private Vector _libsets = new Vector();\r | |
156 | \r | |
157 | /** The aslcompiler definitions. */\r | |
158 | private Vector _aslcompiler = new Vector();\r | |
159 | \r | |
160 | /** The assembler definitions. */\r | |
161 | private Vector _assemblers = new Vector();\r | |
162 | \r | |
163 | /** The linker definitions. */\r | |
164 | private Vector _linkers = new Vector();\r | |
165 | \r | |
166 | /** The object directory. */\r | |
167 | private File _objDir;\r | |
168 | \r | |
169 | /** The output file. */\r | |
170 | private File _outfile;\r | |
171 | \r | |
172 | private boolean userdefine = false;\r | |
173 | private String arch;\r | |
174 | private String os;\r | |
175 | private String vendor;\r | |
176 | \r | |
177 | /** the flag for assembler */\r | |
178 | private boolean assembler = true;\r | |
179 | \r | |
180 | /** the flag for aslcompiler */\r | |
181 | private boolean aslcompiler = true;\r | |
182 | \r | |
183 | /** The linker definitions. */\r | |
184 | private final Vector targetPlatforms = new Vector();\r | |
185 | \r | |
186 | /** The distributer definitions. */\r | |
187 | private Vector distributers = new Vector();\r | |
188 | \r | |
189 | /**\r | |
190 | * If true, stop build on compile failure.\r | |
191 | */\r | |
192 | protected boolean failOnError = true;\r | |
193 | \r | |
194 | /**\r | |
195 | * Content that appears in <cc>and also in <compiler>are maintained by a\r | |
196 | * captive CompilerDef instance\r | |
197 | */\r | |
198 | private final CompilerDef compilerDef = new CompilerDef();\r | |
199 | \r | |
200 | /**\r | |
201 | * Content that appears in <cc>and also in <aslcompiler>are maintained by a\r | |
202 | * captive AslcompilerDef instance\r | |
203 | */\r | |
204 | private final AslcompilerDef aslcompilerDef = new AslcompilerDef();\r | |
205 | \r | |
206 | /** The OS390 dataset to build to object to */\r | |
207 | private String dataset;\r | |
208 | \r | |
209 | /**\r | |
210 | * \r | |
211 | * Depth of dependency checking\r | |
212 | * \r | |
213 | * Values < 0 indicate full dependency checking Values >= 0 indicate partial\r | |
214 | * dependency checking and for superficial compilation checks. Will throw\r | |
215 | * BuildException before attempting link\r | |
216 | */\r | |
217 | private int dependencyDepth = -1;\r | |
218 | \r | |
219 | /**\r | |
220 | * Content that appears in <cc>and also in <assembler>are maintained by a\r | |
221 | * captive AssemblerDef instance\r | |
222 | */\r | |
223 | private final AssemblerDef assemblerDef = new AssemblerDef();\r | |
224 | \r | |
225 | /**\r | |
226 | * Content that appears in <cc>and also in <linker>are maintained by a\r | |
227 | * captive CompilerDef instance\r | |
228 | */\r | |
229 | private final LinkerDef linkerDef = new LinkerDef();\r | |
230 | \r | |
231 | /**\r | |
232 | * contains the subsystem, output type and\r | |
233 | * \r | |
234 | */\r | |
235 | private final LinkType linkType = new LinkType();\r | |
236 | \r | |
237 | /**\r | |
238 | * The property name which will be set with the physical filename of the\r | |
239 | * file that is generated by the linker\r | |
240 | */\r | |
241 | private String outputFileProperty;\r | |
242 | \r | |
243 | /**\r | |
244 | * if relentless = true, compilations should attempt to compile as many\r | |
245 | * files as possible before throwing a BuildException\r | |
246 | */\r | |
247 | private boolean relentless;\r | |
248 | \r | |
249 | public CCTask () {\r | |
250 | }\r | |
251 | \r | |
252 | \r | |
253 | public void addConfiguredCommand(UserDefineDef userdefineDef) {\r | |
254 | if (userdefineDef == null) {\r | |
255 | throw new NullPointerException("UserDefineDef");\r | |
256 | }\r | |
257 | userdefineDef.setProject(getProject());\r | |
258 | _userdefines.addElement(userdefineDef);\r | |
259 | }\r | |
260 | /**\r | |
261 | * Adds a asl compiler definition or reference.\r | |
262 | * \r | |
263 | * @param Aslcompiler\r | |
264 | * aslcompiler\r | |
265 | * @throws NullPointerException\r | |
266 | * if aslcompiler is null\r | |
267 | */\r | |
268 | public void addConfiguredAslcompiler(AslcompilerDef aslcompier) {\r | |
269 | if (aslcompier == null) {\r | |
270 | throw new NullPointerException("aslcompier");\r | |
271 | }\r | |
272 | aslcompier.setProject(getProject());\r | |
273 | _aslcompiler.addElement(aslcompier);\r | |
274 | }\r | |
275 | \r | |
276 | /**\r | |
277 | * Adds a asl command-line arg. Argument will be inherited by all nested\r | |
278 | * aslcompiler elements that do not have inherit="false".\r | |
279 | * \r | |
280 | */\r | |
281 | public void addConfiguredAslcompilerArg(AslcompilerArgument arg) {\r | |
282 | aslcompilerDef.addConfiguredAslcompilerArg(arg);\r | |
283 | }\r | |
284 | \r | |
285 | /**\r | |
286 | * Adds a assembler definition or reference.\r | |
287 | * \r | |
288 | * @param assembler\r | |
289 | * assemblera\r | |
290 | * @throws NullPointerException\r | |
291 | * if assembler is null\r | |
292 | */\r | |
293 | public void addConfiguredAssembler(AssemblerDef assembler) {\r | |
294 | if (assembler == null) {\r | |
295 | throw new NullPointerException("assembler");\r | |
296 | }\r | |
297 | assembler.setProject(getProject());\r | |
298 | _assemblers.addElement(assembler);\r | |
299 | }\r | |
300 | \r | |
301 | /**\r | |
302 | * Adds a assembler command-line arg. Argument will be inherited by all\r | |
303 | * nested assembler elements that do not have inherit="false".\r | |
304 | * \r | |
305 | */\r | |
306 | public void addConfiguredAssemblerArg(AssemblerArgument arg) {\r | |
307 | assemblerDef.addConfiguredAssemblerArg(arg);\r | |
308 | }\r | |
309 | \r | |
310 | /**\r | |
311 | * Adds a compiler definition or reference.\r | |
312 | * \r | |
313 | * @param compiler\r | |
314 | * compiler\r | |
315 | * @throws NullPointerException\r | |
316 | * if compiler is null\r | |
317 | */\r | |
318 | public void addConfiguredCompiler(CompilerDef compiler) {\r | |
319 | if (compiler == null) {\r | |
320 | throw new NullPointerException("compiler");\r | |
321 | }\r | |
322 | compiler.setProject(getProject());\r | |
323 | _compilers.addElement(compiler);\r | |
324 | }\r | |
325 | \r | |
326 | /**\r | |
327 | * Adds a compiler command-line arg. Argument will be inherited by all\r | |
328 | * nested compiler elements that do not have inherit="false".\r | |
329 | * \r | |
330 | */\r | |
331 | public void addConfiguredCompilerArg(CompilerArgument arg) {\r | |
332 | compilerDef.addConfiguredCompilerArg(arg);\r | |
333 | }\r | |
334 | \r | |
335 | /**\r | |
336 | * Adds a defineset. Will be inherited by all compiler elements that do not\r | |
337 | * have inherit="false".\r | |
338 | * \r | |
339 | * @param defs\r | |
340 | * Define set\r | |
341 | */\r | |
342 | public void addConfiguredDefineset(DefineSet defs) {\r | |
343 | compilerDef.addConfiguredDefineset(defs);\r | |
344 | }\r | |
345 | \r | |
346 | /**\r | |
347 | * Adds a linker definition. The first linker that is not disqualified by\r | |
348 | * its "if" and "unless" attributes will perform the link. If no child\r | |
349 | * linker element is active, the linker implied by the cc elements name or\r | |
350 | * classname attribute will be used.\r | |
351 | * \r | |
352 | * @param linker\r | |
353 | * linker\r | |
354 | * @throws NullPointerException\r | |
355 | * if linker is null\r | |
356 | */\r | |
357 | public void addConfiguredLinker(LinkerDef linker) {\r | |
358 | if (linker == null) {\r | |
359 | throw new NullPointerException("linker");\r | |
360 | }\r | |
361 | linker.setProject(getProject());\r | |
362 | _linkers.addElement(linker);\r | |
363 | }\r | |
364 | \r | |
365 | /**\r | |
366 | * Adds a linker command-line arg. Argument will be inherited by all nested\r | |
367 | * linker elements that do not have inherit="false".\r | |
368 | */\r | |
369 | public void addConfiguredLinkerArg(LinkerArgument arg) {\r | |
370 | linkerDef.addConfiguredLinkerArg(arg);\r | |
371 | }\r | |
372 | \r | |
373 | /**\r | |
374 | * Add an environment variable to the launched process.\r | |
375 | */\r | |
376 | public void addEnv(Environment.Variable var) {\r | |
377 | compilerDef.addEnv(var);\r | |
378 | linkerDef.addEnv(var);\r | |
379 | assemblerDef.addEnv(var);\r | |
380 | aslcompilerDef.addEnv(var);\r | |
381 | }\r | |
382 | \r | |
383 | /**\r | |
384 | * Adds a source file set.\r | |
385 | * \r | |
386 | * Files in these filesets will be auctioned to the available compiler\r | |
387 | * configurations, with the default compiler implied by the cc element\r | |
388 | * bidding last. If no compiler is interested in the file, it will be passed\r | |
389 | * to the linker.\r | |
390 | * \r | |
391 | * To have a file be processed by a particular compiler configuration, add a\r | |
392 | * fileset to the corresponding compiler element.\r | |
393 | */\r | |
394 | public void addFileset(ConditionalFileSet srcSet) {\r | |
395 | compilerDef.addFileset(srcSet);\r | |
396 | }\r | |
397 | \r | |
398 | /**\r | |
399 | * Adds a library set.\r | |
400 | * \r | |
401 | * Library sets will be inherited by all linker elements that do not have\r | |
402 | * inherit="false".\r | |
403 | * \r | |
404 | * @param libset\r | |
405 | * library set\r | |
406 | * @throws NullPointerException\r | |
407 | * if libset is null.\r | |
408 | */\r | |
409 | public void addLibset(LibrarySet libset) {\r | |
410 | if (libset == null) {\r | |
411 | throw new NullPointerException("libset");\r | |
412 | }\r | |
413 | linkerDef.addLibset(libset);\r | |
414 | }\r | |
415 | \r | |
416 | /**\r | |
417 | * Adds a system library set. Timestamps and locations of system library\r | |
418 | * sets are not used in dependency analysis.\r | |
419 | * \r | |
420 | * Essential libraries (such as C Runtime libraries) should not be specified\r | |
421 | * since the task will attempt to identify the correct libraries based on\r | |
422 | * the multithread, debug and runtime attributes.\r | |
423 | * \r | |
424 | * System library sets will be inherited by all linker elements that do not\r | |
425 | * have inherit="false".\r | |
426 | * \r | |
427 | * @param libset\r | |
428 | * library set\r | |
429 | * @throws NullPointerException\r | |
430 | * if libset is null.\r | |
431 | */\r | |
432 | public void addSyslibset(SystemLibrarySet libset) {\r | |
433 | if (libset == null) {\r | |
434 | throw new NullPointerException("libset");\r | |
435 | }\r | |
436 | linkerDef.addSyslibset(libset);\r | |
437 | }\r | |
438 | \r | |
439 | /**\r | |
440 | * Checks all targets that are not forced to be rebuilt or are missing\r | |
441 | * object files to be checked for modified include files\r | |
442 | * \r | |
443 | * @returns total number of targets to be rebuilt\r | |
444 | * \r | |
445 | */\r | |
446 | protected int checkForChangedIncludeFiles(Hashtable targets) {\r | |
447 | int potentialTargets = 0;\r | |
448 | int definiteTargets = 0;\r | |
449 | Enumeration targetEnum = targets.elements();\r | |
450 | while (targetEnum.hasMoreElements()) {\r | |
451 | TargetInfo target = (TargetInfo) targetEnum.nextElement();\r | |
452 | if (!target.getRebuild()) {\r | |
453 | potentialTargets++;\r | |
454 | } else {\r | |
455 | definiteTargets++;\r | |
456 | }\r | |
457 | }\r | |
458 | //\r | |
459 | // If there were remaining targets that\r | |
460 | // might be out of date\r | |
461 | //\r | |
462 | if (potentialTargets > 0) {\r | |
463 | log("Starting dependency analysis for "\r | |
464 | + Integer.toString(potentialTargets) + " files.");\r | |
465 | DependencyTable dependencyTable = new DependencyTable(_objDir);\r | |
466 | try {\r | |
467 | dependencyTable.load();\r | |
468 | } catch (Exception ex) {\r | |
469 | log("Problem reading dependencies.xml: " + ex.toString());\r | |
470 | }\r | |
471 | targetEnum = targets.elements();\r | |
472 | while (targetEnum.hasMoreElements()) {\r | |
473 | TargetInfo target = (TargetInfo) targetEnum.nextElement();\r | |
474 | if (!target.getRebuild()) {\r | |
475 | if (dependencyTable.needsRebuild(this, target,\r | |
476 | dependencyDepth)) {\r | |
477 | target.mustRebuild();\r | |
478 | }\r | |
479 | }\r | |
480 | }\r | |
481 | dependencyTable.commit(this);\r | |
482 | }\r | |
483 | //\r | |
484 | // count files being rebuilt now\r | |
485 | //\r | |
486 | int currentTargets = 0;\r | |
487 | targetEnum = targets.elements();\r | |
488 | while (targetEnum.hasMoreElements()) {\r | |
489 | TargetInfo target = (TargetInfo) targetEnum.nextElement();\r | |
490 | if (target.getRebuild()) {\r | |
491 | currentTargets++;\r | |
492 | }\r | |
493 | }\r | |
494 | if (potentialTargets > 0) {\r | |
495 | log(Integer.toString(potentialTargets - currentTargets\r | |
496 | + definiteTargets)\r | |
497 | + " files are up to date.");\r | |
498 | log(Integer.toString(currentTargets - definiteTargets)\r | |
499 | + " files to be recompiled from dependency analysis.");\r | |
500 | }\r | |
501 | log(Integer.toString(currentTargets) + " total files to be compiled.");\r | |
502 | return currentTargets;\r | |
503 | }\r | |
504 | \r | |
505 | protected LinkerConfiguration collectExplicitObjectFiles(\r | |
506 | Vector objectFiles, Vector sysObjectFiles) {\r | |
507 | //\r | |
508 | // find the first eligible linker\r | |
509 | //\r | |
510 | //\r | |
511 | ProcessorConfiguration linkerConfig = null;\r | |
512 | LinkerDef selectedLinkerDef = null;\r | |
513 | Linker selectedLinker = null;\r | |
514 | Hashtable sysLibraries = new Hashtable();\r | |
515 | TargetDef targetPlatform = getTargetPlatform();\r | |
516 | FileVisitor objCollector = null;\r | |
517 | FileVisitor sysLibraryCollector = null;\r | |
518 | for (int i = 0; i < _linkers.size(); i++) {\r | |
519 | LinkerDef currentLinkerDef = (LinkerDef) _linkers.elementAt(i);\r | |
520 | if (currentLinkerDef.isActive()) {\r | |
521 | selectedLinkerDef = currentLinkerDef;\r | |
522 | selectedLinker = currentLinkerDef.getProcessor().getLinker(\r | |
523 | linkType);\r | |
524 | //\r | |
525 | // skip the linker if it doesn't know how to\r | |
526 | // produce the specified link type\r | |
527 | if (selectedLinker != null) {\r | |
528 | linkerConfig = currentLinkerDef.createConfiguration(this,\r | |
529 | linkType, linkerDef, targetPlatform);\r | |
530 | if (linkerConfig != null) {\r | |
531 | //\r | |
532 | // create collectors for object files\r | |
533 | // and system libraries\r | |
534 | objCollector = new ObjectFileCollector(selectedLinker,\r | |
535 | objectFiles);\r | |
536 | sysLibraryCollector = new SystemLibraryCollector(\r | |
537 | selectedLinker, sysLibraries);\r | |
538 | //\r | |
539 | // if the <linker> has embedded <fileset>'s\r | |
540 | // (such as linker specific libraries)\r | |
541 | // add them as object files.\r | |
542 | //\r | |
543 | if (currentLinkerDef.hasFileSets()) {\r | |
544 | currentLinkerDef.visitFiles(objCollector);\r | |
545 | }\r | |
546 | //\r | |
547 | // user libraries are just a specialized form\r | |
548 | // of an object fileset\r | |
549 | selectedLinkerDef.visitUserLibraries(selectedLinker,\r | |
550 | objCollector);\r | |
551 | }\r | |
552 | break;\r | |
553 | }\r | |
554 | }\r | |
555 | }\r | |
556 | if (linkerConfig == null) {\r | |
557 | linkerConfig = linkerDef.createConfiguration(this, linkType, null,\r | |
558 | targetPlatform);\r | |
559 | selectedLinker = (Linker) linkerDef.getProcessor().getLinker(\r | |
560 | linkType);\r | |
561 | objCollector = new ObjectFileCollector(selectedLinker, objectFiles);\r | |
562 | sysLibraryCollector = new SystemLibraryCollector(selectedLinker,\r | |
563 | sysLibraries);\r | |
564 | }\r | |
565 | //\r | |
566 | // unless there was a <linker> element that\r | |
567 | // explicitly did not inherit files from\r | |
568 | // containing <cc> element\r | |
569 | if (selectedLinkerDef == null || selectedLinkerDef.getInherit()) {\r | |
570 | linkerDef.visitUserLibraries(selectedLinker, objCollector);\r | |
571 | linkerDef.visitSystemLibraries(selectedLinker, sysLibraryCollector);\r | |
572 | }\r | |
573 | //\r | |
574 | // if there was a <syslibset> in a nested <linker>\r | |
575 | // evaluate it last so it takes priority over\r | |
576 | // identically named libs from <cc> element\r | |
577 | //\r | |
578 | if (selectedLinkerDef != null) {\r | |
579 | //\r | |
580 | // add any system libraries to the hashtable\r | |
581 | // done in reverse order so the earliest\r | |
582 | // on the classpath takes priority\r | |
583 | selectedLinkerDef.visitSystemLibraries(selectedLinker,\r | |
584 | sysLibraryCollector);\r | |
585 | }\r | |
586 | //\r | |
587 | // copy over any system libraries to the\r | |
588 | // object files vector\r | |
589 | //\r | |
590 | Enumeration sysLibEnum = sysLibraries.elements();\r | |
591 | while (sysLibEnum.hasMoreElements()) {\r | |
592 | sysObjectFiles.addElement(sysLibEnum.nextElement());\r | |
593 | }\r | |
594 | return (LinkerConfiguration) linkerConfig;\r | |
595 | }\r | |
596 | \r | |
597 | /**\r | |
598 | * Adds an include path.\r | |
599 | * \r | |
600 | * Include paths will be inherited by nested compiler elements that do not\r | |
601 | * have inherit="false".\r | |
602 | */\r | |
603 | public IncludePath createIncludePath() {\r | |
604 | return compilerDef.createIncludePath();\r | |
605 | }\r | |
606 | \r | |
607 | /**\r | |
608 | * Specifies precompilation prototype file and exclusions. Inherited by all\r | |
609 | * compilers that do not have inherit="false".\r | |
610 | * \r | |
611 | */\r | |
612 | public PrecompileDef createPrecompile() throws BuildException {\r | |
613 | return compilerDef.createPrecompile();\r | |
614 | }\r | |
615 | \r | |
616 | /**\r | |
617 | * Adds a system include path. Locations and timestamps of files located\r | |
618 | * using the system include paths are not used in dependency analysis.\r | |
619 | * \r | |
620 | * \r | |
621 | * Standard include locations should not be specified. The compiler adapters\r | |
622 | * should recognized the settings from the appropriate environment variables\r | |
623 | * or configuration files.\r | |
624 | * \r | |
625 | * System include paths will be inherited by nested compiler elements that\r | |
626 | * do not have inherit="false".\r | |
627 | */\r | |
628 | public SystemIncludePath createSysIncludePath() {\r | |
629 | return compilerDef.createSysIncludePath();\r | |
630 | }\r | |
631 | \r | |
632 | /**\r | |
633 | * Executes the task. Compiles the given files.\r | |
634 | * \r | |
635 | * @throws BuildException\r | |
636 | * if someting goes wrong with the build\r | |
637 | */\r | |
638 | public void execute() throws BuildException {\r | |
639 | //\r | |
640 | // if link type allowed objdir to be defaulted\r | |
641 | // provide it from outfile\r | |
642 | if (_objDir == null) {\r | |
643 | if (_outfile != null) {\r | |
644 | _objDir = new File(_outfile.getParent());\r | |
645 | } else {\r | |
646 | _objDir = new File(".");\r | |
647 | }\r | |
648 | }\r | |
649 | \r | |
650 | //\r | |
651 | // if the object directory does not exist\r | |
652 | //\r | |
653 | if (!_objDir.exists()) {\r | |
654 | throw new BuildException("Object directory does not exist");\r | |
655 | }\r | |
656 | \r | |
657 | //\r | |
658 | // if userdefine is true, then run all user defined command\r | |
659 | //\r | |
660 | if (userdefine) {\r | |
661 | Iterator iter = _userdefines.iterator();\r | |
662 | while( iter.hasNext()) {\r | |
663 | UserDefineDef userdefineDef = (UserDefineDef)iter.next();\r | |
664 | UserDefineCompiler userdefineCompiler = new UserDefineCompiler(this, userdefineDef);\r | |
665 | userdefineCompiler.command(this, userdefineDef);\r | |
666 | }\r | |
667 | return ;\r | |
668 | }\r | |
669 | \r | |
670 | TargetHistoryTable objHistory = new TargetHistoryTable(this, _objDir);\r | |
671 | //\r | |
672 | // determine the eventual linker configuration\r | |
673 | // (may be null) and collect any explicit\r | |
674 | // object files or libraries\r | |
675 | Vector objectFiles = new Vector();\r | |
676 | Vector sysObjectFiles = new Vector();\r | |
677 | LinkerConfiguration linkerConfig = collectExplicitObjectFiles(\r | |
678 | objectFiles, sysObjectFiles);\r | |
679 | //\r | |
680 | // Assembler hashtable of all files\r | |
681 | // that we know how to compile (keyed by output file name)\r | |
682 | //\r | |
683 | Hashtable targets = getTargets(linkerConfig, objectFiles);\r | |
684 | Hashtable acpiTarget = new Hashtable();\r | |
685 | if (aslcompiler) {\r | |
686 | acpiTarget = getAcpiTargets(linkerConfig, new Vector());\r | |
687 | }\r | |
688 | Hashtable assemblerTarget = new Hashtable();\r | |
689 | if (assembler) {\r | |
690 | assemblerTarget = getAssemblerTargets(linkerConfig, objectFiles);\r | |
691 | }\r | |
692 | TargetInfo linkTarget = null;\r | |
693 | //\r | |
694 | // if output file is not specified,\r | |
695 | // then skip link step\r | |
696 | //\r | |
697 | if (_outfile != null) {\r | |
698 | linkTarget = getLinkTarget(linkerConfig, objectFiles,\r | |
699 | sysObjectFiles, targets, assemblerTarget);\r | |
700 | }\r | |
701 | //\r | |
702 | // If specify the aslcompiler, then call asl compiler\r | |
703 | //\r | |
704 | if (aslcompiler) {\r | |
705 | BuildException acpiException = null;\r | |
706 | Hashtable targetsByConfig = getTargetsToBuildByConfiguration(acpiTarget);\r | |
707 | Enumeration acpiTargetEnum = targetsByConfig.elements();\r | |
708 | Vector[] targetVectors = new Vector[targetsByConfig.size()];\r | |
709 | int index = 0;\r | |
710 | while (acpiTargetEnum.hasMoreElements()) {\r | |
711 | Vector targetsForConfig = (Vector) acpiTargetEnum.nextElement();\r | |
712 | targetVectors[index++] = targetsForConfig;\r | |
713 | }\r | |
714 | for (int i = 0; i < targetVectors.length; i++) {\r | |
715 | //\r | |
716 | // get the targets for this configuration\r | |
717 | //\r | |
718 | Vector targetsForConfig = targetVectors[i];\r | |
719 | //\r | |
720 | // get the configuration from the first entry\r | |
721 | //\r | |
722 | AslcompilerConfiguration config = (AslcompilerConfiguration) ((TargetInfo) targetsForConfig\r | |
723 | .elementAt(0)).getConfiguration();\r | |
724 | //\r | |
725 | // prepare the list of source files\r | |
726 | //\r | |
727 | String[] sourceFiles = new String[targetsForConfig.size()];\r | |
728 | Enumeration targetsEnum = targetsForConfig.elements();\r | |
729 | index = 0;\r | |
730 | while (targetsEnum.hasMoreElements()) {\r | |
731 | TargetInfo targetInfo = ((TargetInfo) targetsEnum\r | |
732 | .nextElement());\r | |
733 | sourceFiles[index++] = targetInfo.getSources()[0]\r | |
734 | .toString();\r | |
735 | }\r | |
736 | try {\r | |
737 | config.aslcompiler(this, _objDir, sourceFiles);\r | |
738 | log(sourceFiles.length\r | |
739 | + " total ACPI source files to be compiled.");\r | |
740 | } catch (BuildException ex) {\r | |
741 | if (acpiException == null) {\r | |
742 | acpiException = ex;\r | |
743 | }\r | |
744 | if (!relentless)\r | |
745 | break;\r | |
746 | }\r | |
747 | }\r | |
748 | }\r | |
749 | //\r | |
750 | // If specify the assembler, then call assembler\r | |
751 | //\r | |
752 | if (assembler) {\r | |
753 | BuildException assemblerException = null;\r | |
754 | Hashtable targetsByConfig = getTargetsToBuildByConfiguration(assemblerTarget);\r | |
755 | Enumeration assembleTargetEnum = targetsByConfig.elements();\r | |
756 | Vector[] targetVectors = new Vector[targetsByConfig.size()];\r | |
757 | int index = 0;\r | |
758 | while (assembleTargetEnum.hasMoreElements()) {\r | |
759 | Vector targetsForConfig = (Vector) assembleTargetEnum\r | |
760 | .nextElement();\r | |
761 | targetVectors[index++] = targetsForConfig;\r | |
762 | }\r | |
763 | for (int i = 0; i < targetVectors.length; i++) {\r | |
764 | //\r | |
765 | // get the targets for this configuration\r | |
766 | //\r | |
767 | Vector targetsForConfig = targetVectors[i];\r | |
768 | //\r | |
769 | // get the configuration from the first entry\r | |
770 | //\r | |
771 | AssemblerConfiguration config = (AssemblerConfiguration) ((TargetInfo) targetsForConfig\r | |
772 | .elementAt(0)).getConfiguration();\r | |
773 | //\r | |
774 | // prepare the list of source files\r | |
775 | //\r | |
776 | String[] sourceFiles = new String[targetsForConfig.size()];\r | |
777 | Enumeration targetsEnum = targetsForConfig.elements();\r | |
778 | index = 0;\r | |
779 | while (targetsEnum.hasMoreElements()) {\r | |
780 | TargetInfo targetInfo = ((TargetInfo) targetsEnum\r | |
781 | .nextElement());\r | |
782 | sourceFiles[index++] = targetInfo.getSources()[0]\r | |
783 | .toString();\r | |
784 | }\r | |
785 | try {\r | |
786 | config.assembler(this, _objDir, sourceFiles);\r | |
787 | log(sourceFiles.length + " total files to be assembled.");\r | |
788 | } catch (BuildException ex) {\r | |
789 | if (assemblerException == null) {\r | |
790 | assemblerException = ex;\r | |
791 | }\r | |
792 | if (!relentless)\r | |
793 | break;\r | |
794 | }\r | |
795 | }\r | |
796 | //\r | |
797 | // if we threw a assembler exception and\r | |
798 | // didn't throw it at the time because\r | |
799 | // we were relentless then\r | |
800 | // save the history and\r | |
801 | // throw the exception\r | |
802 | //\r | |
803 | if (assemblerException != null) {\r | |
804 | if (failOnError) {\r | |
805 | throw assemblerException;\r | |
806 | } else {\r | |
807 | log(assemblerException.getMessage(), Project.MSG_ERR);\r | |
808 | return;\r | |
809 | }\r | |
810 | }\r | |
811 | }\r | |
812 | \r | |
813 | //\r | |
814 | // mark targets that don't have a history record or\r | |
815 | // whose source last modification time is not\r | |
816 | // the same as the history to be rebuilt\r | |
817 | //\r | |
818 | objHistory.markForRebuild(targets);\r | |
819 | CCTaskProgressMonitor monitor = new CCTaskProgressMonitor(objHistory);\r | |
820 | //\r | |
821 | // check for changed include files\r | |
822 | //\r | |
823 | int rebuildCount = checkForChangedIncludeFiles(targets);\r | |
824 | if (rebuildCount > 0) {\r | |
825 | BuildException compileException = null;\r | |
826 | //\r | |
827 | // compile all targets with getRebuild() == true\r | |
828 | //\r | |
829 | Hashtable targetsByConfig = getTargetsToBuildByConfiguration(targets);\r | |
830 | //\r | |
831 | // build array containing Vectors with precompiled generation\r | |
832 | // steps going first\r | |
833 | //\r | |
834 | Vector[] targetVectors = new Vector[targetsByConfig.size()];\r | |
835 | int index = 0;\r | |
836 | Enumeration targetVectorEnum = targetsByConfig.elements();\r | |
837 | while (targetVectorEnum.hasMoreElements()) {\r | |
838 | Vector targetsForConfig = (Vector) targetVectorEnum\r | |
839 | .nextElement();\r | |
840 | //\r | |
841 | // get the configuration from the first entry\r | |
842 | //\r | |
843 | CompilerConfiguration config = (CompilerConfiguration) ((TargetInfo) targetsForConfig\r | |
844 | .elementAt(0)).getConfiguration();\r | |
845 | if (config.isPrecompileGeneration()) {\r | |
846 | targetVectors[index++] = targetsForConfig;\r | |
847 | }\r | |
848 | }\r | |
849 | targetVectorEnum = targetsByConfig.elements();\r | |
850 | while (targetVectorEnum.hasMoreElements()) {\r | |
851 | Vector targetsForConfig = (Vector) targetVectorEnum\r | |
852 | .nextElement();\r | |
853 | for (int i = 0; i < targetVectors.length; i++) {\r | |
854 | if (targetVectors[i] == targetsForConfig) {\r | |
855 | break;\r | |
856 | }\r | |
857 | if (targetVectors[i] == null) {\r | |
858 | targetVectors[i] = targetsForConfig;\r | |
859 | break;\r | |
860 | }\r | |
861 | }\r | |
862 | }\r | |
863 | for (int i = 0; i < targetVectors.length; i++) {\r | |
864 | //\r | |
865 | // get the targets for this configuration\r | |
866 | //\r | |
867 | Vector targetsForConfig = targetVectors[i];\r | |
868 | //\r | |
869 | // get the configuration from the first entry\r | |
870 | //\r | |
871 | CompilerConfiguration config = (CompilerConfiguration) ((TargetInfo) targetsForConfig\r | |
872 | .elementAt(0)).getConfiguration();\r | |
873 | //\r | |
874 | // prepare the list of source files\r | |
875 | //\r | |
876 | String[] sourceFiles = new String[targetsForConfig.size()];\r | |
877 | Enumeration targetsEnum = targetsForConfig.elements();\r | |
878 | index = 0;\r | |
879 | while (targetsEnum.hasMoreElements()) {\r | |
880 | TargetInfo targetInfo = ((TargetInfo) targetsEnum\r | |
881 | .nextElement());\r | |
882 | sourceFiles[index++] = targetInfo.getSources()[0]\r | |
883 | .toString();\r | |
884 | }\r | |
885 | try {\r | |
886 | config.compile(this, _objDir, sourceFiles, relentless,\r | |
887 | monitor);\r | |
888 | } catch (BuildException ex) {\r | |
889 | if (compileException == null) {\r | |
890 | compileException = ex;\r | |
891 | }\r | |
892 | if (!relentless)\r | |
893 | break;\r | |
894 | }\r | |
895 | }\r | |
896 | //\r | |
897 | // save the details of the object file compilation\r | |
898 | // settings to disk for dependency analysis\r | |
899 | //\r | |
900 | try {\r | |
901 | objHistory.commit();\r | |
902 | } catch (IOException ex) {\r | |
903 | this.log("Error writing history.xml: " + ex.toString());\r | |
904 | }\r | |
905 | //\r | |
906 | // if we threw a compile exception and\r | |
907 | // didn't throw it at the time because\r | |
908 | // we were relentless then\r | |
909 | // save the history and\r | |
910 | // throw the exception\r | |
911 | //\r | |
912 | if (compileException != null) {\r | |
913 | if (failOnError) {\r | |
914 | throw compileException;\r | |
915 | } else {\r | |
916 | log(compileException.getMessage(), Project.MSG_ERR);\r | |
917 | return;\r | |
918 | }\r | |
919 | }\r | |
920 | }\r | |
921 | //\r | |
922 | // if the dependency tree was not fully\r | |
923 | // evaluated, then throw an exception\r | |
924 | // since we really didn't do what we\r | |
925 | // should have done\r | |
926 | //\r | |
927 | //\r | |
928 | if (dependencyDepth >= 0) {\r | |
929 | throw new BuildException(\r | |
930 | "All files at depth "\r | |
931 | + Integer.toString(dependencyDepth)\r | |
932 | + " from changes successfully compiled.\n"\r | |
933 | + "Remove or change dependencyDepth to -1 to perform full compilation.");\r | |
934 | }\r | |
935 | //\r | |
936 | // if no link target then\r | |
937 | // commit the history for the object files\r | |
938 | // and leave the task\r | |
939 | if (linkTarget != null) {\r | |
940 | //\r | |
941 | // get the history for the link target (may be the same\r | |
942 | // as the object history)\r | |
943 | TargetHistoryTable linkHistory = getLinkHistory(objHistory);\r | |
944 | //\r | |
945 | // see if it needs to be rebuilt\r | |
946 | //\r | |
947 | linkHistory.markForRebuild(linkTarget);\r | |
948 | //\r | |
949 | // if it needs to be rebuilt, rebuild it\r | |
950 | //\r | |
951 | File output = linkTarget.getOutput();\r | |
952 | if (linkTarget.getRebuild()) {\r | |
953 | log("Starting link");\r | |
954 | LinkerConfiguration linkConfig = (LinkerConfiguration) linkTarget\r | |
955 | .getConfiguration();\r | |
956 | if (failOnError) {\r | |
957 | linkConfig.link(this, linkTarget);\r | |
958 | } else {\r | |
959 | try {\r | |
960 | linkConfig.link(this, linkTarget);\r | |
961 | } catch (BuildException ex) {\r | |
962 | log(ex.getMessage(), Project.MSG_ERR);\r | |
963 | return;\r | |
964 | }\r | |
965 | }\r | |
966 | if (outputFileProperty != null)\r | |
967 | getProject().setProperty(outputFileProperty,\r | |
968 | output.getAbsolutePath());\r | |
969 | linkHistory.update(linkTarget);\r | |
970 | try {\r | |
971 | linkHistory.commit();\r | |
972 | } catch (IOException ex) {\r | |
973 | log("Error writing link history.xml: " + ex.toString());\r | |
974 | }\r | |
975 | } else {\r | |
976 | if (outputFileProperty != null)\r | |
977 | getProject().setProperty(outputFileProperty,\r | |
978 | output.getAbsolutePath());\r | |
979 | }\r | |
980 | }\r | |
981 | }\r | |
982 | \r | |
983 | /**\r | |
984 | * Gets the dataset.\r | |
985 | * \r | |
986 | * @return Returns a String\r | |
987 | */\r | |
988 | public String getDataset() {\r | |
989 | return dataset;\r | |
990 | }\r | |
991 | \r | |
992 | protected TargetHistoryTable getLinkHistory(TargetHistoryTable objHistory) {\r | |
993 | File outputFileDir = new File(_outfile.getParent());\r | |
994 | //\r | |
995 | // if the output file is being produced in the link\r | |
996 | // directory, then we can use the same history file\r | |
997 | //\r | |
998 | if (_objDir.equals(outputFileDir)) {\r | |
999 | return objHistory;\r | |
1000 | }\r | |
1001 | return new TargetHistoryTable(this, outputFileDir);\r | |
1002 | }\r | |
1003 | \r | |
1004 | protected TargetInfo getLinkTarget(LinkerConfiguration linkerConfig,\r | |
1005 | Vector objectFiles, Vector sysObjectFiles,\r | |
1006 | Hashtable compileTargets, Hashtable assemblerTargets) {\r | |
1007 | //\r | |
1008 | // walk the compile phase targets and\r | |
1009 | // add those sources that have already been\r | |
1010 | // assigned to the linker or\r | |
1011 | // our output files the linker knows how to consume\r | |
1012 | // files the linker knows how to consume\r | |
1013 | //\r | |
1014 | Enumeration compileTargetsEnum = compileTargets.elements();\r | |
1015 | while (compileTargetsEnum.hasMoreElements()) {\r | |
1016 | TargetInfo compileTarget = (TargetInfo) compileTargetsEnum\r | |
1017 | .nextElement();\r | |
1018 | //\r | |
1019 | // output of compile tasks\r | |
1020 | //\r | |
1021 | int bid = linkerConfig.bid(compileTarget.getOutput().toString());\r | |
1022 | if (bid > 0) {\r | |
1023 | objectFiles.addElement(compileTarget.getOutput());\r | |
1024 | }\r | |
1025 | }\r | |
1026 | //\r | |
1027 | // walk the assembler phase targets and\r | |
1028 | // add those sources that have already been\r | |
1029 | // assigned to the linker or\r | |
1030 | // our output files the linker knows how to consume\r | |
1031 | // files the linker knows how to consume\r | |
1032 | //\r | |
1033 | Enumeration assembleTargetsEnum = assemblerTargets.elements();\r | |
1034 | while (assembleTargetsEnum.hasMoreElements()) {\r | |
1035 | TargetInfo assemblerTarget = (TargetInfo) assembleTargetsEnum\r | |
1036 | .nextElement();\r | |
1037 | //\r | |
1038 | // output of assemble tasks\r | |
1039 | //\r | |
1040 | int bid = linkerConfig.bid(assemblerTarget.getOutput().toString());\r | |
1041 | if (bid > 0) {\r | |
1042 | objectFiles.addElement(assemblerTarget.getOutput());\r | |
1043 | }\r | |
1044 | }\r | |
1045 | File[] objectFileArray = new File[objectFiles.size()];\r | |
1046 | objectFiles.copyInto(objectFileArray);\r | |
1047 | File[] sysObjectFileArray = new File[sysObjectFiles.size()];\r | |
1048 | sysObjectFiles.copyInto(sysObjectFileArray);\r | |
1049 | String baseName = _outfile.getName();\r | |
1050 | String fullName = linkerConfig.getOutputFileName(baseName);\r | |
1051 | File outputFile = new File(_outfile.getParent(), fullName);\r | |
1052 | return new TargetInfo(linkerConfig, objectFileArray,\r | |
1053 | sysObjectFileArray, outputFile, linkerConfig\r | |
1054 | .getRebuild());\r | |
1055 | }\r | |
1056 | \r | |
1057 | public File getObjdir() {\r | |
1058 | return _objDir;\r | |
1059 | }\r | |
1060 | \r | |
1061 | public File getOutfile() {\r | |
1062 | return _outfile;\r | |
1063 | }\r | |
1064 | \r | |
1065 | public TargetDef getTargetPlatform() {\r | |
1066 | return null;\r | |
1067 | }\r | |
1068 | \r | |
1069 | /**\r | |
1070 | * This method collects a Hashtable, keyed by output file name, of\r | |
1071 | * TargetInfo's for every source file that is specified in the filesets of\r | |
1072 | * the <aslcompiler> elements. The TargetInfo's contain the appropriate ACPI\r | |
1073 | * configurations for their possible acpi\r | |
1074 | * \r | |
1075 | */\r | |
1076 | private Hashtable getAcpiTargets(LinkerConfiguration linkerConfig,\r | |
1077 | Vector objectFiles) {\r | |
1078 | Hashtable targets = new Hashtable(1000);\r | |
1079 | TargetDef targetPlatform = getTargetPlatform();\r | |
1080 | Vector biddingProcessors = new Vector(_aslcompiler.size());\r | |
1081 | for (int i = 0; i < _aslcompiler.size(); i++) {\r | |
1082 | AslcompilerDef currentAslDef = (AslcompilerDef) _aslcompiler\r | |
1083 | .elementAt(i);\r | |
1084 | if (currentAslDef.isActive()) {\r | |
1085 | ProcessorConfiguration config = currentAslDef\r | |
1086 | .createConfiguration(this, linkType,\r | |
1087 | aslcompilerDef, targetPlatform);\r | |
1088 | //\r | |
1089 | // if the aslcompiler has a fileset\r | |
1090 | // then allow it to add its files to\r | |
1091 | // the set of potential targets\r | |
1092 | //\r | |
1093 | ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };\r | |
1094 | if (currentAslDef.hasFileSets()) {\r | |
1095 | TargetMatcher matcher = new TargetMatcher(this, _objDir,\r | |
1096 | localConfigs, linkerConfig, objectFiles,\r | |
1097 | targets);\r | |
1098 | currentAslDef.visitFiles(matcher);\r | |
1099 | }\r | |
1100 | biddingProcessors.addElement(config);\r | |
1101 | }\r | |
1102 | }\r | |
1103 | //\r | |
1104 | // add fallback compiler at the end\r | |
1105 | //\r | |
1106 | ProcessorConfiguration config = aslcompilerDef.createConfiguration(\r | |
1107 | this, linkType, null, targetPlatform);\r | |
1108 | biddingProcessors.addElement(config);\r | |
1109 | ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors\r | |
1110 | .size()];\r | |
1111 | biddingProcessors.copyInto(bidders);\r | |
1112 | TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,\r | |
1113 | linkerConfig, objectFiles, targets);\r | |
1114 | aslcompilerDef.visitFiles(matcher);\r | |
1115 | return targets;\r | |
1116 | }\r | |
1117 | \r | |
1118 | /**\r | |
1119 | * This method collects a Hashtable, keyed by output file name, of\r | |
1120 | * TargetInfo's for every source file that is specified in the filesets of\r | |
1121 | * the <assembler> elements. The TargetInfo's contain the appropriate\r | |
1122 | * assembler configurations for their possible assembly\r | |
1123 | * \r | |
1124 | */\r | |
1125 | private Hashtable getAssemblerTargets(LinkerConfiguration linkerConfig,\r | |
1126 | Vector objectFiles) {\r | |
1127 | Hashtable targets = new Hashtable(1000);\r | |
1128 | TargetDef targetPlatform = getTargetPlatform();\r | |
1129 | Vector biddingProcessors = new Vector(_assemblers.size());\r | |
1130 | for (int i = 0; i < _assemblers.size(); i++) {\r | |
1131 | AssemblerDef currentAssemblerDef = (AssemblerDef) _assemblers\r | |
1132 | .elementAt(i);\r | |
1133 | if (currentAssemblerDef.isActive()) {\r | |
1134 | ProcessorConfiguration config = currentAssemblerDef\r | |
1135 | .createConfiguration(this, linkType,\r | |
1136 | assemblerDef, targetPlatform);\r | |
1137 | //\r | |
1138 | // if the assembler has a fileset\r | |
1139 | // then allow it to add its files to\r | |
1140 | // the set of potential targets\r | |
1141 | //\r | |
1142 | ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };\r | |
1143 | if (currentAssemblerDef.hasFileSets()) {\r | |
1144 | TargetMatcher matcher = new TargetMatcher(this, _objDir,\r | |
1145 | localConfigs, linkerConfig, objectFiles,\r | |
1146 | targets);\r | |
1147 | currentAssemblerDef.visitFiles(matcher);\r | |
1148 | }\r | |
1149 | biddingProcessors.addElement(config);\r | |
1150 | }\r | |
1151 | }\r | |
1152 | //\r | |
1153 | // add fallback assembler at the end\r | |
1154 | //\r | |
1155 | ProcessorConfiguration config = assemblerDef.createConfiguration(this,\r | |
1156 | linkType, null, targetPlatform);\r | |
1157 | biddingProcessors.addElement(config);\r | |
1158 | ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors\r | |
1159 | .size()];\r | |
1160 | biddingProcessors.copyInto(bidders);\r | |
1161 | TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,\r | |
1162 | linkerConfig, objectFiles, targets);\r | |
1163 | assemblerDef.visitFiles(matcher);\r | |
1164 | return targets;\r | |
1165 | }\r | |
1166 | \r | |
1167 | /**\r | |
1168 | * This method collects a Hashtable, keyed by output file name, of\r | |
1169 | * TargetInfo's for every source file that is specified in the filesets of\r | |
1170 | * the <cc>and nested <compiler>elements. The TargetInfo's contain the\r | |
1171 | * appropriate compiler configurations for their possible compilation\r | |
1172 | * \r | |
1173 | */\r | |
1174 | private Hashtable getTargets(LinkerConfiguration linkerConfig,\r | |
1175 | Vector objectFiles) {\r | |
1176 | Hashtable targets = new Hashtable(1000);\r | |
1177 | TargetDef targetPlatform = getTargetPlatform();\r | |
1178 | //\r | |
1179 | // find active (specialized) compilers\r | |
1180 | //\r | |
1181 | Vector biddingProcessors = new Vector(_compilers.size());\r | |
1182 | for (int i = 0; i < _compilers.size(); i++) {\r | |
1183 | CompilerDef currentCompilerDef = (CompilerDef) _compilers\r | |
1184 | .elementAt(i);\r | |
1185 | if (currentCompilerDef.isActive()) {\r | |
1186 | ProcessorConfiguration config = currentCompilerDef\r | |
1187 | .createConfiguration(this, linkType,\r | |
1188 | compilerDef, targetPlatform);\r | |
1189 | //\r | |
1190 | // see if this processor had a precompile child element\r | |
1191 | //\r | |
1192 | PrecompileDef precompileDef = currentCompilerDef\r | |
1193 | .getActivePrecompile(compilerDef);\r | |
1194 | ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };\r | |
1195 | //\r | |
1196 | // if it does then\r | |
1197 | //\r | |
1198 | if (precompileDef != null) {\r | |
1199 | File prototype = precompileDef.getPrototype();\r | |
1200 | //\r | |
1201 | // will throw exceptions if prototype doesn't exist, etc\r | |
1202 | //\r | |
1203 | if (!prototype.exists()) {\r | |
1204 | throw new BuildException("prototype ("\r | |
1205 | + prototype.toString()\r | |
1206 | + ") does not exist.");\r | |
1207 | }\r | |
1208 | if (prototype.isDirectory()) {\r | |
1209 | throw new BuildException("prototype ("\r | |
1210 | + prototype.toString()\r | |
1211 | + ") is a directory.");\r | |
1212 | }\r | |
1213 | String[] exceptFiles = precompileDef.getExceptFiles();\r | |
1214 | //\r | |
1215 | // create a precompile building and precompile using\r | |
1216 | // variants of the configuration\r | |
1217 | // or return null if compiler doesn't support\r | |
1218 | // precompilation\r | |
1219 | CompilerConfiguration[] configs = ((CompilerConfiguration) config)\r | |
1220 | .createPrecompileConfigurations(prototype,\r | |
1221 | exceptFiles);\r | |
1222 | if (configs != null && configs.length == 2) {\r | |
1223 | //\r | |
1224 | // visit the precompiled file to add it into the\r | |
1225 | // targets list (just like any other file if\r | |
1226 | // compiler doesn't support precompilation)\r | |
1227 | TargetMatcher matcher = new TargetMatcher(\r | |
1228 | this,\r | |
1229 | _objDir,\r | |
1230 | new ProcessorConfiguration[] { configs[0] },\r | |
1231 | linkerConfig, objectFiles, targets);\r | |
1232 | matcher.visit(new File(prototype.getParent()),\r | |
1233 | prototype.getName());\r | |
1234 | //\r | |
1235 | // only the configuration that uses the\r | |
1236 | // precompiled header gets added to the bidding list\r | |
1237 | biddingProcessors.addElement(configs[1]);\r | |
1238 | localConfigs = new ProcessorConfiguration[2];\r | |
1239 | localConfigs[0] = configs[1];\r | |
1240 | localConfigs[1] = config;\r | |
1241 | }\r | |
1242 | }\r | |
1243 | //\r | |
1244 | // if the compiler has a fileset\r | |
1245 | // then allow it to add its files\r | |
1246 | // to the set of potential targets\r | |
1247 | if (currentCompilerDef.hasFileSets()) {\r | |
1248 | TargetMatcher matcher = new TargetMatcher(this, _objDir,\r | |
1249 | localConfigs, linkerConfig, objectFiles,\r | |
1250 | targets);\r | |
1251 | currentCompilerDef.visitFiles(matcher);\r | |
1252 | }\r | |
1253 | biddingProcessors.addElement(config);\r | |
1254 | }\r | |
1255 | }\r | |
1256 | //\r | |
1257 | // add fallback compiler at the end\r | |
1258 | //\r | |
1259 | ProcessorConfiguration config = compilerDef.createConfiguration(this,\r | |
1260 | linkType, null, targetPlatform);\r | |
1261 | biddingProcessors.addElement(config);\r | |
1262 | ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors\r | |
1263 | .size()];\r | |
1264 | biddingProcessors.copyInto(bidders);\r | |
1265 | //\r | |
1266 | // bid out the <fileset>'s in the cctask\r | |
1267 | //\r | |
1268 | TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,\r | |
1269 | linkerConfig, objectFiles, targets);\r | |
1270 | compilerDef.visitFiles(matcher);\r | |
1271 | return targets;\r | |
1272 | }\r | |
1273 | \r | |
1274 | /**\r | |
1275 | * Sets the default compiler adapter. Use the "name" attribute when the\r | |
1276 | * compiler is a supported compiler.\r | |
1277 | * \r | |
1278 | * @param classname\r | |
1279 | * fully qualified classname which implements CompilerAdapter\r | |
1280 | */\r | |
1281 | public void setClassname(String classname) {\r | |
1282 | compilerDef.setClassname(classname);\r | |
1283 | linkerDef.setClassname(classname);\r | |
1284 | assemblerDef.setClassname(classname);\r | |
1285 | aslcompilerDef.setClassname(classname);\r | |
1286 | }\r | |
1287 | \r | |
1288 | /**\r | |
1289 | * Sets the dataset for OS/390 builds.\r | |
1290 | * \r | |
1291 | * @param dataset\r | |
1292 | * The dataset to set\r | |
1293 | */\r | |
1294 | public void setDataset(String dataset) {\r | |
1295 | this.dataset = dataset;\r | |
1296 | }\r | |
1297 | \r | |
1298 | /**\r | |
1299 | * Enables or disables generation of debug info.\r | |
1300 | */\r | |
1301 | public void setDebug(boolean debug) {\r | |
1302 | compilerDef.setDebug(debug);\r | |
1303 | linkerDef.setDebug(debug);\r | |
1304 | assemblerDef.setDebug(debug);\r | |
1305 | aslcompilerDef.setDebug(debug);\r | |
1306 | }\r | |
1307 | \r | |
1308 | /**\r | |
1309 | * Deprecated.\r | |
1310 | * \r | |
1311 | * Controls the depth of the dependency evaluation. Used to do a quick check\r | |
1312 | * of changes before a full build.\r | |
1313 | * \r | |
1314 | * Any negative value which will perform full dependency checking. Positive\r | |
1315 | * values will truncate dependency checking. A value of 0 will cause only\r | |
1316 | * those files that changed to be recompiled, a value of 1 which cause files\r | |
1317 | * that changed or that explicitly include a file that changed to be\r | |
1318 | * recompiled.\r | |
1319 | * \r | |
1320 | * Any non-negative value will cause a BuildException to be thrown before\r | |
1321 | * attempting a link or completing the task.\r | |
1322 | * \r | |
1323 | */\r | |
1324 | public void setDependencyDepth(int depth) {\r | |
1325 | dependencyDepth = depth;\r | |
1326 | }\r | |
1327 | \r | |
1328 | /**\r | |
1329 | * Enables generation of exception handling code\r | |
1330 | */\r | |
1331 | public void setExceptions(boolean exceptions) {\r | |
1332 | compilerDef.setExceptions(exceptions);\r | |
1333 | }\r | |
1334 | \r | |
1335 | /**\r | |
1336 | * Enables run-time type information.\r | |
1337 | */\r | |
1338 | public void setRtti(boolean rtti) {\r | |
1339 | compilerDef.setRtti(rtti);\r | |
1340 | }\r | |
1341 | \r | |
1342 | // public LinkType getLinkType() {\r | |
1343 | // return linkType;\r | |
1344 | // }\r | |
1345 | /**\r | |
1346 | * Enables or disables incremental linking.\r | |
1347 | * \r | |
1348 | * @param incremental\r | |
1349 | * new state\r | |
1350 | */\r | |
1351 | public void setIncremental(boolean incremental) {\r | |
1352 | linkerDef.setIncremental(incremental);\r | |
1353 | }\r | |
1354 | \r | |
1355 | /**\r | |
1356 | * Set use of libtool.\r | |
1357 | * \r | |
1358 | * If set to true, the "libtool " will be prepended to the command line for\r | |
1359 | * compatible processors\r | |
1360 | * \r | |
1361 | * @param libtool\r | |
1362 | * If true, use libtool.\r | |
1363 | */\r | |
1364 | public void setLibtool(boolean libtool) {\r | |
1365 | compilerDef.setLibtool(libtool);\r | |
1366 | linkerDef.setLibtool(libtool);\r | |
1367 | assemblerDef.setLibtool(libtool);\r | |
1368 | aslcompilerDef.setLibtool(libtool);\r | |
1369 | }\r | |
1370 | \r | |
1371 | /**\r | |
1372 | * Sets the output file type. Supported values "executable", "shared", and\r | |
1373 | * "static". Deprecated, specify outtype instead.\r | |
1374 | * \r | |
1375 | * @deprecated\r | |
1376 | */\r | |
1377 | public void setLink(OutputTypeEnum outputType) {\r | |
1378 | linkType.setOutputType(outputType);\r | |
1379 | }\r | |
1380 | \r | |
1381 | /**\r | |
1382 | * Enables or disables generation of multithreaded code\r | |
1383 | * \r | |
1384 | * @param multi\r | |
1385 | * If true, generated code may be multithreaded.\r | |
1386 | */\r | |
1387 | public void setMultithreaded(boolean multi) {\r | |
1388 | compilerDef.setMultithreaded(multi);\r | |
1389 | }\r | |
1390 | \r | |
1391 | //\r | |
1392 | // keep near duplicate comment at CompilerDef.setName in sync\r | |
1393 | //\r | |
1394 | /**\r | |
1395 | * Sets type of the default compiler and linker.\r | |
1396 | * \r | |
1397 | * <table width="100%" border="1"> <thead>Supported compilers </thead>\r | |
1398 | * <tr>\r | |
1399 | * <td>gcc (default)</td>\r | |
1400 | * <td>GCC C++ compiler</td>\r | |
1401 | * </tr>\r | |
1402 | * <tr>\r | |
1403 | * <td>g++</td>\r | |
1404 | * <td>GCC C++ compiler</td>\r | |
1405 | * </tr>\r | |
1406 | * <tr>\r | |
1407 | * <td>c++</td>\r | |
1408 | * <td>GCC C++ compiler</td>\r | |
1409 | * </tr>\r | |
1410 | * <tr>\r | |
1411 | * <td>g77</td>\r | |
1412 | * <td>GNU FORTRAN compiler</td>\r | |
1413 | * </tr>\r | |
1414 | * <tr>\r | |
1415 | * <td>msvc</td>\r | |
1416 | * <td>Microsoft Visual C++</td>\r | |
1417 | * </tr>\r | |
1418 | * <tr>\r | |
1419 | * <td>bcc</td>\r | |
1420 | * <td>Borland C++ Compiler</td>\r | |
1421 | * </tr>\r | |
1422 | * <tr>\r | |
1423 | * <td>msrc</td>\r | |
1424 | * <td>Microsoft Resource Compiler</td>\r | |
1425 | * </tr>\r | |
1426 | * <tr>\r | |
1427 | * <td>brc</td>\r | |
1428 | * <td>Borland Resource Compiler</td>\r | |
1429 | * </tr>\r | |
1430 | * <tr>\r | |
1431 | * <td>df</td>\r | |
1432 | * <td>Compaq Visual Fortran Compiler</td>\r | |
1433 | * </tr>\r | |
1434 | * <tr>\r | |
1435 | * <td>midl</td>\r | |
1436 | * <td>Microsoft MIDL Compiler</td>\r | |
1437 | * </tr>\r | |
1438 | * <tr>\r | |
1439 | * <td>icl</td>\r | |
1440 | * <td>Intel C++ compiler for Windows (IA-32)</td>\r | |
1441 | * </tr>\r | |
1442 | * <tr>\r | |
1443 | * <td>ecl</td>\r | |
1444 | * <td>Intel C++ compiler for Windows (IA-64)</td>\r | |
1445 | * </tr>\r | |
1446 | * <tr>\r | |
1447 | * <td>icc</td>\r | |
1448 | * <td>Intel C++ compiler for Linux (IA-32)</td>\r | |
1449 | * </tr>\r | |
1450 | * <tr>\r | |
1451 | * <td>ecc</td>\r | |
1452 | * <td>Intel C++ compiler for Linux (IA-64)</td>\r | |
1453 | * </tr>\r | |
1454 | * <tr>\r | |
1455 | * <td>CC</td>\r | |
1456 | * <td>Sun ONE C++ compiler</td>\r | |
1457 | * </tr>\r | |
1458 | * <tr>\r | |
1459 | * <td>aCC</td>\r | |
1460 | * <td>HP aC++ C++ Compiler</td>\r | |
1461 | * </tr>\r | |
1462 | * <tr>\r | |
1463 | * <td>os390</td>\r | |
1464 | * <td>OS390 C Compiler</td>\r | |
1465 | * </tr>\r | |
1466 | * <tr>\r | |
1467 | * <td>os400</td>\r | |
1468 | * <td>Icc Compiler</td>\r | |
1469 | * </tr>\r | |
1470 | * <tr>\r | |
1471 | * <td>sunc89</td>\r | |
1472 | * <td>Sun C89 C Compiler</td>\r | |
1473 | * </tr>\r | |
1474 | * <tr>\r | |
1475 | * <td>xlC</td>\r | |
1476 | * <td>VisualAge C Compiler</td>\r | |
1477 | * </tr>\r | |
1478 | * </table>\r | |
1479 | * \r | |
1480 | */\r | |
1481 | public void setName(CompilerEnum name) {\r | |
1482 | compilerDef.setName(name);\r | |
1483 | Processor compiler = compilerDef.getProcessor();\r | |
1484 | Linker linker = compiler.getLinker(linkType);\r | |
1485 | linkerDef.setProcessor(linker);\r | |
1486 | }\r | |
1487 | \r | |
1488 | /**\r | |
1489 | * Do not propagate old environment when new environment variables are\r | |
1490 | * specified.\r | |
1491 | */\r | |
1492 | public void setNewenvironment(boolean newenv) {\r | |
1493 | compilerDef.setNewenvironment(newenv);\r | |
1494 | linkerDef.setNewenvironment(newenv);\r | |
1495 | assemblerDef.setNewenvironment(newenv);\r | |
1496 | aslcompilerDef.setNewenvironment(newenv);\r | |
1497 | }\r | |
1498 | \r | |
1499 | /**\r | |
1500 | * Sets the destination directory for object files.\r | |
1501 | * \r | |
1502 | * Generally this should be a property expression that evaluates to distinct\r | |
1503 | * debug and release object file directories.\r | |
1504 | * \r | |
1505 | * @param dir\r | |
1506 | * object directory\r | |
1507 | */\r | |
1508 | public void setObjdir(File dir) {\r | |
1509 | if (dir == null) {\r | |
1510 | throw new NullPointerException("dir");\r | |
1511 | }\r | |
1512 | _objDir = dir;\r | |
1513 | }\r | |
1514 | \r | |
1515 | /**\r | |
1516 | * Sets the output file name. If not specified, the task will only compile\r | |
1517 | * files and not attempt to link. If an extension is not specified, the task\r | |
1518 | * may use a system appropriate extension and prefix, for example,\r | |
1519 | * outfile="example" may result in "libexample.so" being created.\r | |
1520 | * \r | |
1521 | * @param outfile\r | |
1522 | * output file name\r | |
1523 | */\r | |
1524 | public void setOutfile(File outfile) {\r | |
1525 | //\r | |
1526 | // if file name was empty, skip link step\r | |
1527 | //\r | |
1528 | if (outfile == null || outfile.toString().length() > 0) {\r | |
1529 | _outfile = outfile;\r | |
1530 | }\r | |
1531 | }\r | |
1532 | \r | |
1533 | /**\r | |
1534 | * Specifies the name of a property to set with the physical filename that\r | |
1535 | * is produced by the linker\r | |
1536 | */\r | |
1537 | public void setOutputFileProperty(String outputFileProperty) {\r | |
1538 | this.outputFileProperty = outputFileProperty;\r | |
1539 | }\r | |
1540 | \r | |
1541 | /**\r | |
1542 | * Sets the output file type. Supported values "executable", "shared", and\r | |
1543 | * "static".\r | |
1544 | */\r | |
1545 | public void setOuttype(OutputTypeEnum outputType) {\r | |
1546 | linkType.setOutputType(outputType);\r | |
1547 | }\r | |
1548 | \r | |
1549 | /**\r | |
1550 | * Sets the project.\r | |
1551 | */\r | |
1552 | public void setProject(Project project) {\r | |
1553 | super.setProject(project);\r | |
1554 | compilerDef.setProject(project);\r | |
1555 | linkerDef.setProject(project);\r | |
1556 | assemblerDef.setProject(project);\r | |
1557 | aslcompilerDef.setProject(project);\r | |
1558 | }\r | |
1559 | \r | |
1560 | /**\r | |
1561 | * If set to true, all files will be rebuilt.\r | |
1562 | * \r | |
1563 | * @paran rebuildAll If true, all files will be rebuilt. If false, up to\r | |
1564 | * date files will not be rebuilt.\r | |
1565 | */\r | |
1566 | public void setRebuild(boolean rebuildAll) {\r | |
1567 | compilerDef.setRebuild(rebuildAll);\r | |
1568 | linkerDef.setRebuild(rebuildAll);\r | |
1569 | assemblerDef.setRebuild(rebuildAll);\r | |
1570 | aslcompilerDef.setRebuild(rebuildAll);\r | |
1571 | }\r | |
1572 | \r | |
1573 | /**\r | |
1574 | * If set to true, compilation errors will not stop the task until all files\r | |
1575 | * have been attempted.\r | |
1576 | * \r | |
1577 | * @param relentless\r | |
1578 | * If true, don't stop on the first compilation error\r | |
1579 | * \r | |
1580 | */\r | |
1581 | public void setRelentless(boolean relentless) {\r | |
1582 | this.relentless = relentless;\r | |
1583 | }\r | |
1584 | \r | |
1585 | /**\r | |
1586 | * Sets the type of runtime library, possible values "dynamic", "static".\r | |
1587 | */\r | |
1588 | public void setRuntime(RuntimeType rtlType) {\r | |
1589 | linkType.setStaticRuntime((rtlType.getIndex() == 1));\r | |
1590 | }\r | |
1591 | \r | |
1592 | /**\r | |
1593 | * Sets the nature of the subsystem under which that the program will\r | |
1594 | * execute.\r | |
1595 | * \r | |
1596 | * <table width="100%" border="1"> <thead>Supported subsystems </thead>\r | |
1597 | * <tr>\r | |
1598 | * <td>gui</td>\r | |
1599 | * <td>Graphical User Interface</td>\r | |
1600 | * </tr>\r | |
1601 | * <tr>\r | |
1602 | * <td>console</td>\r | |
1603 | * <td>Command Line Console</td>\r | |
1604 | * </tr>\r | |
1605 | * <tr>\r | |
1606 | * <td>other</td>\r | |
1607 | * <td>Other</td>\r | |
1608 | * </tr>\r | |
1609 | * </table>\r | |
1610 | * \r | |
1611 | * @param subsystem\r | |
1612 | * subsystem\r | |
1613 | * @throws NullPointerException\r | |
1614 | * if subsystem is null\r | |
1615 | */\r | |
1616 | public void setSubsystem(SubsystemEnum subsystem) {\r | |
1617 | if (subsystem == null) {\r | |
1618 | throw new NullPointerException("subsystem");\r | |
1619 | }\r | |
1620 | linkType.setSubsystem(subsystem);\r | |
1621 | }\r | |
1622 | \r | |
1623 | /**\r | |
1624 | * Enumerated attribute with the values "none", "severe", "default",\r | |
1625 | * "production", "diagnostic", and "failtask".\r | |
1626 | */\r | |
1627 | public void setWarnings(CompilerDef.WarningLevel level) {\r | |
1628 | compilerDef.setWarnings(level);\r | |
1629 | }\r | |
1630 | \r | |
1631 | /**\r | |
1632 | * Indicates whether the build will continue even if there are compilation\r | |
1633 | * errors; defaults to true.\r | |
1634 | * \r | |
1635 | * @param fail\r | |
1636 | * if true halt the build on failure\r | |
1637 | */\r | |
1638 | public void setFailonerror(boolean fail) {\r | |
1639 | failOnError = fail;\r | |
1640 | }\r | |
1641 | \r | |
1642 | /**\r | |
1643 | * Gets the failonerror flag.\r | |
1644 | * \r | |
1645 | * @return the failonerror flag\r | |
1646 | */\r | |
1647 | public boolean getFailonerror() {\r | |
1648 | return failOnError;\r | |
1649 | }\r | |
1650 | \r | |
1651 | /**\r | |
1652 | * Adds descriptive version information to be included in the generated\r | |
1653 | * file. The first active version info block will be used. (Non-functional\r | |
1654 | * prototype)\r | |
1655 | */\r | |
1656 | public void addConfiguredVersioninfo(VersionInfo info) {\r | |
1657 | linkerDef.addConfiguredVersioninfo(info);\r | |
1658 | }\r | |
1659 | \r | |
1660 | /**\r | |
1661 | * Adds a target definition or reference (Non-functional prototype).\r | |
1662 | * \r | |
1663 | * @param target\r | |
1664 | * target\r | |
1665 | * @throws NullPointerException\r | |
1666 | * if compiler is null\r | |
1667 | */\r | |
1668 | public void addConfiguredTarget(TargetDef target) {\r | |
1669 | if (target == null) {\r | |
1670 | throw new NullPointerException("target");\r | |
1671 | }\r | |
1672 | target.setProject(getProject());\r | |
1673 | targetPlatforms.addElement(target);\r | |
1674 | }\r | |
1675 | \r | |
1676 | /**\r | |
1677 | * Adds a distributer definition or reference (Non-functional prototype).\r | |
1678 | * \r | |
1679 | * @param distributer\r | |
1680 | * distributer\r | |
1681 | * @throws NullPointerException\r | |
1682 | * if compiler is null\r | |
1683 | */\r | |
1684 | public void addConfiguredDistributer(DistributerDef distributer) {\r | |
1685 | if (distributer == null) {\r | |
1686 | throw new NullPointerException("distributer");\r | |
1687 | }\r | |
1688 | distributer.setProject(getProject());\r | |
1689 | distributers.addElement(distributer);\r | |
1690 | }\r | |
1691 | \r | |
1692 | /**\r | |
1693 | * Sets optimization.\r | |
1694 | * @param optimization\r | |
1695 | */\r | |
1696 | public void setOptimize(OptimizationEnum optimization) {\r | |
1697 | compilerDef.setOptimize(optimization);\r | |
1698 | }\r | |
1699 | \r | |
1700 | public boolean isAssembler() {\r | |
1701 | return assembler;\r | |
1702 | }\r | |
1703 | \r | |
1704 | public void setAssembler(boolean assembler) {\r | |
1705 | this.assembler = assembler;\r | |
1706 | }\r | |
1707 | \r | |
1708 | public boolean isAslcompiler() {\r | |
1709 | return aslcompiler;\r | |
1710 | }\r | |
1711 | \r | |
1712 | public void setAslcompiler(boolean aslcompiler) {\r | |
1713 | this.aslcompiler = aslcompiler;\r | |
1714 | }\r | |
1715 | \r | |
1716 | public boolean isUserdefine() {\r | |
1717 | return userdefine;\r | |
1718 | }\r | |
1719 | \r | |
1720 | public void setUserdefine(boolean userdefine) {\r | |
1721 | this.userdefine = userdefine;\r | |
1722 | }\r | |
1723 | \r | |
1724 | public String getArch() {\r | |
1725 | return arch;\r | |
1726 | }\r | |
1727 | \r | |
1728 | public void setArch(String arch) {\r | |
1729 | this.arch = arch;\r | |
1730 | }\r | |
1731 | \r | |
1732 | public String getOs() {\r | |
1733 | return os;\r | |
1734 | }\r | |
1735 | \r | |
1736 | public void setOs(String os) {\r | |
1737 | this.os = os;\r | |
1738 | }\r | |
1739 | \r | |
1740 | public String getVendor() {\r | |
1741 | return vendor;\r | |
1742 | }\r | |
1743 | \r | |
1744 | public void setVendor(String vendor) {\r | |
1745 | this.vendor = vendor;\r | |
1746 | }\r | |
1747 | \r | |
1748 | \r | |
1749 | }\r |