Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minimal support for ECJ #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<artifactId>auto-value</artifactId>
<version>${auto-value.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.4.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/google/testing/compile/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -119,7 +118,7 @@ public final Compilation compile(Iterable<? extends JavaFileObject> files) {
fileManager,
diagnosticCollector,
options(),
ImmutableSet.<String>of(),
null,
files);
task.setProcessors(processors());
boolean succeeded = task.call();
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/google/testing/compile/CompilerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}