Run the compilation.

@param progress monitor of the progress of the compilation.
@return success status.
@since 0.8
434791
@SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity",
		"checkstyle:returncount", "checkstyle:magicnumber"})
	public boolean compile(IProgressMonitor progress) {
		final IProgressMonitor monitor = progress == null ? new NullProgressMonitor() : progress;
		try {
			monitor.beginTask(Messages.SarlBatchCompiler_42, 18);
			if (!checkConfiguration(monitor)) {
				return false;
			}
			monitor.worked(1);
			final ResourceSet resourceSet = this.resourceSetProvider.get();
			configureExtraLanguageGenerators();
			if (!configureWorkspace(resourceSet, monitor)) {
				return false;
			}
			if (getLogger().isDebugEnabled()) {
				getLogger().debug(Utils.dump(getGeneratorConfig(), false));
			}
			monitor.worked(2);
			monitor.subTask(Messages.SarlBatchCompiler_43);
			if (this.generatorConfigProvider instanceof GeneratorConfigProvider) {
				((GeneratorConfigProvider) this.generatorConfigProvider).install(resourceSet, getGeneratorConfig());
			}
			if (monitor.isCanceled()) {
				return false;
			}
			if (this.generatorConfigProvider2 instanceof GeneratorConfigProvider2) {
				((GeneratorConfigProvider2) this.generatorConfigProvider2).install(resourceSet, getGeneratorConfig2());
			}
			if (getLogger().isDebugEnabled()) {
				getLogger().debug(Utils.dump(getGeneratorConfig2(), false));
			}
			if (monitor.isCanceled()) {
				return false;
			}
			monitor.worked(3);
			monitor.subTask(Messages.SarlBatchCompiler_44);
			final File stubClassDirectory = createTempDir(BINCLASS_FOLDER_PREFIX);
			if (monitor.isCanceled()) {
				return false;
			}
			monitor.worked(4);
			try {
				monitor.subTask(Messages.SarlBatchCompiler_45);
				this.compilerPhases.setIndexing(resourceSet, true);
				if (monitor.isCanceled()) {
					return false;
				}
				monitor.worked(5);
				// install a type provider without index lookup for the first phase
				installJvmTypeProvider(resourceSet, stubClassDirectory, true, monitor);
				if (monitor.isCanceled()) {
					return false;
				}
				monitor.worked(6);
				loadSARLFiles(resourceSet, monitor);
				if (monitor.isCanceled()) {
					return false;
				}
				monitor.worked(7);
				final File stubSourceDirectory = createStubs(resourceSet, monitor);
				if (monitor.isCanceled()) {
					return false;
				}
				monitor.worked(8);
				if (!preCompileStubs(stubSourceDirectory, stubClassDirectory, monitor)) {
					if (monitor.isCanceled()) {
						return false;
					}
					reportInternalWarning(Messages.SarlBatchCompiler_2);
				}
				monitor.worked(9);
				if (!preCompileJava(stubSourceDirectory, stubClassDirectory, monitor)) {
					if (monitor.isCanceled()) {
						return false;
					}
					if (getLogger().isDebugEnabled()) {
						getLogger().debug(Messages.SarlBatchCompiler_3);
					}
				}
				monitor.worked(10);
			} finally {
				monitor.subTask(Messages.SarlBatchCompiler_46);
				this.compilerPhases.setIndexing(resourceSet, false);
				if (monitor.isCanceled()) {
					return false;
				}
			}
			monitor.worked(11);
			// install a fresh type provider for the second phase, so we clear all previously cached classes and misses.
			installJvmTypeProvider(resourceSet, stubClassDirectory, false, monitor);
			if (monitor.isCanceled()) {
				return false;
			}
			monitor.worked(12);
			generateJvmElements(resourceSet, monitor);
			if (monitor.isCanceled()) {
				return false;
			}
			monitor.worked(13);
			final List<Resource> validatedResources = new ArrayList<>();
			final List<Issue> issues = validate(resourceSet, validatedResources, monitor);
			if (monitor.isCanceled()) {
				return false;
			}
			if (!issues.isEmpty()) {
				if (reportCompilationIssues(issues)) {
					return false;
				}
			}
			monitor.worked(14);
			overrideXtextInternalLoggers();
			generateJavaFiles(validatedResources, monitor);
			if (monitor.isCanceled()) {
				return false;
			}
			monitor.worked(15);
			if (isJavaPostCompilationEnable()) {
				postCompileJava(monitor);
				if (monitor.isCanceled()) {
					return false;
				}
			}
			monitor.worked(16);
		} finally {
			monitor.subTask(Messages.SarlBatchCompiler_47);
			destroyClassLoader(this.jvmTypesClassLoader);
			destroyClassLoader(this.annotationProcessingClassLoader);
			if (isDeleteTempDirectory()) {
				monitor.subTask(Messages.SarlBatchCompiler_48);
				for (final File file : this.tempFolders) {
					cleanFolder(file, ACCEPT_ALL_FILTER, true, true);
				}
			}
			unconfigureExtraLanguageGenerators();
			monitor.done();
		}
		return true;
	}
