You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/01/17 07:36:30 UTC

svn commit: r735235 - in /labs/magma/trunk/maven-magma-plugin: ./ src/main/java/org/apache/magma/tools/maven/

Author: simoneg
Date: Fri Jan 16 22:36:30 2009
New Revision: 735235

URL: http://svn.apache.org/viewvc?rev=735235&view=rev
Log:
LABS-201 : Avoid having to subclass aspectj-mojo stuff, update to recent AspectJ version.

Removed:
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/ModulesPreparer.java
Modified:
    labs/magma/trunk/maven-magma-plugin/pom.xml
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/JettyWeavingURLClassLoader.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompileMojo.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompleteCompileMojo.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcTestCompileMojo.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java

Modified: labs/magma/trunk/maven-magma-plugin/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/pom.xml?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/pom.xml (original)
+++ labs/magma/trunk/maven-magma-plugin/pom.xml Fri Jan 16 22:36:30 2009
@@ -1,43 +1,34 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---><project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements.  See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version 2.0
+	(the "License"); you may not use this file except in compliance with
+	the License.  You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+-->
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<modelVersion>4.0.0</modelVersion>
 	<packaging>maven-plugin</packaging>
 	<groupId>org.apache.magma.tools</groupId>
 	<artifactId>maven-magma-plugin</artifactId>
 	<name>Magma Extension Mojo</name>
-	<version>0.0.2-r6</version>
+	<version>0.0.3-r1</version>
 	<description>
-		Extends the AspectJ compiler plugin, surefire test plugin and
-		jetty plugin to better suite magma components.
+	Provides mojos to compile and test a magma package.
 	</description>
 	<dependencies>
 		<dependency>
-			<groupId>org.codehaus.mojo</groupId>
-			<artifactId>aspectj-maven-plugin</artifactId>
-			<version>1.0</version>
-	      <exclusions>
-        <exclusion>
-          <groupId>org.aspectj</groupId>
-          <artifactId>aspectjrt</artifactId>
-        </exclusion>
-      </exclusions>			
-		</dependency>
-		<dependency>
 			<groupId>org.mortbay.jetty</groupId>
 			<artifactId>maven-jetty-plugin</artifactId>
 			<version>6.1H.5-beta</version>
@@ -50,24 +41,24 @@
 		<dependency>
 			<groupId>org.aspectj</groupId>
 			<artifactId>aspectjweaver</artifactId>
-			<version>1.6.1</version>
+			<version>1.6.2</version>
 		</dependency>
 		<dependency>
 			<groupId>org.aspectj</groupId>
 			<artifactId>aspectjtools</artifactId>
-			<version>1.6.1</version>
+			<version>1.6.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.openjpa</groupId>
+			<artifactId>openjpa</artifactId>
+			<version>1.2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-archiver</artifactId>
+			<version>2.0</version>
 		</dependency>
-    <dependency>
-      <groupId>org.apache.openjpa</groupId>
-      <artifactId>openjpa</artifactId>
-      <version>1.2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-archiver</artifactId>
-      <version>2.0</version>
-    </dependency>
-  </dependencies>
+	</dependencies>
 	<build>
 		<plugins>
 			<plugin>
@@ -78,19 +69,23 @@
 					<target>1.5</target>
 				</configuration>
 			</plugin>
