build(monitor, resources, "project " + getProject().getName());
}
private void build(IProgressMonitor monitor, final List<BuildInput> inputs, String what) {
final Environment environment = SugarJParseController.makeProjectEnvironment(getProject());
environment.setGenerateFiles(true);
CommandExecution.SILENT_EXECUTION = false;
CommandExecution.SUB_SILENT_EXECUTION = false;
CommandExecution.FULL_COMMAND_LINE = true;
Log.out = SugarJConsole.getOutputPrintStream();
Log.err = SugarJConsole.getErrorPrintStream();
SugarJConsole.activateConsoleOnce();
Job buildJob = new Job("Build " + what) {
@Override
protected IStatus run(IProgressMonitor monitor) {
ProcessingListener marker = new MarkingProcessingListener(getProject());
Driver.addProcessingDoneListener(marker);
// getLock(getProject()).acquire();
for (BuildInput input : inputs)
try {
if (Thread.currentThread().isInterrupted()) {
monitor.setCanceled(true);
monitor.done();
return Status.CANCEL_STATUS;
}
monitor.beginTask("compile " + input.sourceFile.getRelativePath(), IProgressMonitor.UNKNOWN);
RelativePath depFile = new RelativePath(environment.getParseBin(), FileCommands.dropExtension(input.sourceFile.getRelativePath()) + ".dep");
Result res = Result.readDependencyFile(depFile);
if (res == null || !res.isUpToDate(input.sourceFile, environment))
res = Driver.run(input.sourceFile, environment, monitor, input.baseLang);
IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();