private object CreateCompiledFiles(object parameter)
{
CompileScriptsParameters parameters = (CompileScriptsParameters)parameter;
CompileMessages errors = parameters.Errors;
bool forceRebuild = parameters.RebuildAll;
IBuildTarget targetDataFile = BuildTargetsInfo.FindBuildTargetByName(BuildTargetsInfo.DATAFILE_TARGET_NAME);
targetDataFile.Build(errors, forceRebuild); // ensure that data file is built first
if (ExtraOutputCreationStep != null)
{
ExtraOutputCreationStep();
}
// TODO: As of now the build targets other than DataFile and Debug do DEPLOYMENT rather than BUILDING
// (BuildTargetDebug, - which is never used right here, - seem to combine both operations:
// building and preparing game to run under Windows).
// This is why the BuildTargetDataFile is called explicitly at the start.
// And that is why the rest must be called AFTER the ExtraOutputCreationStep.
//
// Possible solution that could improve situation could be to develop some kind of a BuildStep interface,
// having BuildTargets providing their build steps of corresponding type and execution order.
foreach (IBuildTarget target in BuildTargetsInfo.GetSelectedBuildTargets())
{
if (target != targetDataFile) target.Build(errors, forceRebuild);
Utilities.SetDirectoryFilesAccess(Path.Combine(Factory.AGSEditor.CurrentGame.DirectoryPath, AGSEditor.OUTPUT_DIRECTORY));
}
return null;
}