{
// setup the path resolver
CompilerAPI.usePathResolver();
// process configuration
ConfigurationBuffer cfgbuf = new ConfigurationBuffer(CommandLineConfiguration.class, Configuration.getAliases());
cfgbuf.setDefaultVar(Mxmlc.FILE_SPECS);
DefaultsConfigurator.loadDefaults( cfgbuf );
CommandLineConfiguration configuration = (CommandLineConfiguration) Mxmlc.processConfiguration(
ThreadLocalToolkit.getLocalizationManager(), "mxmlc", args, cfgbuf, CommandLineConfiguration.class, Mxmlc.FILE_SPECS);
s.configuration = configuration;
CompilerAPI.setupHeadless(configuration);
if (configuration.benchmark())
{
benchmark = CompilerAPI.runBenchmark();
benchmark.startTime(Benchmark.PRECOMPILE);
}
else
{
CompilerAPI.disableBenchmark();
}
String target = configuration.getTargetFile();
targets.put("" + id, s);
s.args = args;
// make sure targetFile abstract pathname is an absolute path...
VirtualFile targetFile = CompilerAPI.getVirtualFile(target);
WebTierAPI.checkSupportedTargetMimeType(targetFile);
List<VirtualFile> virtualFileList = CompilerAPI.getVirtualFileList(configuration.getFileList());
CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
NameMappings mappings = CompilerAPI.getNameMappings(configuration);
Transcoder[] transcoders = WebTierAPI.getTranscoders( configuration );
SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);
// construct the SWF file name...
VirtualFile projector = configuration.getProjector();
if (projector != null && projector.getName().endsWith("avmplus.exe"))
{
// output .exe
s.outputName = configuration.getOutput();
if (s.outputName == null)
{
s.outputName = targetFile.getName();
s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".exe";
}
}
else
{
// output SWF
s.outputName = configuration.getOutput();
if (s.outputName == null)
{
s.outputName = targetFile.getName();
if (projector != null)
{
s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".exe";
}
else
{
s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".swf";
}
}
}
VirtualFile[] asClasspath = compilerConfig.getSourcePath();
// create a FileSpec...
s.fileSpec = new FileSpec(Collections.<VirtualFile>emptyList(), WebTierAPI.getFileSpecMimeTypes());
// create a SourceList
s.sourceList = new SourceList(virtualFileList, asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes());
// create a SourcePath...
s.sourcePath = new SourcePath(asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes(),
compilerConfig.allowSourcePathOverlap());
// create a ResourceContainer...
s.resources = new ResourceContainer();
// create a ResourceBundlePath...
s.bundlePath = new ResourceBundlePath(configuration.getCompilerConfiguration(), targetFile);
if (benchmark != null)
{
benchmark.benchmark(l10n.getLocalizedTextString(new InitialSetup()));
}
// load SWCs
s.swcCache = new SwcCache();
CompilerSwcContext swcContext = new CompilerSwcContext(true);
swcContext.load( compilerConfig.getLibraryPath(),
Configuration.getAllExcludedLibraries(compilerConfig, configuration),
compilerConfig.getThemeFiles(),
compilerConfig.getIncludeLibraries(),
mappings,
I18nUtils.getTranslationFormat(compilerConfig),
s.swcCache );
configuration.addExterns( swcContext.getExterns() );
configuration.addIncludes( swcContext.getIncludes() );
configuration.getCompilerConfiguration().addThemeCssFiles( swcContext.getThemeStyleSheets() );
s.checksum = cfgbuf.checksum_ts() + swcContext.checksum();
final SymbolTable symbolTable = new SymbolTable(configuration);
s.perCompileData = symbolTable.perCompileData;
Map licenseMap = configuration.getLicensesConfiguration().getLicenseMap();