From a7d326493592bdca33bc490e67fdc30becc0c3ee Mon Sep 17 00:00:00 2001 From: Daniel Hodder Date: Thu, 15 Dec 2016 16:26:23 +1300 Subject: [PATCH] Added minimal support for EJC --- pom.xml | 6 ++++++ .../java/com/google/testing/compile/Compiler.java | 3 +-- .../com/google/testing/compile/CompilerTest.java | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d5423c1d..9cb681e2 100644 --- a/pom.xml +++ b/pom.xml @@ -84,6 +84,12 @@ auto-value ${auto-value.version} + + org.eclipse.jdt.core.compiler + ecj + 4.4.2 + test + diff --git a/src/main/java/com/google/testing/compile/Compiler.java b/src/main/java/com/google/testing/compile/Compiler.java index 152a356c..41de2186 100644 --- a/src/main/java/com/google/testing/compile/Compiler.java +++ b/src/main/java/com/google/testing/compile/Compiler.java @@ -22,7 +22,6 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.google.testing.compile.Compilation.Status; import java.util.Locale; import javax.annotation.processing.Processor; @@ -119,7 +118,7 @@ public final Compilation compile(Iterable files) { fileManager, diagnosticCollector, options(), - ImmutableSet.of(), + null, files); task.setProcessors(processors()); boolean succeeded = task.call(); diff --git a/src/test/java/com/google/testing/compile/CompilerTest.java b/src/test/java/com/google/testing/compile/CompilerTest.java index 381ce182..e7b8a7ec 100644 --- a/src/test/java/com/google/testing/compile/CompilerTest.java +++ b/src/test/java/com/google/testing/compile/CompilerTest.java @@ -15,13 +15,18 @@ */ package com.google.testing.compile; +import static com.google.testing.compile.Compiler.compiler; import static com.google.common.truth.Truth.assertThat; import static com.google.testing.compile.Compiler.javac; +import static com.google.testing.compile.CompilationSubject.assertThat; import com.google.common.collect.ImmutableList; + import java.util.Arrays; import javax.annotation.processing.Processor; import javax.tools.JavaFileObject; + +import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -88,4 +93,11 @@ public void multipleProcesors_asIterable() { assertThat(noopProcessor2.invoked).isTrue(); assertThat(noopProcessor3.invoked).isFalse(); } + + @Test + public void compilingWithEjcWorks() { + Compilation compilation = compiler(new EclipseCompiler()).compile(HELLO_WORLD); + + assertThat(compilation).succeeded(); + } }