Vector biddingProcessors = new Vector(_compilers.size());
for (int i = 0; i < _compilers.size(); i++) {
CompilerDef currentCompilerDef = (CompilerDef) _compilers
.elementAt(i);
if (currentCompilerDef.isActive()) {
ProcessorConfiguration config = currentCompilerDef
.createConfiguration(this, linkType, compilerDef,
targetPlatform, versionInfo);
//
// see if this processor had a precompile child element
//
PrecompileDef precompileDef = currentCompilerDef
.getActivePrecompile(compilerDef);
ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[]{config};
//
// if it does then
//
if (precompileDef != null) {
File prototype = precompileDef.getPrototype();
//
// will throw exceptions if prototype doesn't exist, etc
//
if (!prototype.exists()) {
throw new BuildException("prototype ("
+ prototype.toString() + ") does not exist.");
}
if (prototype.isDirectory()) {
throw new BuildException("prototype ("
+ prototype.toString() + ") is a directory.");
}
String[] exceptFiles = precompileDef.getExceptFiles();
//
// create a precompile building and precompile using
// variants of the configuration
// or return null if compiler doesn't support
// precompilation
CompilerConfiguration[] configs = ((CompilerConfiguration) config)
.createPrecompileConfigurations(prototype,
exceptFiles);
if (configs != null && configs.length == 2) {
//
// visit the precompiled file to add it into the
// targets list (just like any other file if
// compiler doesn't support precompilation)
TargetMatcher matcher = new TargetMatcher(this,
_objDir,
new ProcessorConfiguration[]{configs[0]},
linkerConfig, objectFiles, targets, versionInfo);
matcher.visit(new File(prototype.getParent()),
prototype.getName());
//
// only the configuration that uses the
// precompiled header gets added to the bidding list
biddingProcessors.addElement(configs[1]);
localConfigs = new ProcessorConfiguration[2];
localConfigs[0] = configs[1];
localConfigs[1] = config;
}
}
//
// if the compiler has a fileset
// then allow it to add its files
// to the set of potential targets
if (currentCompilerDef.hasFileSets()) {
TargetMatcher matcher = new TargetMatcher(this, _objDir,
localConfigs, linkerConfig, objectFiles, targets,
versionInfo);
currentCompilerDef.visitFiles(matcher);
}
biddingProcessors.addElement(config);
}
}
//
// add fallback compiler at the end
//
ProcessorConfiguration config = compilerDef.createConfiguration(this,
linkType, null, targetPlatform, versionInfo);
biddingProcessors.addElement(config);
ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors
.size()];
biddingProcessors.copyInto(bidders);