@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"); }
builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()).
builder(). javaCompiler(compilerProvider). config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")). sourcePath(fs). output(new RAMFileSystem()).
final Compiler.Builder builder() { Compiler.Builder builder = Compiler.builder(); builder.javaCompiler(javaCompiler); builder.processor(processorFactory); builder.addClassPath(classPath); builder.sourcePath(sourcePath); builder.sourceOutput(sourceOutput); builder.classOutput(classOutput); builder.config(config); return builder; }
final Compiler.Builder builder() { Compiler.Builder builder = Compiler.builder(); builder.javaCompiler(javaCompiler); builder.processor(processorFactory); builder.addClassPath(classPath); builder.sourcePath(sourcePath); builder.sourceOutput(sourceOutput); builder.classOutput(classOutput); builder.config(config); return builder; }