@Before public void setUp() throws IOException, InterruptedException { executorService = Executors.newScheduledThreadPool(5); // In case root_restrict_files is enabled in /etc/watchmanconfig, assume // this is one of the entries so it doesn't give up. tmp.newFolder(".git"); Watchman watchman = Watchman.build(tmp.getRootPath(), getWatchmanEnv(), new TestConsole(), new FakeClock(0)); // We assume watchman has been installed and configured properly on the system, and that setting // up the watch is successful. assumeFalse(watchman == Watchman.NULL_WATCHMAN); }
private Jsr199Javac createJavac(boolean withSyntaxError, Optional<Path> javacJar) throws IOException { File exampleJava = tmp.newFile("Example.java"); Files.write( Joiner.on('\n') .join( "package com.example;", "", "public class Example {" + (withSyntaxError ? "" : "}")), exampleJava, Charsets.UTF_8); Path pathToOutputDirectory = Paths.get("out"); tmp.newFolder(pathToOutputDirectory.toString()); Optional<SourcePath> jar = javacJar.transform(SourcePaths.toSourcePath(new FakeProjectFilesystem())); if (jar.isPresent()) { return new JarBackedJavac("com.sun.tools.javac.api.JavacTool", ImmutableSet.of(jar.get())); } return new JdkProvidedInMemoryJavac(); }