Exemple #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
   * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
   */
  @Override
  @SuppressWarnings("rawtypes")
  protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
    Helper.forcePDEEditor(getProject());

    IPath outputLocation = Helper.getOutputLocation(getProject());

    if (DEBUG) {
      String typeStr = "UNKNOWN"; // $NON-NLS-1$
      switch (kind) {
        case INCREMENTAL_BUILD:
          typeStr = "INCREMENTAL"; // $NON-NLS-1$
          break;
        case AUTO_BUILD:
          typeStr = "AUTO"; // $NON-NLS-1$
          break;
        case CLEAN_BUILD:
          typeStr = "CLEAN"; // $NON-NLS-1$
          break;
        case FULL_BUILD:
          typeStr = "FULL"; // $NON-NLS-1$
          break;
      }
      debug(
          "Build type "
              + typeStr
              + " output location: "
              + outputLocation.toString()); // $NON-NLS-1$ //$NON-NLS-2$
    }

    if (kind == CLEAN_BUILD) {
      if (DEBUG) {
        debug("Doing nothing"); // $NON-NLS-1$
      }
      return null;
    }

    if (kind == FULL_BUILD) {
      fullBuild(outputLocation, monitor);
    } else {
      IResourceDelta delta = getDelta(getProject());
      if (delta == null) {
        if (DEBUG) {
          debug(
              "Incremental build was requested but delta is null, performing full build"); //$NON-NLS-1$
        }
        fullBuild(outputLocation, monitor);
        return null;
      }

      if (!Helper.checkMETAINFFolder(getProject())) {
        if (DEBUG) {
          debug(
              "Incremental build was requested but META-INF folder is missing from output location, performing full build"); //$NON-NLS-1$
        }
        fullBuild(outputLocation, monitor);
        return null;
      }

      if (!Helper.checkLibraries(getProject())) {
        if (DEBUG) {
          debug(
              "Incremental build was requested but some classpath libraries are missing from output location, performing full build"); //$NON-NLS-1$
        }
        fullBuild(outputLocation, monitor);
        return null;
      }

      if (DEBUG) {
        debug("Incremental build"); // $NON-NLS-1$
      }
      incrementalBuild(outputLocation, delta, monitor);
      return null;
    }

    return null;
  }