org.codehaus.mojo.aspectj
Class AjcHelper

java.lang.Object
  extended by org.codehaus.mojo.aspectj.AjcHelper

public class AjcHelper
extends java.lang.Object

A helper class for creating classpaths for the compilers and report mojos

Author:
Kaare Nilsen

Field Summary
static java.lang.String DEFAULT_EXCLUDES
           
static java.lang.String DEFAULT_INCLUDES
           
 
Constructor Summary
AjcHelper()
           
 
Method Summary
static java.lang.String createClassPath(org.apache.maven.project.MavenProject project, java.util.List pluginArtifacts, java.util.List outDirs)
          Constructs AspectJ compiler classpath string
protected static java.lang.String getAsCsv(java.lang.String[] strings)
          Convert a string array to a comma seperated list
static java.util.Set getBuildFilesForAjdtFile(java.lang.String ajdtBuildDefFile, java.io.File basedir)
          Based on a AJDT build properties file resolves the combination of all include and exclude statements and returns a set of all the files to be compiled and weaved.
static java.util.Set getBuildFilesForSourceDirs(java.util.List sourceDirs, java.lang.String[] includes, java.lang.String[] excludes)
          Based on a set of sourcedirs, apply include and exclude statements and returns a set of all the files to be compiled and weaved.
static java.util.List readBuildConfigFile(java.lang.String fileName, java.io.File outputDir)
          Reads a buld config file, and retuns the List of all compiler arguments.
protected static java.util.Set resolveIncludeExcludeString(java.lang.String input, java.io.File basedir)
          Helper method to find all .java or .aj files spesified by the includeString.
static void writeBuildConfigToFile(java.util.List arguments, java.lang.String fileName, java.io.File outputDir)
          Creates a file that can be used as input to the ajc compiler using the -argdfile flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INCLUDES

public static final java.lang.String DEFAULT_INCLUDES
See Also:
Constant Field Values

DEFAULT_EXCLUDES

public static final java.lang.String DEFAULT_EXCLUDES
See Also:
Constant Field Values
Constructor Detail

AjcHelper

public AjcHelper()
Method Detail

createClassPath

public static java.lang.String createClassPath(org.apache.maven.project.MavenProject project,
                                               java.util.List pluginArtifacts,
                                               java.util.List outDirs)
Constructs AspectJ compiler classpath string

Returns:
a os spesific classpath string

getBuildFilesForAjdtFile

public static java.util.Set getBuildFilesForAjdtFile(java.lang.String ajdtBuildDefFile,
                                                     java.io.File basedir)
                                              throws org.apache.maven.plugin.MojoExecutionException
Based on a AJDT build properties file resolves the combination of all include and exclude statements and returns a set of all the files to be compiled and weaved.

Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

getBuildFilesForSourceDirs

public static java.util.Set getBuildFilesForSourceDirs(java.util.List sourceDirs,
                                                       java.lang.String[] includes,
                                                       java.lang.String[] excludes)
                                                throws org.apache.maven.plugin.MojoExecutionException
Based on a set of sourcedirs, apply include and exclude statements and returns a set of all the files to be compiled and weaved.

Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

writeBuildConfigToFile

public static void writeBuildConfigToFile(java.util.List arguments,
                                          java.lang.String fileName,
                                          java.io.File outputDir)
                                   throws java.io.IOException
Creates a file that can be used as input to the ajc compiler using the -argdfile flag. Each line in these files should contain one option or filename. Comments, as in Java, start with // and extend to the end of the line.

Parameters:
arguments - All arguments passed to ajc in this run
fileName - the filename of the argfile
outputDir - the build output area.
Throws:
java.io.IOException

readBuildConfigFile

public static java.util.List readBuildConfigFile(java.lang.String fileName,
                                                 java.io.File outputDir)
                                          throws java.io.IOException
Reads a buld config file, and retuns the List of all compiler arguments.

Parameters:
fileName - the filename of the argfile
outputDir - the build output area
Returns:
Throws:
java.io.IOException

getAsCsv

protected static java.lang.String getAsCsv(java.lang.String[] strings)
Convert a string array to a comma seperated list

Parameters:
strings -
Returns:

resolveIncludeExcludeString

protected static java.util.Set resolveIncludeExcludeString(java.lang.String input,
                                                           java.io.File basedir)
                                                    throws org.apache.maven.plugin.MojoExecutionException
Helper method to find all .java or .aj files spesified by the includeString. The includeString is a comma seperated list over files, or directories relative to the spesified basedir. Examples of correct listings
         src/main/java/
         src/main/java
         src/main/java/com/project/AClass.java
         src/main/java/com/project/AnAspect.aj
         src/main/java/com/project/AnAspect.java
 

Parameters:
includeList -
Returns:
a list over all files inn the include string
Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException


Copyright © 2005-2009. All Rights Reserved.