package org.metaborg.core.build;

import org.metaborg.core.MetaborgRuntimeException;
import org.metaborg.core.analysis.IAnalyzeUnit;
import org.metaborg.core.analysis.IAnalyzeUnitUpdate;
import org.metaborg.core.processing.ICancellationToken;
import org.metaborg.core.processing.IProgressReporter;
import org.metaborg.core.syntax.IParseUnit;
import org.metaborg.core.transform.ITransformUnit;

/**
 * Incrementally parses, analyses, and compiles source files.
 * 
 * @param <P>
 *            Type of parse units.
 * @param <A>
 *            Type of analyze units.
 * @param <AU>
 *            Type of analyze unit updates.
 * @param <T>
 *            Type of transform units with any input.
 */
public interface IBuilder<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>> {
    /**
     * Parses, analyses, and compiles changed resources.
     * 
     * @param input
     *            Build input.
     * @return Result of building.
     * @throws InterruptedException
     *             When build is cancelled.
     * @throws MetaborgRuntimeException
     *             When {@code input.throwOnErrors} is set to true and errors occur.
     */
    IBuildOutput<P, A, AU, T> build(BuildInput input, IProgressReporter progressReporter,
        ICancellationToken cancellationToken) throws InterruptedException;

    /**
     * Cleans derived resources and contexts from given location.
     * 
     * @param input
     *            Clean input.
     * @throws InterruptedException
     *             When clean is cancelled.
     */
    void clean(CleanInput input, IProgressReporter progressReporter, ICancellationToken cancellationToken)
        throws InterruptedException;
}

@@ -291,16 +291,133 @@
 porter;%0A
+import org.metaborg.core.processing.NullCancellationToken;%0Aimport org.metaborg.core.processing.NullProgressReporter;%0A
 import o
@@ -1055,32 +1055,228 @@
    Build input.%0A
+     * @param progressReporter%0A     *            Progress reporter used for reporting build progress.%0A     * @param cancellationToken%0A     *            Cancellation token for canceling the build.%0A
      * @return R
@@ -1692,356 +1692,1487 @@
   * 
-Cleans derived resources and contexts from given location.%0A     * %0A     * @param input%0A     *            Clean input.%0A     * @throws InterruptedException%0A     *             When clean is cancelled.%0A     */%0A    void clean(CleanInput input, IProgressReporter progressReporter, ICancellationToken cancellationToken)%0A        throws InterruptedException;
+Parses, analyses, and compiles changed resources.%0A     * %0A     * @param input%0A     *            Build input.%0A     * @return Result of building.%0A     * @throws InterruptedException%0A     *             When build is cancelled.%0A     * @throws MetaborgRuntimeException%0A     *             When %7B@code input.throwOnErrors%7D is set to true and errors occur.%0A     */%0A    default IBuildOutput%3CP, A, AU, T%3E build(BuildInput input) throws InterruptedException %7B%0A        return build(input, new NullProgressReporter(), new NullCancellationToken());%0A    %7D%0A%0A    /**%0A     * Cleans derived resources and contexts from given location.%0A     * %0A     * @param input%0A     *            Clean input.%0A     * @param progressReporter%0A     *            Progress reporter used for reporting clean progress.%0A     * @param cancellationToken%0A     *            Cancellation token for canceling the clean.%0A     * @throws InterruptedException%0A     *             When clean is cancelled.%0A     */%0A    void clean(CleanInput input, IProgressReporter progressReporter, ICancellationToken cancellationToken)%0A        throws InterruptedException;%0A%0A    /**%0A     * Cleans derived resources and contexts from given location.%0A     * %0A     * @param input%0A     *            Clean input.%0A     * @throws InterruptedException%0A     *             When clean is cancelled.%0A     */%0A    default void clean(CleanInput input) throws InterruptedException %7B%0A        clean(input, new NullProgressReporter(), new NullCancellationToken());%0A    %7D
 %0A%7D%0A

Add default methods without progress reporting and cancellation.