421985
public void setProgress(float progress) {
    if (isSpinning) {
      mProgress = 0.0f;
      isSpinning = false;

      runCallback();
    }

    if (progress > 1.0f) {
      progress -= 1.0f;
    } else if (progress < 0) {
      progress = 0;
    }

    if (progress == mTargetProgress) {
      return;
    }

    // If we are currently in the right position
    // we set again the last time animated so the
    // animation starts smooth from here
    if (mProgress == mTargetProgress) {
      lastTimeAnimated = SystemClock.uptimeMillis();
    }

    mTargetProgress = Math.min(progress * 360.0f, 360.0f);

    invalidate();
  }
1092015
@Override
   public void run()
   {
      try {
         startBarrier.await();

         int idleCount = 0;
         while (!isRunning.compareAndSet(idleCount > lingerIterations && pidToProcessMap.isEmpty(), false)) {
            idleCount = (!shutdown && process()) ? 0 : (idleCount + 1);
         }
      }
      catch (Exception e) {
         // TODO: how to handle this error?
         isRunning.set(false);
      }
   }
451794
protected void generateJvmElements(ResourceSet resourceSet, IProgressMonitor progress) {
		assert progress != null;
		progress.subTask(Messages.SarlBatchCompiler_21);
		getLogger().info(Messages.SarlBatchCompiler_21);

		final List<Resource> originalResources = resourceSet.getResources();
		final List<Resource> toBeResolved = new ArrayList<>(originalResources.size());
		for (final Resource resource : originalResources) {
			if (progress.isCanceled()) {
				return;
			}
			if (isSourceFile(resource)) {
				toBeResolved.add(resource);
			}
		}
		for (final Resource resource : toBeResolved) {
			if (progress.isCanceled()) {
				return;
			}
			if (getLogger().isDebugEnabled()) {
				getLogger().debug(Messages.SarlBatchCompiler_26, resource.getURI().lastSegment());
			}
			EcoreUtil.resolveAll(resource);
			EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
		}
	}
969038
public void setProgress(float progress) {
        if (progress < 0)
            mProgress = 0;
        else if (mProgress > 1)
            mProgress = 1;
        else
            mProgress = progress;
        stop();
        onProgressChange(mProgress);
        invalidateSelf();
    }
409473
public String run()
    {
		String locale = getLocale().getLanguage();

		SystemUnderTest sut = SystemUnderTest.newInstance(sutName);
		sut.setProject(Project.newInstance(sutProjectName));
		sut.setRunner(Runner.newInstance(""));

		Specification spec = Specification.newInstance(getPage().getTitle());

		try
		{
			spec.setRepository(gpUtil.getHomeRepository(spaceKey));

        	execution = gpUtil.getGPServerService().runSpecification(sut, spec, implemented, locale);
        } 
        catch (GreenPepperServerException e) 
        {
            execution = Execution.error(spec, sut, null, e.getId());
        }
        catch (Exception e) 
        {
            execution = Execution.error(spec, sut, null, ExceptionUtils.stackTrace(e, "<br>", 15));
        }
        
        return SUCCESS;
    }
1086472
@Override
  @SuppressWarnings("unchecked")
  public void run() {
    while (!this.shutdown) {
      try {
        this.lastThreadCheckTime = System.currentTimeMillis();
        this.updater.updateExecutions();
        // TODO not sure why it would be important to check the status immediately in case of _new_
        // executions. This can only optimize finalizing executions that finish super-quickly after
        // being started.
        waitForNewExecutions();
      } catch (final Exception e) {
        logger.error("Unexpected exception in updating executions", e);
      }
    }
  }
