/** * Uses annotation processors during compilation. These replace any previously specified. * * <p>Note that most annotation processors cannot be reused for more than one compilation. * * @return a new instance with the same options and the given processors */ public final Compiler withProcessors(Iterable<? extends Processor> processors) { return copy(ImmutableList.copyOf(processors), options()); }
/** * Passes command-line options to the compiler. These replace any previously specified. * * @return a new instance with the same processors and the given options */ public final Compiler withOptions(Iterable<?> options) { return copy(processors(), FluentIterable.from(options).transform(toStringFunction()).toList()); }
/** Uses the given classpath for the compilation instead of the system classpath. */ public final Compiler withClasspath(Iterable<File> classPath) { return copy(processors(), options(), Optional.of(ImmutableList.copyOf(classPath))); }
/** * Uses annotation processors during compilation. These replace any previously specified. * * <p>Note that most annotation processors cannot be reused for more than one compilation. * * @return a new instance with the same options and the given processors */ public final Compiler withProcessors(Iterable<? extends Processor> processors) { return copy(ImmutableList.copyOf(processors), options(), classPath()); }
/** * Uses the classpath from the passed on classloader (and its parents) for the compilation * instead of the system classpath. * * @throws IllegalArgumentException if the given classloader had classpaths which we could not * determine or use for compilation. */ public final Compiler withClasspathFrom(ClassLoader classloader) { String classpath = getClasspathFromClassloader(classloader); ImmutableList<String> options = ImmutableList.<String>builder().add("-classpath").add(classpath).addAll(options()).build(); return copy(processors(), options); }
/** * Passes command-line options to the compiler. These replace any previously specified. * * @return a new instance with the same processors and the given options */ public final Compiler withOptions(Iterable<?> options) { return copy( processors(), FluentIterable.from(options).transform(toStringFunction()).toList(), classPath()); }
/** * Uses the classpath from the passed on classloader (and its parents) for the compilation instead * of the system classpath. * * @throws IllegalArgumentException if the given classloader had classpaths which we could not * determine or use for compilation. * @deprecated prefer {@link #withClasspath(Iterable)}. This method only supports {@link * URLClassLoader} and the default system classloader, and {@link File}s are usually a more * natural way to expression compilation classpaths than class loaders. */ @Deprecated public final Compiler withClasspathFrom(ClassLoader classloader) { return copy(processors(), options(), Optional.of(getClasspathFromClassloader(classloader))); }