Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.codehaus.mojo.aspectj;
/**
* The MIT License
*
* Copyright 2005-2006 The Codehaus.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.aspectj.bridge.IMessage;
import org.aspectj.tools.ajc.Main;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.Scanner;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Base class for the two aspectJ compiletime weaving mojos.
*
* For all available options see ajc-ref
*
* @author Kaare Nilsen
*/
public abstract class AbstractAjcCompiler extends AbstractAjcMojo {
// Constants
/**
* List holding all accepted values for the {@code Xajruntimetarget} parameter.
*/
public static final List XAJRUNTIMETARGET_SUPPORTED_VALUES = Arrays.asList("1.2", "1.5");
/**
* The source directory for the aspects.
*
*/
@Parameter( defaultValue = "src/main/aspect" )
protected String aspectDirectory = "src/main/aspect";
/**
* The source directory for the test aspects.
*
*/
@Parameter( defaultValue = "src/test/aspect" )
protected String testAspectDirectory = "src/test/aspect";
/**
* List of ant-style patterns used to specify the aspects that should be included when compiling. When none
* specified all .java and .aj files in the project source directories, or directories specified by the ajdtDefFile
* property are included.
*
*/
@Parameter
protected String[] includes;
/**
* List of ant-style patterns used to specify the aspects that should be excluded when compiling. When none
* specified all .java and .aj files in the project source directories, or directories specified by the ajdtDefFile
* property are included.
*
*/
@Parameter
protected String[] excludes;
/**
* Where to find the ajdt build definition file. If set this will override the use of project sourcedirs.
*
*/
@Parameter
protected String ajdtBuildDefFile;
/**
* Generate aop.xml file for load-time weaving with default name (/META-INF/aop.xml).
*
*/
@Parameter
protected boolean outxml;
/**
* Generate aop.xml file for load-time weaving with custom name.
*
*/
@Parameter
protected String outxmlfile;
/**
* Generate .ajesym symbol files for emacs support.
*
*/
@Parameter
protected boolean emacssym;
/**
* Set the compiler "proc" argument.
* Aspectj supports Annotation processing since 1.8.2, it can been disabled by proc:none.
*
* @see AspectJ 1.8.2 Release notes
* @see Annotation Processing
*/
@Parameter
protected String proc;
/**
* Set the compiler "parameters" argument.
*
*/
@Parameter
protected boolean parameters;
/**
* Allows the caller to provide additional arguments in a Map format. For example:
*
*
* @since 1.5
*/
@Parameter
protected Map Xset;
/**
* generate .ajsym file into the output directory
*
*/
@Parameter
protected boolean crossrefs;
/**
* Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore,
* warning, or error. This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar.
*
*/
@Parameter
protected String Xlint;
/**
* Specify properties file to set levels for specific crosscutting messages.
* PropertyFile is a path to a Java .properties file that takes the same property names and values as
* org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.
*
*/
@Parameter
protected File Xlintfile;
/**
* Enables the compiler to support hasmethod(method_pattern) and hasfield(field_pattern) type patterns, but only
* within declare statements. It's experimental and undocumented because it may change, and because it doesn't yet
* take into account ITDs.
*
* @since 1.3
*/
@Parameter
protected boolean XhasMember;
/**
* Specify classfile target setting (1.1 to 1.8) default is 1.2
*
*/
@Parameter( defaultValue = "${project.build.java.target}" )
protected String target;
/**
* Toggle assertions (1.3, 1.4, 1.5, 1.6, 1.7 or 1.8 - default is 1.4). When using -source 1.3, an assert()
* statement valid under Java 1.4 will result in a compiler error. When using -source 1.4, treat assert
* as a keyword and implement assertions according to the 1.4 language spec. When using -source 1.5 or higher, Java
* 5 language features are permitted. With --source 1.7 or higher Java 7 features are supported.
*
*/
@Parameter( defaultValue = "${mojo.java.target}" )
protected String source;
/**
* Specify compiler compliance setting.
* Defaults to 1.4, with permitted values ("1.3", "1.4", "1.5", "1.6" and "1.7", "1.8").
*
* @see org.codehaus.mojo.aspectj.AjcHelper#ACCEPTED_COMPLIANCE_LEVEL_VALUES
*/
@Parameter( defaultValue = "1.4" )
protected String complianceLevel;
/**
* Toggle warning messages on deprecations
*
*/
@Parameter
protected boolean deprecation;
/**
* Emit no errors for unresolved imports;
*
*/
@Parameter
protected boolean noImportError;
/**
* Keep compiling after error, dumping class files with problem methods
*
*/
@Parameter
protected boolean proceedOnError;
/**
* Preserve all local variables during code generation (to facilitate debugging).
*
*/
@Parameter
protected boolean preserveAllLocals;
/**
* Compute reference information.
*
*/
@Parameter
protected boolean referenceInfo;
/**
* Specify default source encoding format.
*
*/
@Parameter( property = "project.build.sourceEncoding" )
protected String encoding;
/**
* Emit messages about accessed/processed compilation units
*
*/
@Parameter
protected boolean verbose;
/**
* Emit messages about weaving
*
*/
@Parameter
protected boolean showWeaveInfo;
/**
* Repeat compilation process N times (typically to do performance analysis).
*
*/
@Parameter
protected int repeat;
/**
* (Experimental) runs weaver in reweavable mode which causes it to create woven classes that can be rewoven,
* subject to the restriction that on attempting a reweave all the types that advised the woven type must be
* accessible.
*
*/
@Parameter
protected boolean Xreweavable;
/**
* (Experimental) Create class files that can't be subsequently rewoven by AspectJ.
*
*/
@Parameter
protected boolean XnotReweavable;
/**
* (Experimental) do not inline around advice
*
*/
@Parameter
protected boolean XnoInline;
/**
* (Experimental) Normally it is an error to declare aspects {@link Serializable}. This option removes that restriction.
*
*/
@Parameter
protected boolean XserializableAspects;
/**
* Causes the compiler to calculate and add the SerialVersionUID field to any type implementing {@link Serializable} that is
* affected by an aspect. The field is calculated based on the class before weaving has taken place.
*
*/
@Parameter
protected boolean XaddSerialVersionUID;
/**
* Causes compiler to terminate before weaving
*
*/
@Parameter
protected boolean XterminateAfterCompilation;
/**
* (Experimental) Allows code to be generated that targets a 1.2 or a 1.5 level AspectJ runtime (default 1.5)
*
*/
@Parameter( defaultValue = "1.5" )
protected String Xajruntimetarget;
/**
* supply a comma separated list of new joinpoints
* that can be identified by pointcuts. Values are:
* arrayconstruction, synchronization
*
*/
@Parameter
protected String Xjoinpoints;
/**
* Override location of VM's bootclasspath for purposes of evaluating types when compiling. Path is a single
* argument containing a list of paths to zip files or directories, delimited by the platform-specific path
* delimiter.
*
*/
@Parameter
protected String bootclasspath;
/**
* Emit warnings for any instances of the comma-delimited list of questionable code.
* Supported values are shown in the list below, with their respective explanations - as copied
* directly from the AJC reference.
*
*
*
constructorName
*
method with constructor name
*
packageDefaultMethod
*
attempt to override package-default method
*
deprecation
*
usage of deprecated type or member
*
maskedCatchBlocks
*
hidden catch block
*
unusedLocals
*
local variable never read
*
unusedArguments
*
method argument never read
*
unusedImports
*
import statement not used by code in file
*
none
*
suppress all compiler warnings
*
*
* @see Eclipse AJC reference
*/
@Parameter
protected String warn;
/**
* The filename holding AJC build arguments.
* The file will be placed in the project build output directory, and will contain all the arguments passed to
* the AJC compiler in the last run, and also all the files included in the AJC build.
*
* Sample content shown below to illustrate typical content within the builddef.lst file:
*
*