601748
public void run(final StatusUpdate onStatus,
                    final Command onCompletion) {
        //Ensure active analysis is cancelled
        cancelExistingAnalysis();

        //If there are no checks to run simply return
        if (rechecks.isEmpty()) {
            if (onCompletion != null) {
                onCompletion.execute();
                return;
            }
        }

        checkRunner.run(rechecks,
                        onStatus,
                        onCompletion);
        rechecks.clear();
    }
9437
public Collection<CompilationUnit> execute() throws IOException {
        List<CompilationUnit> compiledUnits = new ArrayList<CompilationUnit>();
        logger.debug("CompilationTask: execute");
        long start = System.currentTimeMillis();
        for (CompilationUnit unit : compilationUnits) {
            if (compileIfDirty(unit)) {
                compiledUnits.add(unit);
            }
        }
        logger.debug("execute finished in {} millis", System.currentTimeMillis() - start);
        return compiledUnits;
    }
409016
public void progress(float progress) throws IOException {
    progressValue = progress;
    reporter.progress();
    
    if (recordReader != null) {
      progressKey.set(progress);
      recordReader.next(progressKey, nullValue);
    }
  }
1230322
def _finish_progress(self):
        

        if self._show_progressbar:
            if self._progressbar is None:
                self._initialize_progressbar()
            if self._progressbar is not None:
                self._progressbar.finish()

        if self._progress_callback is not None:
            self._progress_callback(100.0)
143322
private synchronized void fireProgressUpdated(TableRowProgressMonitor source) {
    int row = monitors.indexOf(source);
    if (row >= 0) {
      fireTableCellUpdated(row, PROGRESS_COLUMN);
    }
  }
344238
@Override
  public float getProgress() {
    try {
      return Math.max(Math.min(1, progressProvider.get().getProgress()), 0);
    } catch (final Exception e) {
      // An Exception must be caught and logged here because YARN swallows the Exception and fails the job.
      LOG.log(Level.WARNING, "Cannot get the application progress. Will return 0.", e);
      return 0;
    }
  }
701127
private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
    requireNonNull(indexAction);
    String entityTypeId = indexAction.getEntityTypeId();
    updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
    try {
      if (dataService.hasEntityType(entityTypeId)) {
        EntityType entityType = dataService.getEntityType(entityTypeId);
        if (indexAction.getEntityId() != null) {
          progress.progress(
              progressCount,
              format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId()));
          rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId());
        } else {
          progress.progress(progressCount, format("Indexing {0}", entityType.getId()));
          final Repository<Entity> repository = dataService.getRepository(entityType.getId());
          indexService.rebuildIndex(repository);
        }
      } else {
        EntityType entityType = getEntityType(indexAction);
        if (indexService.hasIndex(entityType)) {
          progress.progress(
              progressCount, format("Dropping entityType with id: {0}", entityType.getId()));
          indexService.deleteIndex(entityType);
        } else {
          // Index Job is finished, here we concluded that we don't have enough info to continue the
          // index job
          progress.progress(
              progressCount,
              format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId()));
        }
      }
      updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED);
      return true;
    } catch (Exception ex) {
      LOG.error("Index job failed", ex);
      updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED);
      return false;
    }
  }
1175349
public int runCompiler(String... args) {
		try {
			final BQRuntime runtime = createRuntime(args);
			final CommandOutcome outcome = runtime.run();
			if (!outcome.isSuccess() && outcome.getException() != null) {
				Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
			}
			return outcome.getExitCode();
		} catch (ProvisionException exception) {
			final Throwable ex = Throwables.getRootCause(exception);
			if (ex != null) {
				Logger.getRootLogger().error(ex.getLocalizedMessage());
			} else {
				Logger.getRootLogger().error(exception.getLocalizedMessage());
			}
		} catch (Throwable exception) {
			Logger.getRootLogger().error(exception.getLocalizedMessage());
		}
		return Constants.ERROR_CODE;
	}
306597
public Object run(GroovyCodeSource source, List args) throws CompilationFailedException {
        return run(source, ((String[]) args.toArray(new String[args.size()])));
    }
591904
private static void doExecute(Executor executor, Runnable runnable) {
    try {
      executor.execute(runnable);
    } catch (Throwable th) {
      log.log(Level.SEVERE, "Failed to execute PingCallback", th);
    }
  }