}
public static Benchmark compc( ConfigurationBuffer cfgbuf, CompcConfiguration configuration )
throws Exception, ConfigurationException, CompilerException
{
LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
CompilerAPI.useConsoleLogger(true, true, configuration.getWarnings(), true);
Benchmark benchmark = null;
if (configuration.benchmark())
{
benchmark = CompilerAPI.runBenchmark();
benchmark.startTime(Benchmark.PRECOMPILE);
}
else
{
CompilerAPI.disableBenchmark();
}
CompilerAPI.setupHeadless(configuration);
String[] sourceMimeTypes = WebTierAPI.getSourcePathMimeTypes();
CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
// create a SourcePath...
SourcePath sourcePath = new SourcePath(sourceMimeTypes, compilerConfig.allowSourcePathOverlap());
sourcePath.addPathElements( compilerConfig.getSourcePath() );
List<VirtualFile>[] array = CompilerAPI.getVirtualFileList(configuration.getIncludeSources(),
configuration.getStylesheets().values(),
new HashSet<String>(Arrays.asList(sourceMimeTypes)),
sourcePath.getPaths());
// note: if Configuration is ever shared with other parts of the system, then this part will need
// to change, since we're setting a compc-specific setting below
compilerConfig.setMetadataExport(true);
// create a FileSpec... can reuse based on appPath, debug settings, etc...
FileSpec fileSpec = new FileSpec(array[0], WebTierAPI.getFileSpecMimeTypes(), false);
// create a SourceList...
SourceList sourceList = new SourceList(array[1], compilerConfig.getSourcePath(), null,
WebTierAPI.getSourceListMimeTypes(), false);
ResourceContainer resources = new ResourceContainer();
ResourceBundlePath bundlePath = new ResourceBundlePath(configuration.getCompilerConfiguration(), null);
Map<String, Source> classes = new HashMap<String, Source>();
NameMappings mappings = CompilerAPI.getNameMappings(configuration);
List<SwcComponent> nsComponents = SwcAPI.setupNamespaceComponents(configuration, mappings, sourcePath,
sourceList, classes);
SwcAPI.setupClasses(configuration, sourcePath, sourceList, classes);
if (benchmark != null)
{
benchmark.benchmark(l10n.getLocalizedTextString(new Mxmlc.InitialSetup()));
}
// load SWCs
CompilerSwcContext swcContext = new CompilerSwcContext();
SwcCache cache = new SwcCache();