@SuppressFBWarnings("PT_FINAL_TYPE_RETURN")
public static GroovyWorkspaceCompiler of(Path targetDirectory, Path workspaceRoot, Path changedFilesRoot) {
checkNotNull(targetDirectory, "targetDirectory must not be null");
checkNotNull(workspaceRoot, "workspaceRoot must not be null");
checkNotNull(changedFilesRoot, "changedFilesRoot must not be null");
checkArgument(targetDirectory.toFile().isDirectory(), "targetDirectory must be a directory");
checkArgument(workspaceRoot.toFile().isDirectory(), "workspaceRoot must be a directory");
checkArgument(changedFilesRoot.toFile().isDirectory(), "changedFilesRoot must be a directory");
CompilerConfiguration config = new CompilerConfiguration();
config.setTargetDirectory(targetDirectory.toFile());
GroovyWorkspaceCompiler workspaceCompiler =
new GroovyWorkspaceCompiler(workspaceRoot, changedFilesRoot, config);
workspaceCompiler.addAllSourcesToCompilationUnit();
return workspaceCompiler;
}