Package org.codehaus.groovy.control

Examples of org.codehaus.groovy.control.CompilationUnit.compile()


               for (int i = 0; i < files.length; i++)
                  cunit.addSource(files[i].getPath());
            }
            SingleClassCollector collector = createSingleCollector(cunit, targetSunit);
            cunit.setClassgenCallback(collector);
            cunit.compile(phase);

            for (Iterator iter = collector.getLoadedClasses().iterator(); iter.hasNext();)
            {
               Class clazz = (Class)iter.next();
               String classname = clazz.getName();
View Full Code Here


         Set<SourceUnit> setSunit = new HashSet<SourceUnit>();
         for (int i = 0; i < sources.length; i++)
            setSunit.add(cunit.addSource(sources[i].getPath()));
         MultipleClassCollector collector = createMultipleCollector(cunit, setSunit);
         cunit.setClassgenCallback(collector);
         cunit.compile(phase);

         for (Iterator iter = collector.getLoadedClasses().iterator(); iter.hasNext();)
         {
            Class clazz = (Class)iter.next();
            String classname = clazz.getName();
View Full Code Here

    assertNotNull(groovy);
    CompilerConfiguration config = new CompilerConfiguration();
    config.setTargetDirectory(fs.getRoot());
    CompilationUnit cu = new CompilationUnit(config);
    cu.addSource(groovy);
    cu.compile();
    assertTrue(groovy.delete());
    MockClient client = app.client();
    assertEquals("hello", client.render().assertStringResponse());
  }
}
View Full Code Here

    // the class will be compiled lazyly
    String resolveDescription = null;
    CompilationUnit cu = new CompilationUnit(objectGroovyClassFactory.config);
    cu.addSource(name, script);
    try {
      cu.compile(Phases.CONVERSION);
    }
    catch (CompilationFailedException e) {
      throw new CommandException(ErrorKind.INTERNAL, "Could not compile command", e);
    }
    CompileUnit ast = cu.getAST();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.