public CompileStrategy( ReadWriteFileSystem<I> sourcePath, ReadWriteFileSystem<O> sourceOutput, ReadWriteFileSystem<O> classOutput) { // this.classPath = new LinkedList<ReadFileSystem<?>>(); this.sourcePath = sourcePath; this.sourceOutput = sourceOutput; this.classOutput = classOutput; this.config = new CompilerConfig().force(true); }
public CompilerAssert<I, O> formalErrorReporting(boolean formalErrorReporting) { if (formalErrorReporting) { strategy.config.withProcessorOption("juzu.error_reporting", "formal"); } else { strategy.config.withProcessorOption("juzu.error_reporting", null); } return this; }
builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()).
Collection<JavaFileObject> compilationUnits) throws IOException, CompilationException { if (compilationUnits.isEmpty()) { if (!config.getForce()) { return; for (String optionName : config.getProcessorOptionNames()) { options.add("-A" + optionName + "=" + config.getProcessorOptionValue(optionName));
private Builder( ReadFileSystem<?> sourcePath, ReadWriteFileSystem<?> sourceOutput, ReadWriteFileSystem<?> classOutput, List<ReadFileSystem<?>> classPaths) { Provider<JavaCompiler> javaCompiler = new Provider<JavaCompiler>() { public JavaCompiler get() { return ToolProvider.getSystemJavaCompiler(); } }; this.processor = null; this.javaCompiler = javaCompiler; this.sourcePath = sourcePath; this.sourceOutput = sourceOutput; this.classOutput = classOutput; this.classPaths = classPaths; this.config = new CompilerConfig(); }
builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()).
Collection<JavaFileObject> compilationUnits) throws IOException, CompilationException { if (compilationUnits.isEmpty()) { if (!config.getForce()) { return; for (String optionName : config.getProcessorOptionNames()) { options.add("-A" + optionName + "=" + config.getProcessorOptionValue(optionName));
private Builder( ReadFileSystem<?> sourcePath, ReadWriteFileSystem<?> sourceOutput, ReadWriteFileSystem<?> classOutput, List<ReadFileSystem<?>> classPaths) { Provider<JavaCompiler> javaCompiler = new Provider<JavaCompiler>() { public JavaCompiler get() { return ToolProvider.getSystemJavaCompiler(); } }; this.processor = null; this.javaCompiler = javaCompiler; this.sourcePath = sourcePath; this.sourceOutput = sourceOutput; this.classOutput = classOutput; this.classPaths = classPaths; this.config = new CompilerConfig(); }
public CompileStrategy( ReadWriteFileSystem<I> sourcePath, ReadWriteFileSystem<O> sourceOutput, ReadWriteFileSystem<O> classOutput) { // this.classPath = new LinkedList<ReadFileSystem<?>>(); this.sourcePath = sourcePath; this.sourceOutput = sourceOutput; this.classOutput = classOutput; this.config = new CompilerConfig().force(true); }
public CompilerAssert<I, O> formalErrorReporting(boolean formalErrorReporting) { if (formalErrorReporting) { strategy.config.withProcessorOption("juzu.error_reporting", "formal"); } else { strategy.config.withProcessorOption("juzu.error_reporting", null); } return this; }
@Test public void testGetResourceFromClassPath() throws Exception { File fic = File.createTempFile("test", ".jar"); fic.deleteOnExit(); JavaArchive jar = ShrinkWrap.create(JavaArchive.class); jar.addAsResource(new StringAsset("the_resource"), "resource.txt"); jar.as(ZipExporter.class).exportTo(fic, true); JarFileSystem classpath = new JarFileSystem(new JarFile(fic)); RAMFileSystem output = new RAMFileSystem(); Compiler compiler = Compiler.builder(). javaCompiler(compilerProvider). config(new CompilerConfig().force(true)). addClassPath(classpath). sourcePath(new RAMFileSystem()). output(output).build(); GetResource processor = new GetResource(StandardLocation.CLASS_PATH, FileKey.newResourceName("", "resource.txt")); compiler.addAnnotationProcessor(processor); compiler.compile(); processor.assertResource("the_resource"); }
@Test public void testGetResourceFromClassPath() throws Exception { File fic = File.createTempFile("test", ".jar"); fic.deleteOnExit(); JavaArchive jar = ShrinkWrap.create(JavaArchive.class); jar.addAsResource(new StringAsset("the_resource"), "resource.txt"); jar.as(ZipExporter.class).exportTo(fic, true); JarFileSystem classpath = new JarFileSystem(new JarFile(fic)); RAMFileSystem output = new RAMFileSystem(); Compiler compiler = Compiler.builder(). javaCompiler(compilerProvider). config(new CompilerConfig().force(true)). addClassPath(classpath). sourcePath(new RAMFileSystem()). output(output).build(); GetResource processor = new GetResource(StandardLocation.CLASS_PATH, FileKey.newResourceName("", "resource.txt")); compiler.addAnnotationProcessor(processor); compiler.compile(); processor.assertResource("the_resource"); }