|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.compiler.Compiler
org.teatrove.tea.util.AbstractCompiler
org.teatrove.tea.util.FileCompiler
public class FileCompiler
FileCompiler compiles tea source files by reading them from a file or a directory. The compiled code can be written as class files to a given destination directory, they can be passed to a ClassInjector, or they can be sent to both.
When given a directory, FileCompiler compiles all files with the extension ".tea". If a destination directory is used, tea files that have a matching class file that is more up-to-date will not be compiled, unless they are forced to be re-compiled.
ClassInjector| Nested Class Summary | |
|---|---|
class |
FileCompiler.FileUnit
|
class |
FileCompiler.JarredUnit
|
class |
FileCompiler.Unit
|
| Nested classes/interfaces inherited from class org.teatrove.tea.util.AbstractCompiler |
|---|
AbstractCompiler.AbstractUnit |
| Field Summary |
|---|
| Fields inherited from class org.teatrove.tea.util.AbstractCompiler |
|---|
mEncoding, mForce, mInjector, mPrecompiledTolerance, mRootDestDir, mRootPackage |
| Constructor Summary | |
|---|---|
FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector)
|
|
FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding)
|
|
FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding,
Map<String,Template> parseTreeMap)
|
|
FileCompiler(File rootSourceDir,
String rootPackage,
File rootDestDir,
ClassInjector injector)
|
|
FileCompiler(File rootSourceDir,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding)
|
|
| Method Summary | |
|---|---|
String[] |
compile(String[] names)
Overrides Compiler class implementation (TemplateRepository integration). |
String[] |
compileAll(boolean recurse)
Compiles all files in the source directory. |
protected CompilationUnit |
createCompilationUnit(String name)
Always returns an instance of FileCompiler.Unit. |
String[] |
getAllTemplateNames()
Returns all sources (template names) available from the source directory and in all sub-directories. |
static void |
main(String[] args)
Entry point for a command-line tool suitable for compiling Tea templates to be bundled with a product. |
void |
setForceCompile(boolean force)
|
boolean |
sourceExists(String name)
|
| Methods inherited from class org.teatrove.tea.util.AbstractCompiler |
|---|
compileAll, getRootPackage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileCompiler(File rootSourceDir,
String rootPackage,
File rootDestDir,
ClassInjector injector)
rootSourceDir - Required root source directoryrootPackage - Optional root package to compile source torootDestDir - Optional directory to place generated class filesinjector - Optional ClassInjector to feed generated classes into
public FileCompiler(File rootSourceDir,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding)
rootSourceDir - Required root source directoryrootPackage - Optional root package to compile source torootDestDir - Optional directory to place generated class filesinjector - Optional ClassInjector to feed generated classes intoencoding - Optional character encoding used by source files
public FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector)
rootSourceDirs - Required root source directoriesrootPackage - Optional root package to compile source torootDestDir - Optional directory to place generated class filesinjector - Optional ClassInjector to feed generated classes into
public FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding)
rootSourceDirs - Required root source directoriesrootPackage - Optional root package to compile source torootDestDir - Optional directory to place generated class filesinjector - Optional ClassInjector to feed generated classes intoencoding - Optional character encoding used by source files
public FileCompiler(File[] rootSourceDirs,
String rootPackage,
File rootDestDir,
ClassInjector injector,
String encoding,
Map<String,Template> parseTreeMap)
rootSourceDirs - Required root source directoriesrootPackage - Optional root package to compile source torootDestDir - Optional directory to place generated class filesinjector - Optional ClassInjector to feed generated classes intoencoding - Optional character encoding used by source filesparseTreeMap - Optional map should be thread-safe. See
Compiler for details.| Method Detail |
|---|
public static void main(String[] args)
throws Exception
Usage: java org.teatrove.tea.util.FileCompiler {options}
<template root directory> {templates}
where {options} includes:
-context <class> Specify a runtime context class to compile against.
-dest <directory> Specify where to place generated class files.
-force Compile all templates, even if up-to-date.
-package <package> Root package to compile templates into.
-encoding <encoding> Specify character encoding used by source files.
-guardian Enable the exception guardian.
Exceptionpublic void setForceCompile(boolean force)
setForceCompile in class AbstractCompilerforce - When true, compile all source, even if up-to-date
public String[] compileAll(boolean recurse)
throws IOException
recurse - When true, recursively compiles all files and directories
IOException
public String[] compile(String[] names)
throws IOException
AbstractCompiler
compile in class AbstractCompilernames - an array of fully qualified template names
IOException
public String[] getAllTemplateNames()
throws IOException
AbstractCompiler
getAllTemplateNames in class AbstractCompilerIOExceptionpublic boolean sourceExists(String name)
sourceExists in class Compilerprotected CompilationUnit createCompilationUnit(String name)
createCompilationUnit in class CompilerFileCompiler.Unit.getSourceFile()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||