org.codehaus.mojo.aspectj
Class AjcHelper

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

public class AjcHelper
extends Object

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

Author:
Kaare Nilsen

Field Summary
static String DEFAULT_EXCLUDES
           
static String DEFAULT_INCLUDES
           
 
Constructor Summary
AjcHelper()
           
 
Method Summary
static String createClassPath(org.apache.maven.project.MavenProject project, List pluginArtifacts, List outDirs)
          Constructs AspectJ compiler classpath string
protected static String getAsCsv(String[] strings)
          Convert a string array to a comma separated list
static Set getBuildFilesForAjdtFile(String ajdtBuildDefFile, 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 Set getBuildFilesForSourceDirs(List sourceDirs, String[] includes, 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 Set getWeaveSourceFiles(String[] weaveDirs)
          Based on a set of weavedirs returns a set of all the files to be weaved.
static List readBuildConfigFile(String fileName, File outputDir)
          Reads a build config file, and returns the List of all compiler arguments.
protected static Set resolveIncludeExcludeString(String input, File basedir)
          Helper method to find all .java or .aj files specified by the includeString.
static void writeBuildConfigToFile(List arguments, String fileName, 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 String DEFAULT_INCLUDES
See Also:
Constant Field Values

DEFAULT_EXCLUDES

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

AjcHelper

public AjcHelper()
Method Detail

createClassPath

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

Parameters:
project - the Maven Project
pluginArtifacts - the plugin Artifacts
outDirs - the outputDirectories
Returns:
a os spesific classpath string

getBuildFilesForAjdtFile

public static Set getBuildFilesForAjdtFile(String ajdtBuildDefFile,
                                           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.

Parameters:
ajdtBuildDefFile - the ajdtBuildDefFile
basedir - the baseDirectory
Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

getBuildFilesForSourceDirs

public static Set getBuildFilesForSourceDirs(List sourceDirs,
                                             String[] includes,
                                             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.

Parameters:
sourceDirs -
includes -
excludes -
Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

getWeaveSourceFiles

public static Set getWeaveSourceFiles(String[] weaveDirs)
                               throws org.apache.maven.plugin.MojoExecutionException
Based on a set of weavedirs returns a set of all the files to be weaved.

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

writeBuildConfigToFile

public static void writeBuildConfigToFile(List arguments,
                                          String fileName,
                                          File outputDir)
                                   throws 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:
IOException

readBuildConfigFile

public static List readBuildConfigFile(String fileName,
                                       File outputDir)
                                throws IOException
Reads a build config file, and returns the List of all compiler arguments.

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

getAsCsv

protected static String getAsCsv(String[] strings)
Convert a string array to a comma separated list

Parameters:
strings -
Returns:

resolveIncludeExcludeString

protected static Set resolveIncludeExcludeString(String input,
                                                 File basedir)
                                          throws org.apache.maven.plugin.MojoExecutionException
Helper method to find all .java or .aj files specified by the includeString. The includeString is a comma separated list over files, or directories relative to the specified 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:
input -
basedir - the baseDirectory
Returns:
a list over all files inn the include string
Throws:
IOException
org.apache.maven.plugin.MojoExecutionException


Copyright © 2005-2014 Codehaus. All Rights Reserved.