((Target)librarySWFTarget).setLinkageChecker(externalLinkageChecker);
setLinkageChecker(externalLinkageChecker);
final ISWF defaultLibrarySWF = librarySWFTarget.build(problems);
// make default library model
final ISWCLibrary defaultLibrary = new SWCLibrary(LIBRARY_SWF, defaultLibrarySWF);
swc.addLibrary(defaultLibrary);
// Deal with all the cu's that don't need to be added via addScript
// save all the add script ones in cuToWrite for the next phase.
Set<ICompilationUnit> cuToWrite = new HashSet<ICompilationUnit>();
for (final ICompilationUnit cu : librarySWFTarget.getCompilationUnits())
{
if (isLinkageExternal(cu, targetSettings))
{
// don't do anything with these
}
//Resource bundles processed uniquely
else if (cu instanceof ResourceBundleCompilationUnit)
{
assert project instanceof FlexProject;
processResourceBundle((FlexProject)project, (ResourceBundleCompilationUnit)cu,
swc, problems);
}
else
{
// everyone else goes in this list for next step
cuToWrite.add(cu);
}
}
// remove duplicates and log resulting problems, then add to library
filterCompilationUnits(cuToWrite, problems);
for (final ICompilationUnit cu : cuToWrite)
{
defaultLibrary.addScript(createScript(cu, definitionsToBuild));
}
// Add the generated root class and its dependencies to the list of
// scripts.
if (librarySWFTarget.getRootClassName() != null)
{
final SWCScript script = new SWCScript();
script.setName(librarySWFTarget.getRootClassName());
script.addDefinition(librarySWFTarget.getRootClassName());
// This class is synthetic and is supposed to be globally
// unique, so nobody should care what the time stamp is.
// If we set the time stamp to the current time, then
// every SWC we make will be slightly different from all other
// SWCs.
script.setLastModified(1);
// add baseclass as an inheritance dependency
script.addDependency(librarySWFTarget.getBaseClassQName(), DependencyType.INHERITANCE);
defaultLibrary.addScript(script);
}
if (librarySWFTarget.getASMetadataNames() != null)
{
for (String name : librarySWFTarget.getASMetadataNames())
{
defaultLibrary.addNameToKeepAS3MetadataSet(name);
}
}
return defaultLibrarySWF;
}