Skip to content

Commit

Permalink
Make turbine tests more compatible with Windows
Browse files Browse the repository at this point in the history
See bazelbuild#4165.

PiperOrigin-RevId: 177254510
  • Loading branch information
cushon authored and ochafik committed Nov 29, 2017
1 parent e6268b1 commit 5f4f3a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.devtools.build.java.turbine.javac.JavacTurbine.Result;
import com.google.turbine.options.TurbineOptions;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void setUp() throws IOException {
.setOutput(output.toString())
.setTempDir(tempdir.toString())
.addBootClassPathEntries(
Splitter.on(':')
Splitter.on(File.pathSeparatorChar)
.splitToList(System.getProperty("sun.boot.class.path"))
.stream()
.map(e -> Paths.get(e).toAbsolutePath().toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.sun.tools.javac.util.Context;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOError;
import java.io.IOException;
import java.io.OutputStream;
Expand Down Expand Up @@ -86,6 +87,10 @@
@RunWith(JUnit4.class)
public class JavacTurbineTest extends AbstractJavacTurbineCompilationTest {

private static final ImmutableList<String> HOST_CLASSPATH =
ImmutableList.copyOf(
Splitter.on(File.pathSeparatorChar).split(System.getProperty("java.class.path")));

@Test
public void hello() throws Exception {
addSourceLines(
Expand Down Expand Up @@ -217,10 +222,8 @@ public void processing() throws Exception {
"}");

optionsBuilder.addProcessors(ImmutableList.of(MyProcessor.class.getName()));
optionsBuilder.addProcessorPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addClassPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addProcessorPathEntries(HOST_CLASSPATH);
optionsBuilder.addClassPathEntries(HOST_CLASSPATH);

compile();

Expand Down Expand Up @@ -758,10 +761,8 @@ public void badEncoding() throws Exception {
"}");

optionsBuilder.addProcessors(ImmutableList.of(MyBadEncodingProcessor.class.getName()));
optionsBuilder.addProcessorPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addClassPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addProcessorPathEntries(HOST_CLASSPATH);
optionsBuilder.addClassPathEntries(HOST_CLASSPATH);

optionsBuilder.addSources(ImmutableList.copyOf(Iterables.transform(sources, TO_STRING)));
try (StringWriter sw = new StringWriter();
Expand Down Expand Up @@ -935,8 +936,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
public void processorReadsNonexistantFile() throws Exception {
addSourceLines("Hello.java", "@Deprecated class Hello {}");
optionsBuilder.addProcessors(ImmutableList.of(NoSuchFileProcessor.class.getName()));
optionsBuilder.addProcessorPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addProcessorPathEntries(HOST_CLASSPATH);
optionsBuilder.addSources(ImmutableList.copyOf(Iterables.transform(sources, TO_STRING)));

StringWriter errOutput = new StringWriter();
Expand Down Expand Up @@ -1278,8 +1278,7 @@ public void noWarningDiagnostics() throws Exception {
"}");

optionsBuilder.addProcessors(ImmutableList.of(SimpleProcessor.class.getName()));
optionsBuilder.addProcessorPathEntries(
ImmutableList.copyOf(Splitter.on(':').split(System.getProperty("java.class.path"))));
optionsBuilder.addProcessorPathEntries(HOST_CLASSPATH);
optionsBuilder.addAllJavacOpts(Arrays.asList("-Xlint:deprecation"));
optionsBuilder.addSources(ImmutableList.copyOf(Iterables.transform(sources, TO_STRING)));

Expand Down

0 comments on commit 5f4f3a1

Please sign in to comment.