{
getLog().warn( "Skipping compiler, source path doesn't exist. " + Arrays.toString( getSourcePath() ) );
return;
}
executeCompiler( new MxmlcConfigurationHolder( this, getSourceFile() ), true );
if ( !file( getOutput() ).exists() )
{
throw new IllegalStateException( "Output file doesn't exist and now error was throw by the compiler!" );
}
if ( getLocalesRuntime() != null )
{
List<Result> results = new ArrayList<Result>();
for ( String locale : getLocalesRuntime() )
{
MxmlcMojo cfg = this.clone();
configureResourceBundle( locale, cfg );
results.add( executeCompiler( new MxmlcConfigurationHolder( cfg, null ), fullSynchronization ) );
}
wait( results );
}
if ( getModules() != null )
{
List<Result> results = new ArrayList<Result>();
for ( Module module : getModules() )
{
if ( module.isOptimize() == null )
{
module.setOptimize( modulesLoadExterns );
}
File moduleSource =
SourceFileResolver.resolveSourceFile( project.getCompileSourceRoots(), module.getSourceFile() );
String classifier = FilenameUtils.getBaseName( moduleSource.getName() ).toLowerCase();
String moduleFinalName;
if ( module.getFinalName() != null )
{
moduleFinalName = module.getFinalName();
}
else
{
moduleFinalName = project.getBuild().getFinalName() + "-" + classifier;
}
File moduleOutputDir;
if ( module.getDestinationPath() != null )
{
moduleOutputDir = new File( project.getBuild().getDirectory(), module.getDestinationPath() );
}
else
{
moduleOutputDir = new File( project.getBuild().getDirectory() );
}
List<String> loadExterns = new ArrayList<String>();
loadExterns.add( getLinkReport() );
if ( getLoadExterns() != null )
{
loadExterns.addAll( Arrays.asList( getLoadExterns() ) );
}
MxmlcMojo cfg = this.clone();
cfg.classifier = classifier;
cfg.targetDirectory = moduleOutputDir;
cfg.finalName = moduleFinalName;
if ( module.isOptimize() )
{
cfg.getCache().put( LOAD_EXTERNS, loadExterns.toArray( new String[1] ) );
}
cfg.getCache().put( RUNTIME_SHARED_LIBRARY_PATH, null );
cfg.getCache().put( INCLUDE_LIBRARIES, null );
cfg.getCache().put( EXTERNAL_LIBRARY_PATH, getModulesExternalLibraryPath() );
results.add( executeCompiler( new MxmlcConfigurationHolder( cfg, moduleSource ), fullSynchronization ) );
}
wait( results );
}
}