public void runBuild(@NotNull ProjectDescriptor pd,
                       @NotNull CanceledStatus cs,
                       @NotNull MessageHandler msgHandler,
                       @NotNull BuildType buildType,
                       @NotNull List<TargetTypeBuildScope> scopes, final boolean includeDependenciesToScope) throws Exception {
    for (int attempt = 0; attempt < 2 && !cs.isCanceled(); attempt++) {
      final boolean forceClean = myForceCleanCaches && myFilePaths.isEmpty();
      final CompileScope compileScope = createCompilationScope(pd, scopes, myFilePaths, forceClean, includeDependenciesToScope);
      final IncProjectBuilder builder = new IncProjectBuilder(pd, BuilderRegistry.getInstance(), myBuilderParams, cs, Utils.IS_TEST_MODE);
      builder.addMessageHandler(msgHandler);
      try {
        switch (buildType) {
          case BUILD:
            builder.build(compileScope, forceClean);
            break;

          case CLEAN:
            //todo
    //        new ProjectBuilder(new GantBinding(), project).clean();
            break;
          case UP_TO_DATE_CHECK:
            builder.checkUpToDate(compileScope);
            break;
        }
        break; // break attempts loop
      }
      catch (RebuildRequestedException e) {
        if (attempt == 0) {
          LOG.info(e);
          myForceCleanCaches = true;
        }
        else {
          throw e;
        }
      }
    }
  }
public void runBuild(@NotNull ProjectDescriptor pd,
                       @NotNull CanceledStatus cs,
                       @NotNull MessageHandler msgHandler,
                       @NotNull BuildType buildType,
                       @NotNull List<TargetTypeBuildScope> scopes, final boolean includeDependenciesToScope)