org.curjent.test.agent.asmify
Class GenerateAsm

java.lang.Object
  extended by org.curjent.test.agent.asmify.GenerateAsm

public class GenerateAsm
extends Object

Generates and formats the ASM test files.


Field Summary
private static String ASM_CLASS_SUFFIX
          Suffix used for asmified classes.
private static Pattern ASM_FILENAME_PATTERN
          Pattern for matching asmified file names.
private static String ASM_JAR_FILE
          Project's ASM JAR file.
private static String ASMIFY_DIR
          Project's directory for the asmified files.
private static String CLASS_FILE_DIR
          Project's output directory for compiled class files.
private static String CLASSPATH_SEPARATOR
          Separator for directory and JAR paths in CLASSPATH.
private static String PATH_SEPARATOR
          Separator for directory and file names in file system paths.
private static int PROJECT_ROOT
          Argument index for the project root.
private static Pattern SOURCE_FILENAME_PATTERN
          Pattern for matching source file names to asmify.
 
Constructor Summary
GenerateAsm()
           
 
Method Summary
private  File asmFile(File sourceFile)
          Returns the Asm file name for a source file.
private  List<String> asmify(String className, String classpath)
          Asmify the given file.
private  String className(File sourceFile)
          Returns the corresponding class name of a source file.
private  String classpath(File projectRoot)
          Returns the CLASSPATH for running the asmifier.
(package private)  void exit()
          Exits the JVM with a -1 error code
private  void fixup(List<String> lines)
          Fixes package names and other problems with the asmified output lines.
private  void format(List<String> lines)
          Formats the asmified output lines.
(package private)  void log(Object o)
          Prints the object to stdout.
static void main(String[] args)
          Command line entry point.
private  void run(String[] args)
          Evaluates and saves the command line arguments
private  void write(File asmFile, List<String> lines)
          Writes the Asm file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROJECT_ROOT

private static final int PROJECT_ROOT
Argument index for the project root.

See Also:
Constant Field Values

ASMIFY_DIR

private static final String ASMIFY_DIR
Project's directory for the asmified files.

See Also:
Constant Field Values

CLASS_FILE_DIR

private static final String CLASS_FILE_DIR
Project's output directory for compiled class files.

See Also:
Constant Field Values

ASM_JAR_FILE

private static final String ASM_JAR_FILE
Project's ASM JAR file.

See Also:
Constant Field Values

SOURCE_FILENAME_PATTERN

private static final Pattern SOURCE_FILENAME_PATTERN
Pattern for matching source file names to asmify.


ASM_CLASS_SUFFIX

private static final String ASM_CLASS_SUFFIX
Suffix used for asmified classes.

See Also:
Constant Field Values

ASM_FILENAME_PATTERN

private static final Pattern ASM_FILENAME_PATTERN
Pattern for matching asmified file names.


CLASSPATH_SEPARATOR

private static final String CLASSPATH_SEPARATOR
Separator for directory and JAR paths in CLASSPATH.


PATH_SEPARATOR

private static final String PATH_SEPARATOR
Separator for directory and file names in file system paths.

Constructor Detail

GenerateAsm

public GenerateAsm()
Method Detail

run

private void run(String[] args)
          throws Throwable
Evaluates and saves the command line arguments

Throws:
Throwable

classpath

private String classpath(File projectRoot)
                  throws Throwable
Returns the CLASSPATH for running the asmifier.

Throws:
Throwable

className

private String className(File sourceFile)
Returns the corresponding class name of a source file.


asmFile

private File asmFile(File sourceFile)
Returns the Asm file name for a source file.


asmify

private List<String> asmify(String className,
                            String classpath)
                     throws Throwable
Asmify the given file.

Throws:
Throwable

fixup

private void fixup(List<String> lines)
Fixes package names and other problems with the asmified output lines.


format

private void format(List<String> lines)
Formats the asmified output lines.


write

private void write(File asmFile,
                   List<String> lines)
            throws Throwable
Writes the Asm file.

Throws:
Throwable

log

void log(Object o)
Prints the object to stdout.


exit

void exit()
Exits the JVM with a -1 error code


main

public static void main(String[] args)
                 throws Throwable
Command line entry point.

Parameters:
args - args[0] - project's root directory
Throws:
Throwable


Copyright 2009-2011 Tom Landon
Apache License 2.0