Package org.codehaus.groovy.tools.javac

Examples of org.codehaus.groovy.tools.javac.JavaStubCompilationUnit$JavaResolverOperation


    extends CompileTaskSupport
{
    @Override
    protected void compile() {
        GroovyClassLoader gcl = createClassLoader();
        JavaStubCompilationUnit cu = new JavaStubCompilationUnit(config, gcl, destdir);

        int count = 0;

        String[] list = src.list();
        for (int i = 0; i < list.length; i++) {
            File basedir = getProject().resolveFile(list[i]);
            if (!basedir.exists()) {
                throw new BuildException("Source directory does not exist: " + basedir, getLocation());
            }

            DirectoryScanner scanner = getDirectoryScanner(basedir);
            String[] includes = scanner.getIncludedFiles();

            log.debug("Including files from: " + basedir);

            for (int j=0; j < includes.length; j++) {
                log.debug("    "  + includes[j]);
               
                File file = new File(basedir, includes[j]);
                cu.addSource(file);

                // Increment the count for each non/java src we found
                if (!includes[j].endsWith(".java")) {
                    count++;
                }
            }
        }

        if (count > 0) {
            log.info("Generating " + count + " Java stub" + (count > 1 ? "s" : "") + " to " + destdir);

            cu.compile();

            log.info("Generated " + cu.getStubCount() + " Java stub(s)");
        }
        else {
            log.info("No sources found for stub generation");
        }
    }
View Full Code Here


public class GenerateStubsTask
    extends CompileTaskSupport
{
    protected void compile() {
        GroovyClassLoader gcl = createClassLoader();
        JavaStubCompilationUnit compilation = new JavaStubCompilationUnit(config, gcl, destdir);

        int count = 0;
       
        String[] list = src.list();
        for (int i = 0; i < list.length; i++) {
            File basedir = getProject().resolveFile(list[i]);
            if (!basedir.exists()) {
                throw new BuildException("Source directory does not exist: " + basedir, getLocation());
            }

            DirectoryScanner scanner = getDirectoryScanner(basedir);
            String[] includes = scanner.getIncludedFiles();

            log.debug("Including files from: " + basedir);

            for (int j=0; j < includes.length; j++) {
                log.debug("    "  + includes[j]);
               
                File file = new File(basedir, includes[j]);
                compilation.addSourceFile(file);

                // Increment the count for each non/java src we found
                if (!includes[j].endsWith(".java")) {
                    count++;
                }
            }
        }

        if (count > 0) {
            log.info("Generating " + count + " Java stub" + (count > 1 ? "s" : "") + " to " + destdir);

            // Generate the stubs
            compilation.compile(Phases.CONVERSION);
        }
        else {
            log.info("No sources found for stub generation");
        }
    }
View Full Code Here

    extends CompileTaskSupport
{
    @Override
    protected void compile() {
        GroovyClassLoader gcl = createClassLoader();
        JavaStubCompilationUnit cu = new JavaStubCompilationUnit(config, gcl, destdir);

        int count = 0;

        String[] list = src.list();
        for (int i = 0; i < list.length; i++) {
            File basedir = getProject().resolveFile(list[i]);
            if (!basedir.exists()) {
                throw new BuildException("Source directory does not exist: " + basedir, getLocation());
            }

            DirectoryScanner scanner = getDirectoryScanner(basedir);
            String[] includes = scanner.getIncludedFiles();

            log.debug("Including files from: " + basedir);

            for (int j=0; j < includes.length; j++) {
                log.debug("    "  + includes[j]);
               
                File file = new File(basedir, includes[j]);
                cu.addSource(file);

                // Increment the count for each non/java src we found
                if (!includes[j].endsWith(".java")) {
                    count++;
                }
            }
        }

        if (count > 0) {
            log.info("Generating " + count + " Java stub" + (count > 1 ? "s" : "") + " to " + destdir);

            cu.compile();

            log.info("Generated " + cu.getStubCount() + " Java stub(s)");
        }
        else {
            log.info("No sources found for stub generation");
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.tools.javac.JavaStubCompilationUnit$JavaResolverOperation

Copyright © 2018 www.massapicom. 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.