-     <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.2</version>
-        <configuration>
-          <archive>
-            <manifestEntries>
-				<Can-Redefine-Classes>true</Can-Redefine-Classes>
-				<Premain-Class>org.apache.magma.tools.maven.MagmaTestAgent</Premain-Class>
-            </manifestEntries>
-          </archive>
-        </configuration>
-      </plugin>			
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>2.2</version>
+				<configuration>
+					<archive>
+						<manifestEntries>
+							<Can-Redefine-Classes>
+								true
+							</Can-Redefine-Classes>
+							<Premain-Class>
+								org.apache.magma.tools.maven.MagmaTestAgent
+							</Premain-Class>
+						</manifestEntries>
+					</archive>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 	<distributionManagement>

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java Fri Jan 16 22:36:30 2009
@@ -6,6 +6,7 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -56,10 +57,12 @@
 	public Set<String> defaultArtifactExcludes = new HashSet<String>(); 
 	
 	{
+		/*
 		defaultArtifactExcludes.add("junit");
 		defaultArtifactExcludes.add("org.jmock");
 		defaultArtifactExcludes.add("aspectj");		
-		defaultArtifactExcludes.add("com.sun:tools");		
+		defaultArtifactExcludes.add("com.sun:tools");
+		*/		
 	}
 	
 	public IMessage[] start() {
@@ -75,6 +78,9 @@
 	public IMessage[] start(MessageHandler h) {
 		Main m = new Main();
 		String[] commandLine = buildCommandLine();
+		if (mavenLogger != null) {
+			mavenLogger.debug("Running ajc " + Arrays.toString(commandLine));
+		}
 		m.run(commandLine, h);
 		if (h == null) return null;
 		return h.getErrors();

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/JettyWeavingURLClassLoader.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/JettyWeavingURLClassLoader.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/JettyWeavingURLClassLoader.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/JettyWeavingURLClassLoader.java Fri Jan 16 22:36:30 2009
@@ -20,11 +20,9 @@
 import java.io.IOException;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.IllegalClassFormatException;
-import java.lang.instrument.Instrumentation;
 import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.security.AccessController;
 import java.security.CodeSource;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,8 +33,6 @@
 import java.util.StringTokenizer;
 
 import org.aspectj.bridge.AbortException;
-import org.aspectj.weaver.ExtensibleURLClassLoader;
-import org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor;
 import org.aspectj.weaver.loadtime.DefaultWeavingContext;
 import org.aspectj.weaver.loadtime.WeavingURLClassLoader;
 import org.aspectj.weaver.tools.Trace;
@@ -44,11 +40,10 @@
 import org.aspectj.weaver.tools.WeavingAdaptor;
 import org.aspectj.weaver.tools.WeavingClassLoader;
 import org.mortbay.jetty.webapp.WebAppContext;
-import org.mortbay.log.Log;
 
 import sun.misc.CompoundEnumeration;
 
-public class JettyWeavingURLClassLoader extends ExtensibleURLClassLoader implements WeavingClassLoader {
+public class JettyWeavingURLClassLoader extends WeavingURLClassLoader implements WeavingClassLoader {
 
 	public static final String WEAVING_CLASS_PATH = "aj.class.path"; 
 	public static final String WEAVING_ASPECT_PATH = "aj.aspect.path"; 

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompileMojo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompileMojo.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompileMojo.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompileMojo.java Fri Jan 16 22:36:30 2009
@@ -17,12 +17,24 @@
 package org.apache.magma.tools.maven;
 
 import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
-import org.codehaus.mojo.aspectj.AjcCompileMojo;
-import org.codehaus.mojo.aspectj.Module;
+import org.aspectj.bridge.IMessage;
 
 /**
 * @goal magma-compile
@@ -31,8 +43,86 @@
 * @description Magma AspectJ Compiler Plugin.
 * @author <a href="mailto:simoneg@apache.org">Simone Gianni</a>
 */
-public class MagmaAjcCompileMojo extends AjcCompileMojo {
+public class MagmaAjcCompileMojo extends AbstractMojo {
 
+
+    /**
+     * The maven project.
+     * 
+     * @parameter expression="${project}"
+     * @required @readonly
+     */
+    protected MavenProject project;
+
+    /**
+     * The basedir of the project.
+     * 
+     * @parameter expression="${basedir}"
+     * @required @readonly
+     */
+    protected File basedir;
+    
+    /**
+     * Resolves the artifacts needed.
+     * 
+     * @component
+     */
+	protected ArtifactResolver artifactResolver;
+	
+    /**
+     * ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use
+     * System.setProperty( "localRepository").
+     * 
+     * @parameter expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    protected ArtifactRepository localRepository;
+
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		Collection artifacts = getRelevantArtifacts();
+		for (Object object : artifacts) {
+			try {
+				artifactResolver.resolve((Artifact)object, Collections.EMPTY_LIST, localRepository);
+			} catch (ArtifactResolutionException e) {
+				throw new MojoExecutionException("Error resolving artifacts", e);
+			} catch (ArtifactNotFoundException e) {
+				throw new MojoExecutionException("Error resolving artifacts", e);
+			}			
+		}
+		
+		AjcLauncher launcher = new AjcLauncher();
+		setupDirectories(launcher);
+		launcher.xlintErrors.setProperty("cantFindType", "warning");
+		launcher.xlintErrors.setProperty("adviceDidNotMatch", "ignore");
+		launcher.mavenLogger = getLog();
+		launcher.addArtifactsToPath(launcher.aspectpath, new HashSet(artifacts), null);		
+		launcher.classpath = launcher.aspectpath;
+		IMessage[] errors = launcher.start();
+		if (errors != null && errors.length > 0) {
+            throw new AjcCompilerException(errors);			
+		}
+	}
+
+	protected Collection getRelevantArtifacts() {
+		Collection artifacts = new HashSet(project.getCompileArtifacts());
+		return artifacts;
+	}
+	
+	protected void setupDirectories(AjcLauncher launcher) {
+		File baseout = new File(project.getBuild().getOutputDirectory());
+		baseout.mkdirs();
+		launcher.outdir = baseout;
+		
+		List sourceRoots = project.getCompileSourceRoots();
+		for (Object sr : sourceRoots) {
+			File srf = new File((String)sr);
+			launcher.addFileToPath(launcher.sourceroots, srf);
+		}		
+	}
+
+
+	/*
 	protected void assembleArguments() throws MojoExecutionException {
 		super.aspectLibraries = ModulesPreparer.prepareModules(project);
 		super.weaveDependencies = this.weaveDependencies;
@@ -53,240 +143,6 @@
 		//this.ajcOptions.add("-Xset:pipelineCompilation=false");		
 		super.execute();
 	}
+	*/
 
-	/*
-	 * Copied from AjcAbstractCompiler cause Maven does not yet support inheriting properties
-	 * without sources
-	 */
-	
-    /**
-     * The source directory for the aspects
-     * @parameter default-value="src/main/aspect"
-     */
-    protected String aspectDirectory = "src/main/aspect";
-
-    /**
-     * The source directory for the test aspects
-     * @parameter default-value="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 spesified 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 spesified by the ajdtDefFile property are included.
-     * 
-     * * @parameter
-     */
-    protected String[] excludes;
-
-    /**
-     * Where to find the ajdt build definition file.
-     * <i>If set this will override the use of project sourcedirs</i>.
-     * 
-     * @parameter
-     */
-    protected String ajdtBuildDefFile;
-
-    /**
-     * List of of modules to weave (into target directory). Corresponds to ajc
-     * -inpath option (or -injars for pre-1.2 (which is not supported)).
-     * 
-     * @parameter
-     */
-    protected Module[] weaveDependencies;
-
-    /**
-     * Weave binary aspects from the jars. 
-     * The aspects should have been output by the same version of the compiler. 
-     * The modules must also be dependencies of the project.
-     * Corresponds to ajc -aspectpath option
-     * 
-     * @parameter
-     */
-    protected Module[] aspectLibraries;
-
-    /**
-     * 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 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 classfile target setting (1.1 to 1.5) default is 1.2
-     * 
-     *  @parameter
-     */
-    protected String target;
-
-    /**
-     * Toggle assertions (1.3, 1.4, or 1.5 - 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, Java 5 language features are permitted.
-     * 
-     *  @parameter
-     */
-    protected String source;
-
-    /**
-     * Specify compiler compliance setting (1.3 to 1.5)
-     * default is 1.4
-     * 
-     *  @parameter
-     */
-    protected String complianceLevel;
-
-    /**
-     * Toggle warningmessages 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
-     */
-    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) do not inline around advice
-     * 
-     * @parameter
-     */
-    protected boolean XnoInline;
-
-    /**
-     * (Experimental) Normally it is an error to declare aspects Serializable. This option removes that restriction.
-     * 
-     * @parameter
-     */
-    protected boolean XserializableAspects;
-
-    /**
-     * The filename to store build configuration in.
-     * This file will be placed in the project build output
-     * directory, and will contain all the arguments
-     * passed to the compiler in the last run, and also
-     * all the filenames included in the build. Aspects as
-     * well as java files.
-     * 
-     * @parameter default-value="builddef.lst"
-     */
-    protected String argumentFileName = "builddef.lst";
-
-    /**
-     * The maven project.
-     * 
-     * @parameter expression="${project}"
-     * @required @readonly
-     */
-    protected MavenProject project;
-
-    /**
-     * The basedir of the project.
-     * 
-     * @parameter expression="${basedir}"
-     * @required @readonly
-     */
-    protected File basedir;
-    
 }

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompleteCompileMojo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompleteCompileMojo.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompleteCompileMojo.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcCompleteCompileMojo.java Fri Jan 16 22:36:30 2009
@@ -121,7 +121,6 @@
 		launcher.mavenLogger = getLog();
 		launcher.outdir = baseout; 
 		launcher.addArtifactsToPath(launcher.aspectpath, project.getArtifacts(), null);
-		List<URL> cpurls = new ArrayList<URL>();
 		
 		launcher.classpath = launcher.aspectpath;
 		List sourceRoots = project.getCompileSourceRoots();

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcTestCompileMojo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcTestCompileMojo.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcTestCompileMojo.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaAjcTestCompileMojo.java Fri Jan 16 22:36:30 2009
@@ -18,16 +18,11 @@
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.mojo.aspectj.AjcTestCompileMojo;
-import org.codehaus.mojo.aspectj.Module;
-
 /**
  * @goal magma-test-compile
  * @requiresDependencyResolution test
@@ -35,265 +30,29 @@
  * @description Magma AspectJ Compiler Plugin.
  * @author <a href="mailto:simoneg@apache.org">Simone Gianni</a>
  */
-public class MagmaAjcTestCompileMojo extends AjcTestCompileMojo {
-
-	protected void assembleArguments() throws MojoExecutionException {
-		Module[] modules = ModulesPreparer.prepareModules(project);
-		//super.weaveDependencies = modules;
-		super.aspectLibraries = modules;
-		super.assembleArguments();
-	}
+public class MagmaAjcTestCompileMojo extends MagmaAjcCompileMojo {
 
-	public void execute() throws MojoExecutionException {
-		super.project = this.project;
-		super.basedir = this.basedir;
-		super.setOutxml(true);		
-		if (!this.ajcOptions.contains("-target")) {
-			super.setTarget("1.5");
-		}
-		if (!this.ajcOptions.contains("-source")) {
-			super.setSource("1.5");
-		}
-		this.ajcOptions.add("-Xlint:warning");
-		super.weaveMainSourceFolder = true;
-		super.execute();
+	@Override
+	protected void setupDirectories(AjcLauncher launcher) {
+		launcher.defaultArtifactExcludes.clear();
+		File baseout = new File(project.getBuild().getTestOutputDirectory());
+		baseout.mkdirs();
+		launcher.outdir = baseout;
+
+		List sourceRoots = new ArrayList(project.getTestCompileSourceRoots());
+		sourceRoots.addAll(project.getCompileSourceRoots());
+		for (Object sr : sourceRoots) {
+			File srf = new File((String)sr);
+			launcher.addFileToPath(launcher.sourceroots, srf);
+		}		
+		
+		launcher.addFilesToPath(launcher.aspectpath, new File(project.getBuild().getOutputDirectory()));
 	}
-
-	
-	/*
-	 * Copied from AjcAbstractCompiler cause Maven does not yet support inheriting properties
-	 * without sources
-	 */
-	
-    /**
-     * The source directory for the aspects
-     * @parameter default-value="src/main/aspect"
-     */
-    protected String aspectDirectory = "src/main/aspect";
-
-    /**
-     * The source directory for the test aspects
-     * @parameter default-value="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 spesified 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 spesified by the ajdtDefFile property are included.
-     * 
-     * * @parameter
-     */
-    protected String[] excludes;
-
-    /**
-     * Where to find the ajdt build definition file.
-     * <i>If set this will override the use of project sourcedirs</i>.
-     * 
-     * @parameter
-     */
-    protected String ajdtBuildDefFile;
-
-    /**
-     * List of of modules to weave (into target directory). Corresponds to ajc
-     * -inpath option (or -injars for pre-1.2 (which is not supported)).
-     * 
-     * @parameter
-     */
-    protected Module[] weaveDependencies;
-
-    /**
-     * Weave binary aspects from the jars. 
-     * The aspects should have been output by the same version of the compiler. 
-     * The modules must also be dependencies of the project.
-     * Corresponds to ajc -aspectpath option
-     * 
-     * @parameter
-     */
-    protected Module[] aspectLibraries;
-
-    /**
-     * 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 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 classfile target setting (1.1 to 1.5) default is 1.2
-     * 
-     *  @parameter
-     */
-    protected String target;
-
-    /**
-     * Toggle assertions (1.3, 1.4, or 1.5 - 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, Java 5 language features are permitted.
-     * 
-     *  @parameter
-     */
-    protected String source;
-
-    /**
-     * Specify compiler compliance setting (1.3 to 1.5)
-     * default is 1.4
-     * 
-     *  @parameter
-     */
-    protected String complianceLevel;
-
-    /**
-     * Toggle warningmessages 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
-     */
-    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) do not inline around advice
-     * 
-     * @parameter
-     */
-    protected boolean XnoInline;
-
-    /**
-     * (Experimental) Normally it is an error to declare aspects Serializable. This option removes that restriction.
-     * 
-     * @parameter
-     */
-    protected boolean XserializableAspects;
-
-    /**
-     * The filename to store build configuration in.
-     * This file will be placed in the project build output
-     * directory, and will contain all the arguments
-     * passed to the compiler in the last run, and also
-     * all the filenames included in the build. Aspects as
-     * well as java files.
-     * 
-     * @parameter default-value="builddef.lst"
-     */
-    protected String argumentFileName = "builddef.lst";
-
-    /**
-     * The maven project.
-     * 
-     * @parameter expression="${project}"
-     * @required @readonly
-     */
-    protected MavenProject project;
-
-    /**
-     * The basedir of the project.
-     * 
-     * @parameter expression="${basedir}"
-     * @required @readonly
-     */
-    protected File basedir;
-    
 	
+	@Override
+	protected Collection getRelevantArtifacts() {
+		Set artifacts = new HashSet(project.getArtifacts());
+		artifacts.addAll(project.getDependencyArtifacts());
+		return artifacts;
+	}
 }

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java?rev=735235&r1=735234&r2=735235&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java (original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java Fri Jan 16 22:36:30 2009
@@ -68,7 +68,7 @@
  * @goal magma-test
  * @phase process-test-classes
  */
-public class MagmaTestMojo     extends AbstractMojo
+public class MagmaTestMojo extends AbstractMojo
 {
 
     /**
@@ -853,7 +853,7 @@
             String key = ArtifactUtils.versionlessKey( "org.apache.openjpa", "openjpa");
             Artifact art = (Artifact) projectArtifactMap.get(key);
             if (art != null) {
-                art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin", VersionRange.createFromVersion("0.0.2-r6"));            	
+                art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin", VersionRange.createFromVersion("0.0.3-r1"));            	
                 try {
 					artifactResolver.resolve(art, Collections.EMPTY_LIST, localRepository);
 				} catch (ArtifactResolutionException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org