// setup the path resolver
CompilerAPI.usePathResolver();
// set up for localizing messages
LocalizationManager l10n = new LocalizationManager();
l10n.addLocalizer( new XLRLocalizer() );
l10n.addLocalizer( new ResourceBundleLocalizer() );
ThreadLocalToolkit.setLocalizationManager(l10n);
// setup the console logger. the configuration parser needs a logger.
CompilerAPI.useConsoleLogger();
// process configuration
ConfigurationBuffer cfgbuf = new ConfigurationBuffer(CommandLineConfiguration.class, Configuration.getAliases());
// Do not set this. The file-specs should be included in the configuration buffer
// checksum so changes to the class list can be detected during incremental builds.
//cfgbuf.setDefaultVar(FILE_SPECS);
DefaultsConfigurator.loadDefaults( cfgbuf );
CommandLineConfiguration configuration = (CommandLineConfiguration) processConfiguration(
l10n, "mxmlc", args, cfgbuf, CommandLineConfiguration.class, FILE_SPECS);
// well, setup the logger again now that we know configuration.getWarnings()???
CompilerAPI.useConsoleLogger(true, true, configuration.getWarnings(), true);
CompilerAPI.setupHeadless(configuration);
if (configuration.benchmark())
{
benchmark = CompilerAPI.runBenchmark();
benchmark.startTime(Benchmark.PRECOMPILE);
}
else
{
CompilerAPI.disableBenchmark();
}
// make sure targetFile abstract pathname is an absolute path...
VirtualFile targetFile = CompilerAPI.getVirtualFile(configuration.getTargetFile());
WebTierAPI.checkSupportedTargetMimeType(targetFile);
// mxmlc only wants to take one file.
List<String> fileList = configuration.getFileList();
if (fileList == null || fileList.size() != 1)
{
throw new ConfigurationException.OnlyOneSource( "filespec", null, -1);
}
List<VirtualFile> virtualFileList = CompilerAPI.getVirtualFileList(fileList);
CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
NameMappings mappings = CompilerAPI.getNameMappings(configuration);
// create a FileSpec... can reuse based on targetFile, debug settings, etc...
FileSpec fileSpec = new FileSpec(Collections.<VirtualFile>emptyList(), WebTierAPI.getFileSpecMimeTypes());
// create a SourcePath...
VirtualFile[] asClasspath = compilerConfig.getSourcePath();
SourceList sourceList = new SourceList(virtualFileList,
asClasspath,
targetFile,
WebTierAPI.getSourcePathMimeTypes());
SourcePath sourcePath = new SourcePath(asClasspath,
targetFile,
WebTierAPI.getSourcePathMimeTypes(),
compilerConfig.allowSourcePathOverlap());
ResourceContainer resources = new ResourceContainer();
ResourceBundlePath bundlePath = new ResourceBundlePath(configuration.getCompilerConfiguration(), targetFile);
ArrayList<Source> sources = new ArrayList<Source>();
List<CompilationUnit> units = new ArrayList<CompilationUnit>();
if (benchmark != null)
{
benchmark.benchmark(l10n.getLocalizedTextString(new InitialSetup()));
}
// load SWCs
CompilerSwcContext swcContext = new CompilerSwcContext();
SwcCache cache = new SwcCache();