org.codehaus.groovy.tools
Class FileSystemCompiler

java.lang.Object
  extended by org.codehaus.groovy.tools.FileSystemCompiler

public class FileSystemCompiler
extends java.lang.Object

Command-line compiler (aka. groovyc).


Constructor Summary
FileSystemCompiler(CompilerConfiguration configuration)
           
FileSystemCompiler(CompilerConfiguration configuration, CompilationUnit cu)
           
 
Method Summary
static int checkFiles(java.lang.String[] filenames)
           
static void commandLineCompile(java.lang.String[] args)
          Same as main(args) except that exceptions are thrown out instead of causing the VM to exit.
static void commandLineCompile(java.lang.String[] args, boolean lookupUnnamedFiles)
          Same as main(args) except that exceptions are thrown out instead of causing the VM to exit and the lookup for .groovy files can be controlled
static void commandLineCompileWithErrorHandling(java.lang.String[] args, boolean lookupUnnamedFiles)
          Primary entry point for compiling from the command line (using the groovyc script).
 void compile(java.io.File[] files)
           
 void compile(java.lang.String[] paths)
           
static org.apache.commons.cli.Options createCompilationOptions()
           
static java.io.File createTempDir()
           
static void deleteRecursive(java.io.File file)
           
static void displayHelp(org.apache.commons.cli.Options options)
           
static void displayVersion()
           
static void doCompilation(CompilerConfiguration configuration, CompilationUnit unit, java.lang.String[] filenames)
           
static void doCompilation(CompilerConfiguration configuration, CompilationUnit unit, java.lang.String[] filenames, boolean lookupUnnamedFiles)
           
static CompilerConfiguration generateCompilerConfigurationFromOptions(org.apache.commons.cli.CommandLine cli)
           
static java.lang.String[] generateFileNamesFromOptions(org.apache.commons.cli.CommandLine cli)
           
static void main(java.lang.String[] args)
          Primary entry point for compiling from the command line (using the groovyc script).
static boolean validateFiles(java.lang.String[] filenames)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemCompiler

public FileSystemCompiler(CompilerConfiguration configuration)
                   throws ConfigurationException
Throws:
ConfigurationException

FileSystemCompiler

public FileSystemCompiler(CompilerConfiguration configuration,
                          CompilationUnit cu)
                   throws ConfigurationException
Throws:
ConfigurationException
Method Detail

compile

public void compile(java.lang.String[] paths)
             throws java.lang.Exception
Throws:
java.lang.Exception

compile

public void compile(java.io.File[] files)
             throws java.lang.Exception
Throws:
java.lang.Exception

displayHelp

public static void displayHelp(org.apache.commons.cli.Options options)

displayVersion

public static void displayVersion()

checkFiles

public static int checkFiles(java.lang.String[] filenames)

validateFiles

public static boolean validateFiles(java.lang.String[] filenames)

commandLineCompile

public static void commandLineCompile(java.lang.String[] args)
                               throws java.lang.Exception
Same as main(args) except that exceptions are thrown out instead of causing the VM to exit.

Throws:
java.lang.Exception

commandLineCompile

public static void commandLineCompile(java.lang.String[] args,
                                      boolean lookupUnnamedFiles)
                               throws java.lang.Exception
Same as main(args) except that exceptions are thrown out instead of causing the VM to exit and the lookup for .groovy files can be controlled

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
Primary entry point for compiling from the command line (using the groovyc script). If calling inside a process and you don't want the JVM to exit on an error call commandLineCompile(String[]), which this method simply wraps

Parameters:
args - command line arguments

commandLineCompileWithErrorHandling

public static void commandLineCompileWithErrorHandling(java.lang.String[] args,
                                                       boolean lookupUnnamedFiles)
Primary entry point for compiling from the command line (using the groovyc script). If calling inside a process and you don't want the JVM to exit on an error call commandLineCompile(String[]), which this method simply wraps

Parameters:
args - command line arguments
lookupUnnamedFiles - do a lookup for .groovy files not part of the given list of files to compile

doCompilation

public static void doCompilation(CompilerConfiguration configuration,
                                 CompilationUnit unit,
                                 java.lang.String[] filenames)
                          throws java.lang.Exception
Throws:
java.lang.Exception

doCompilation

public static void doCompilation(CompilerConfiguration configuration,
                                 CompilationUnit unit,
                                 java.lang.String[] filenames,
                                 boolean lookupUnnamedFiles)
                          throws java.lang.Exception
Throws:
java.lang.Exception

generateFileNamesFromOptions

public static java.lang.String[] generateFileNamesFromOptions(org.apache.commons.cli.CommandLine cli)

generateCompilerConfigurationFromOptions

public static CompilerConfiguration generateCompilerConfigurationFromOptions(org.apache.commons.cli.CommandLine cli)

createCompilationOptions

public static org.apache.commons.cli.Options createCompilationOptions()

createTempDir

public static java.io.File createTempDir()
                                  throws java.io.IOException
Throws:
java.io.IOException

deleteRecursive

public static void deleteRecursive(java.io.File file)