public class FileSystemCompiler
extends Object
Command-line compiler (aka. groovyc).
| Modifiers | Name | Description |
|---|---|---|
static class |
FileSystemCompiler.CompilationOptions |
Command-line options accepted by the groovyc launcher. |
static class |
FileSystemCompiler.VersionProvider |
Supplies version text for the groovyc command line. |
| Constructor and description |
|---|
FileSystemCompiler(CompilerConfiguration configuration)Creates a file-system compiler using the supplied configuration. |
FileSystemCompiler(CompilerConfiguration configuration, CompilationUnit cu)Creates a file-system compiler using the supplied configuration and optional prebuilt compilation unit. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static int |
checkFiles(String[] filenames)Counts unreadable or missing source files in the supplied list. |
|
public static void |
commandLineCompile(String[] args)Same as main(args) except that exceptions are thrown out instead of causing the VM to exit. |
|
public static void |
commandLineCompile(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 |
|
public static void |
commandLineCompileWithErrorHandling(String[] args, boolean lookupUnnamedFiles)Primary entry point for compiling from the command line (using the groovyc script). |
|
public void |
compile(String[] paths)Compiles the sources at the supplied paths. |
|
public void |
compile(File[] files)Compiles the supplied source files. |
|
public static CommandLine |
configureParser(FileSystemCompiler.CompilationOptions options)Creates and configures the command-line parser for compilation options. |
|
public static void |
deleteRecursive(File file)Deletes the supplied file or directory tree if it exists. |
|
public static void |
displayHelp()Prints the usage help message for CompilationOptions to stderr. |
|
public static void |
displayHelp(PrintWriter writer)Prints the usage help message for the CompilationOptions to the specified PrintWriter. |
|
public static void |
displayVersion()Prints version information to stderr. |
|
public static void |
displayVersion(PrintWriter writer)Prints version information to the specified PrintWriter. |
|
public static void |
doCompilation(CompilerConfiguration configuration, CompilationUnit unit, String[] filenames)Compiles the supplied source files using the given configuration. |
|
public static void |
doCompilation(CompilerConfiguration configuration, CompilationUnit unit, String[] filenames, boolean lookupUnnamedFiles)Compiles the supplied source files using the given configuration and controls whether unnamed Groovy sources are searched relative to the provided file list. |
|
public static void |
main(String[] args)Primary entry point for compiling from the command line (using the groovyc script). |
|
public static boolean |
validateFiles(String[] filenames)Returns whether all supplied file names resolve to readable files. |
Creates a file-system compiler using the supplied configuration.
configuration - the compiler configuration to applyCreates a file-system compiler using the supplied configuration and optional prebuilt compilation unit.
configuration - the compiler configuration to applycu - an existing compilation unit to reuse, or null to build
a suitable oneCounts unreadable or missing source files in the supplied list.
filenames - the file names to validateSame as main(args) except that exceptions are thrown out instead of causing the VM to exit.
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
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
args - command line argumentslookupUnnamedFiles - do a lookup for .groovy files not part of
the given list of files to compileCompiles the sources at the supplied paths.
paths - the source paths to compileCompiles the supplied source files.
files - the source files to compileCreates and configures the command-line parser for compilation options.
options - the options object to bind parser results toDeletes the supplied file or directory tree if it exists.
file - the file or directory to deletePrints the usage help message for CompilationOptions to stderr.
Prints the usage help message for the CompilationOptions to the specified PrintWriter.
Prints version information to stderr.
Prints version information to the specified PrintWriter.
Compiles the supplied source files using the given configuration.
configuration - the compiler configuration to useunit - an existing compilation unit to reuse, or nullfilenames - the source files to compileCompiles the supplied source files using the given configuration and controls whether unnamed Groovy sources are searched relative to the provided file list.
configuration - the compiler configuration to useunit - an existing compilation unit to reuse, or nullfilenames - the source files to compilelookupUnnamedFiles - whether to search for unnamed Groovy sources
beside the listed filesPrimary 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
args - command line argumentsReturns whether all supplied file names resolve to readable files.
filenames - the file names to validatetrue if every file exists and can be readCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.