com.twitter.common.tools
Class Compiler

java.lang.Object
  extended by com.twitter.common.tools.Compiler

public final class Compiler
extends Object

A simple dependency tracking compiler that maps generated classes to the owning sources. Supports a

-Tdependencyfile
option to output dependency information to in the form:
 [source file path] -> [class file path]
 
There may be multiple lines per source file if the file contains multiple top level classes or inner classes. All paths are normalized to be relative to the classfile output directory. Also supports warning customizations including:


Field Summary
static String COLOR_FLAG
           
static String DEPENDENCYFILE_FLAG
           
static String WARN_IGNORE_MESSAGE_REGEX
           
static String WARN_IGNORE_PATH_PREFIXES
           
 
Constructor Summary
Compiler()
          Should not be used; instead invoke main(java.lang.String[]) directly.
 
Method Summary
static int compile(String[] args)
          Passes through all args to the system java compiler and tracks classes generated for each source file.
static void main(String[] args)
          Passes through all args to the system java compiler and tracks classes generated for each source file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPENDENCYFILE_FLAG

public static final String DEPENDENCYFILE_FLAG
See Also:
Constant Field Values

COLOR_FLAG

public static final String COLOR_FLAG
See Also:
Constant Field Values

WARN_IGNORE_PATH_PREFIXES

public static final String WARN_IGNORE_PATH_PREFIXES
See Also:
Constant Field Values

WARN_IGNORE_MESSAGE_REGEX

public static final String WARN_IGNORE_MESSAGE_REGEX
See Also:
Constant Field Values
Constructor Detail

Compiler

public Compiler()
Should not be used; instead invoke main(java.lang.String[]) directly. Only present to conform to a common compiler interface idiom expected by jmake.

Method Detail

compile

public static int compile(String[] args)
                   throws IOException
Passes through all args to the system java compiler and tracks classes generated for each source file.

Parameters:
args - The command line arguments.
Returns:
An exit code where 0 indicates successful compilation.
Throws:
IOException - If there is a problem writing the dependency file.

main

public static void main(String[] args)
                 throws IOException
Passes through all args to the system java compiler and tracks classes generated for each source file.

Parameters:
args - The command line arguments.
Throws:
IOException - If there is a problem writing the dependency file.