builder.addClassPath(classes); builder.addClassPath(cp); compiler = builder.build(); compiler.compile(toCompile.toArray(new String[toCompile.size()]));
public static Builder builder() { return new Builder(null, null, null, new ArrayList<ReadFileSystem<?>>()); }
builder.addClassPath(classes); builder.addClassPath(cp); compiler = builder.build(); compiler.compile(toCompile.toArray(new String[toCompile.size()]));
Compiler compiler = Compiler. builder(). sourcePath(sourcePath). sourceOutput(classOutput). classOutput(classOutput). addClassPath(classPath).build(); compiler.addAnnotationProcessor(new MainProcessor()); compiler.compile();
@Test public void testProcessorErrorOnElement() throws Exception { DiskFileSystem fs = diskFS("compiler.annotationexception"); Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build(); @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6) @javax.annotation.processing.SupportedAnnotationTypes({"*"})
Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build(); @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6) @javax.annotation.processing.SupportedAnnotationTypes({"*"})
Compiler compiler = Compiler. builder(). sourcePath(sourcePath). sourceOutput(classOutput). classOutput(classOutput). addClassPath(classPath).build(); compiler.addAnnotationProcessor(new MainProcessor()); compiler.compile();
@Test public void testProcessorErrorOnElement() throws Exception { DiskFileSystem fs = diskFS("compiler.annotationexception"); Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build(); @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6) @javax.annotation.processing.SupportedAnnotationTypes({"*"})
Compiler compiler = Compiler.builder().sourcePath(ramFS).output(output).build(); compiler.compile(); assertEquals(2, output.size(ReadFileSystem.FILE));
Compiler compiler = Compiler. builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()). build(); P processor = new P(); compiler.addAnnotationProcessor(processor);
Compiler compiler = Compiler. builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()). build(); P processor = new P(); compiler.addAnnotationProcessor(processor);
Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build(); @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6) @javax.annotation.processing.SupportedAnnotationTypes({"*"})
Compiler compiler = Compiler.builder().sourcePath(ramFS).output(output).build(); compiler.compile(); assertEquals(2, output.size(ReadFileSystem.FILE));
@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"); }
public static Builder builder() { return new Builder(null, null, null, new ArrayList<ReadFileSystem<?>>()); }
void compile() throws IOException, CompilationException { compiler = builder().build(); compiler.compile(); } }
public Builder addClassPath(Iterable<ReadFileSystem<?>> classPaths) { for (ReadFileSystem<?> classPath : classPaths) { addClassPath(classPath); } return this; }
public Builder addClassPath(Iterable<ReadFileSystem<?>> classPaths) { for (ReadFileSystem<?> classPath : classPaths) { addClassPath(classPath); } return this; }
@Test public void testGetResourceFromSourcePath() throws Exception { DiskFileSystem input = diskFS("compiler.getresource"); RAMFileSystem output = new RAMFileSystem(); Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(input).output(output).build(); GetResource processor = new GetResource(StandardLocation.SOURCE_PATH, FileKey.newResourceName("compiler.getresource", "A.txt")); compiler.addAnnotationProcessor(processor); compiler.compile(); assertEquals(1, output.size(ReadFileSystem.FILE)); processor.assertResource("value"); }