// Path: src/main/java/com/google/testing/compile/Compilation.java
// public enum Status {
// 
//   /** Compilation finished without errors. */
//   SUCCESS,
// 
//   /** Compilation finished with errors. */
//   FAILURE,
// }


import static com.google.common.base.Functions.toStringFunction;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.tools.ToolProvider.getSystemJavaCompiler;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Splitter;
import com.google.common.base.StandardSystemProperty;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.testing.compile.Compilation.Status;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import javax.annotation.processing.Processor;
import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
import org.checkerframework.checker.nullness.qual.Nullable;
   * @return the results of the compilation
   */
  public final Compilation compile(Iterable<? extends JavaFileObject> files) {
    DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>();
    InMemoryJavaFileManager fileManager =
        new InMemoryJavaFileManager(
            javaCompiler().getStandardFileManager(diagnosticCollector, Locale.getDefault(), UTF_8));
    fileManager.addSourceFiles(files);
    classPath().ifPresent(path -> setLocation(fileManager, StandardLocation.CLASS_PATH, path));
    annotationProcessorPath()
        .ifPresent(
            path -> setLocation(fileManager, StandardLocation.ANNOTATION_PROCESSOR_PATH, path));
    CompilationTask task =
        javaCompiler()
            .getTask(
                null, // use the default because old versions of javac log some output on stderr
                fileManager,
                diagnosticCollector,
                options(),
                ImmutableSet.<String>of(),
                files);
    task.setProcessors(processors());
    boolean succeeded = task.call();
    Compilation compilation =
        new Compilation(
            this,
            files,
            succeeded,
            diagnosticCollector.getDiagnostics(),
            fileManager.getOutputFiles());
// Path: src/main/java/com/google/testing/compile/Compilation.java
// public enum Status {
// 
//   /** Compilation finished without errors. */
//   SUCCESS,
// 
//   /** Compilation finished with errors. */
//   FAILURE,
// }


// Path: src/main/java/com/google/testing/compile/Compiler.java
import static com.google.common.base.Functions.toStringFunction;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.tools.ToolProvider.getSystemJavaCompiler;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Splitter;
import com.google.common.base.StandardSystemProperty;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.testing.compile.Compilation.Status;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import javax.annotation.processing.Processor;
import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
import org.checkerframework.checker.nullness.qual.Nullable;

   * @return the results of the compilation
   */
  public final Compilation compile(Iterable<? extends JavaFileObject> files) {
    DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>();
    InMemoryJavaFileManager fileManager =
        new InMemoryJavaFileManager(
            javaCompiler().getStandardFileManager(diagnosticCollector, Locale.getDefault(), UTF_8));
    fileManager.addSourceFiles(files);
    classPath().ifPresent(path -> setLocation(fileManager, StandardLocation.CLASS_PATH, path));
    annotationProcessorPath()
        .ifPresent(
            path -> setLocation(fileManager, StandardLocation.ANNOTATION_PROCESSOR_PATH, path));
    CompilationTask task =
        javaCompiler()
            .getTask(
                null, // use the default because old versions of javac log some output on stderr
                fileManager,
                diagnosticCollector,
                options(),
                ImmutableSet.<String>of(),
                files);
    task.setProcessors(processors());
    boolean succeeded = task.call();
    Compilation compilation =
        new Compilation(
            this,
            files,
            succeeded,
            diagnosticCollector.getDiagnostics(),
            fileManager.getOutputFiles());
    if (compilation.status().equals(Status.FAILURE) && compilation.errors().isEmpty()) {