labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r792224 - in /labs/magma/trunk/maven-magma-plugin: ./ src/main/java/net/ src/main/java/net/sourceforge/ src/main/java/net/sourceforge/cobertura/ src/main/java/net/sourceforge/cobertura/instrument/ src/main/java/org/apache/magma/tools/classl...
Date Wed, 08 Jul 2009 16:45:33 GMT
Author: simoneg
Date: Wed Jul  8 16:45:32 2009
New Revision: 792224

URL: http://svn.apache.org/viewvc?rev=792224&view=rev
Log:
LABS-377 : fix for build under windows and with spaces

Added:
    labs/magma/trunk/maven-magma-plugin/src/main/java/net/
    labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/
    labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/
    labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/
    labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassTransformer.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaForkConfiguration.java
Modified:
    labs/magma/trunk/maven-magma-plugin/pom.xml
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/AspectJClassTransformer.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/MagmaJettyRun.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRunWar.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=792224&r1=792223&r2=792224&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/pom.xml (original)
+++ labs/magma/trunk/maven-magma-plugin/pom.xml Wed Jul  8 16:45:32 2009
@@ -24,7 +24,7 @@
 	<groupId>org.apache.magma.tools</groupId>
 	<artifactId>maven-magma-plugin</artifactId>
 	<name>Magma Extension Mojo</name>
-	<version>0.0.3-rev13</version>
+	<version>0.0.3-rev14</version>
 	<description>
 		Provides mojos to compile and test a magma package.
 	</description>
@@ -65,6 +65,11 @@
 			<artifactId>jetty</artifactId>
 			<version>6.1.14</version>
 		</dependency>
+		<dependency>
+			<groupId>net.sourceforge.cobertura</groupId>
+			<artifactId>cobertura</artifactId>
+			<version>1.9</version>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

Added: labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassTransformer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassTransformer.java?rev=792224&view=auto
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassTransformer.java
(added)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassTransformer.java
Wed Jul  8 16:45:32 2009
@@ -0,0 +1,86 @@
+package net.sourceforge.cobertura.instrument;
+
+import java.io.File;
+import java.security.ProtectionDomain;
+import java.util.Collection;
+import java.util.Vector;
+
+import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler;
+import net.sourceforge.cobertura.coveragedata.ProjectData;
+
+import org.apache.magma.tools.classloading.ClassTransformationReceiver;
+import org.apache.magma.tools.classloading.ClassTransformer;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassWriter;
+
+public class CoberturaClassTransformer implements ClassTransformer {
+
+	protected ClassTransformationReceiver receiver = null;
+	protected boolean reentring = false;
+
+	private Collection ignoreRegexes = new Vector();
+	private Collection ignoreBranchesRegexes = new Vector();
+	private ClassPattern classPattern = new ClassPattern();
+	private ProjectData projectData = null;
+	private File datafile;
+
+
+	public CoberturaClassTransformer(String file) {
+		datafile = new File(file);
+		if (datafile.exists()) {
+			projectData = CoverageDataFileHandler.loadCoverageData(datafile);
+		}
+		if (projectData == null) {
+			projectData = new ProjectData();
+		}
+		Runtime.getRuntime().addShutdownHook(new Thread() {
+			public void run() {
+				CoverageDataFileHandler.saveCoverageData(projectData, datafile);				
+			}
+		});
+	}
+	
+	public void addClassInclude(String pattern) {
+		classPattern.addIncludeClassesRegex(pattern);
+	}
+	
+	public void addClassExclude(String pattern) {
+		classPattern.addExcludeClassesRegex(pattern);
+	}
+	
+	
+	
+	public void setReceiver(ClassTransformationReceiver receiver) {
+		this.receiver = receiver;
+	}
+
+	public byte[] transform(String classname, byte[] classbytecode, ProtectionDomain domain)
{
+		if (reentring) return null;
+		if (!classPattern.matches(classname)) return null;		
+		try {
+			reentring = true;
+			
+			System.out.println("Cobertura instrumenting " + classname);
+			ClassWriter cw;
+			ClassInstrumenter cv;
+			try {
+				ClassReader cr = new ClassReader(classbytecode);
+				cw = new ClassWriter(true);
+				cv = new ClassInstrumenter(projectData, cw, ignoreRegexes, ignoreBranchesRegexes);
+				cr.accept(cv, false);
+			} catch (Throwable t) {
+				return null;
+			}
+
+			if (cv.isInstrumented()) {
+				return cw.toByteArray();
+			}
+			return null;
+		} catch (Exception e) {
+			throw new RuntimeException("Error Cobertura transforming " + classname, e);
+		} finally {
+			reentring = false;
+		}
+	}
+
+}

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/AspectJClassTransformer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/AspectJClassTransformer.java?rev=792224&r1=792223&r2=792224&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/AspectJClassTransformer.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/AspectJClassTransformer.java
Wed Jul  8 16:45:32 2009
@@ -27,7 +27,10 @@
 			byte[] nbuff = adaptor.weaveClass(classname, classbytecode); 
 			return nbuff.length == classbytecode.length ? null : nbuff;
 		} catch (AbortException ae) {
-			if (ignoreAborts) return null;
+			if (ignoreAborts) {
+				ae.printStackTrace();
+				return null;
+			}
 			throw new RuntimeException("Error weaving " + classname, ae);
 		} catch (IOException e) {
 			throw new RuntimeException("Error weaving " + classname, e);

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=792224&r1=792223&r2=792224&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
Wed Jul  8 16:45:32 2009
@@ -147,7 +147,6 @@
 					archiver.getArchiver().addDirectory(outdir);
 					MavenArchiveConfiguration conf = new MavenArchiveConfiguration();
 					archiver.createArchive(project, conf);
-					FileUtils.deleteDirectory(outdir);
 				} catch (Exception e) {
 					throw new RuntimeException("Error creating zip file " + destjar.getAbsolutePath(), e);
 				}

Added: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaForkConfiguration.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaForkConfiguration.java?rev=792224&view=auto
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaForkConfiguration.java
(added)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaForkConfiguration.java
Wed Jul  8 16:45:32 2009
@@ -0,0 +1,31 @@
+package org.apache.magma.tools.maven;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.surefire.booter.ForkConfiguration;
+import org.apache.maven.surefire.booter.SurefireBooterForkException;
+import org.apache.maven.surefire.booter.shade.org.codehaus.plexus.util.cli.Commandline;
+
+public class MagmaForkConfiguration extends ForkConfiguration {
+
+	private List agents = new ArrayList();
+	
+	@Override
+	public Commandline createCommandLine(List classPath, boolean useJar) throws SurefireBooterForkException
{
+		Commandline line = super.createCommandLine(classPath, useJar);
+		for (Iterator iterator = agents.iterator(); iterator.hasNext();) {
+			String agent = (String) iterator.next();
+			line.createArg(true).setValue("-javaagent:" + agent);
+		}
+		return line;
+	}
+	
+	public void addAgent(String file) {
+		agents.add(file);
+	}
+
+	
+	
+}

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRun.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRun.java?rev=792224&r1=792223&r2=792224&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRun.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRun.java
Wed Jul  8 16:45:32 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -31,6 +32,8 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import net.sourceforge.cobertura.instrument.CoberturaClassTransformer;
+
 import org.apache.magma.tools.classloading.AspectJClassTransformer;
 import org.apache.magma.tools.classloading.ClassLoaderBytecodeProvider;
 import org.apache.magma.tools.classloading.JPAClassTransformer;
@@ -107,6 +110,36 @@
 	 */
 	private File classesDirectory;
 	
+	/**
+	 * Whether to setup cobertura instrumentation.
+	 * 
+	 * @parameter expression="false"
+	 * @required
+	 */	
+	private boolean coverage = false;
+	
+	/**
+	 * The serialization file for cobertura data.
+	 * 
+	 * @parameter expression="${project.build.directory}/cobertura.ser"
+	 * @required
+	 */		
+	private String coverageDataFile = null;
+	
+	/**
+	 * Class patterns to include in coverage data
+	 * 
+	 * @parameter
+	 */
+	private String[] coverageIncludes = null;
+
+	/**
+	 * Class patterns to exclude in coverage data
+	 * 
+	 * @parameter
+	 */
+	private String[] coverageExcludes = null;
+	
 	public String PORT_SYSPROPERTY = "jetty.port";    
     
     public static int DEFAULT_PORT = 8080;
@@ -192,7 +225,7 @@
 			throw new MojoExecutionException("Error setting up classloader url list", e);
 		}
 		
-		URL[] urlarray = (URL[]) urls.toArray(new URL[urls.size()]);
+		URL[] urlarray = (URL[]) urls.toArray(new URL[urls.size()]);				
 		List<URL> aspects = new ArrayList<URL>();
 		for (URL url : urlarray) {
 			try {
@@ -205,12 +238,15 @@
 					if (entry != null) aspects.add(url);
 				}
 			} catch (Exception e) {
+				e.printStackTrace();
 			}
 		}
 		
 		StringBuilder jettypath = new StringBuilder();
 		for (URL acurl : urlarray) {
-			jettypath.append(acurl.toString());
+			// TODO remove this, workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=282379
+			//jettypath.append(acurl.toString());
+			jettypath.append(URLDecoder.decode(acurl.toString()));
 			jettypath.append(',');
 		}
 		webapp.setExtraClasspath(jettypath.toString());
@@ -220,6 +256,7 @@
 		sysclasseslist.add("javax.net.");
 		webapp.setSystemClasses(sysclasseslist.toArray(new String[0]));
 
+		
 		try {
 			WebAppClassLoader rootrepo = new WebAppClassLoader(webapp);
 			URLClassLoader limitedrepo = new URLClassLoader(urlarray, null);
@@ -227,29 +264,66 @@
 			root.setRawResources(rootrepo);
 			ClassLoaderBytecodeProvider rootprovider = new ClassLoaderBytecodeProvider(limitedrepo);
 			
+			// TODO remove this, workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=282379
+			for (int i = 0; i < aspects.size(); i++) {
+				try {
+					aspects.set(i, new URL(URLDecoder.decode(aspects.get(i).toExternalForm(), "UTF-8")));
+				} catch (Exception e) {
+					throw new RuntimeException("Error sanitizing the aspect URL", e);
+				}
+			}
+			// end workaround
+			
+			
 			AspectJClassTransformer ajctransformer = new AspectJClassTransformer(rootrepo, aspects.toArray(new
URL[] {}));
 			TransformingProvider ajcprovider = new TransformingProvider("ajc", ajctransformer);
 			root.setChainProvider(ajcprovider);
 			ajcprovider.setChainProvider(rootprovider);
 			
 			Class support = null;
+			TransformingProvider jpaprovider = null;
 			try {
 				support = root.loadClass("org.apache.magma.database.openjpa.SupportTransformer");
 			} catch (ClassNotFoundException e) {}
 			if (support != null) {
 				StringBuilder paths = new StringBuilder(); 
 				for (URL acurl : urlarray) {
-					paths.append(acurl.toString());
+					// TODO remove this, workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=282379
+					//paths.append(acurl.toString());
+					paths.append(URLDecoder.decode(acurl.toString()));
 					paths.append(';');
 				}
 				Class jpact = root.loadClass(JPAClassTransformer.class.getName());
 				JPAClassTransformer jpatransformer = (JPAClassTransformer) jpact.
 					getConstructor(ClassLoader.class, String.class, String.class)
 					.newInstance(root, "org.apache.magma.database.openjpa.SupportTransformer", paths.toString());
-				TransformingProvider jpaprovider = new TransformingProvider("jpa", jpatransformer);
+				jpaprovider = new TransformingProvider("jpa", jpatransformer);
 				jpaprovider.setChainProvider(ajcprovider);
 				root.setChainProvider(jpaprovider);
 			} 
+			if (coverage) {
+				System.setProperty("net.sourceforge.cobertura.datafile", coverageDataFile);				
+				
+				CoberturaClassTransformer coberturatransformer = new CoberturaClassTransformer(coverageDataFile);
+				if (coverageExcludes != null) {
+					for (String patt : coverageExcludes) {
+						coberturatransformer.addClassExclude(patt);
+					}
+				}
+				if (coverageIncludes != null) {
+					for (String patt : coverageIncludes) {
+						coberturatransformer.addClassInclude(patt);
+					}
+				}
+				TransformingProvider coberturaprovider = new TransformingProvider("cobertura", coberturatransformer);
+				if (jpaprovider != null) {
+					coberturaprovider.setChainProvider(jpaprovider);
+				} else {
+					coberturaprovider.setChainProvider(ajcprovider);
+				}
+				root.setChainProvider(coberturaprovider);
+			}
+			
 	        webapp.setClassLoader(root);
 		} catch (Exception e) {
 			throw new MojoExecutionException("Error setting up classloaders ", e);
@@ -275,7 +349,9 @@
         
         try {
 			server.start();
-			if (!background) server.join();
+			if (!background) {
+				server.join();
+			}
 		} catch (Exception e) {
 			throw new MojoExecutionException("Error starting server", e);
 		}

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRunWar.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRunWar.java?rev=792224&r1=792223&r2=792224&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRunWar.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaJettyRunWar.java
Wed Jul  8 16:45:32 2009
@@ -3,9 +3,17 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
+import net.sourceforge.cobertura.instrument.CoberturaClassTransformer;
+import net.sourceforge.cobertura.instrument.Main;
+
+import org.apache.magma.tools.classloading.ClassLoaderBytecodeProvider;
+import org.apache.magma.tools.classloading.JettyTransformingClassLoader;
+import org.apache.magma.tools.classloading.TransformingProvider;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -61,6 +69,37 @@
 	 * @parameter
 	 */
 	private String dependency = null;
+		
+	/**
+	 * Whether to setup cobertura instrumentation.
+	 * 
+	 * @parameter expression="false"
+	 * @required
+	 */	
+	private boolean coverage = false;
+	
+	/**
+	 * The serialization file for cobertura data.
+	 * 
+	 * @parameter expression="${project.build.directory}/cobertura.ser"
+	 * @required
+	 */		
+	private String coverageDataFile = null;
+	
+	/**
+	 * Class patterns to include in coverage data
+	 * 
+	 * @parameter
+	 */
+	private String[] coverageIncludes = null;
+
+	/**
+	 * Class patterns to exclude in coverage data
+	 * 
+	 * @parameter
+	 */
+	private String[] coverageExcludes = null;
+	
 	
 	public String PORT_SYSPROPERTY = "jetty.port";    
     
@@ -93,7 +132,37 @@
 					if (art.getType().equals("war")) {
 						getLog().info("Running war for " + art.getArtifactId());
 						getLog().info("War found " + art.getFile().getAbsolutePath());
-						webapp.setWar(art.getFile().getAbsolutePath());
+						if (coverage) {
+							System.setProperty("net.sourceforge.cobertura.datafile", coverageDataFile);
+							List<String> args = new ArrayList<String>();
+							args.add("--datafile");
+							args.add(coverageDataFile);
+							args.add("--destination");
+							File outdir = new File(project.getBuild().getDirectory() + "/cobertura-work/");
+							outdir.mkdirs();
+							args.add(outdir.getAbsolutePath());
+
+							if (coverageExcludes != null) {
+								for (String patt : coverageExcludes) {
+									args.add("--excludeClasses");
+									args.add(patt);
+								}
+							}
+							if (coverageIncludes != null) {
+								for (String patt : coverageIncludes) {
+									args.add("--includeClasses");
+									args.add(patt);
+								}
+							}
+							args.add("--basedir");
+							args.add(art.getFile().getParentFile().getAbsolutePath());
+							args.add(art.getFile().getName());
+							
+							Main.main(args.toArray(new String[args.size()]));
+							webapp.setWar(project.getBuild().getDirectory() + "/cobertura-work/" + art.getFile().getName());
+						} else {
+							webapp.setWar(art.getFile().getAbsolutePath());
+						}
 					} else {
 						throw new MojoExecutionException("The artifact " + art.getArtifactId() + " is not of
type WAR");
 					}
@@ -111,7 +180,48 @@
 		try {
 			cl = new WebAppClassLoader(webapp);
 			cl.addJars(Resource.newResource(new File(super.webappDirectory, "WEB-INF/libs/").toURI().toURL()));
-	        webapp.setClassLoader(cl);
+			/*
+			if (coverage) {
+		        Resource web_inf=webapp.getWebInf();
+
+		        // Add WEB-INF classes and lib classpaths
+		        if (web_inf != null && web_inf.isDirectory()) {
+		            // Look for classes directory
+		            Resource classes= web_inf.addPath("classes/");
+		            if (classes.exists())
+		                cl.addClassPath(classes.toString());
+
+		            // Look for jars
+		            Resource lib= web_inf.addPath("lib/");
+		            if (lib.exists() || lib.isDirectory())
+		                cl.addJars(lib);
+		        }
+		        
+				
+				
+				JettyTransformingClassLoader root = new JettyTransformingClassLoader(Thread.currentThread().getContextClassLoader(),
webapp);
+				root.setRawResources(cl);
+				ClassLoaderBytecodeProvider rootprovider = new ClassLoaderBytecodeProvider(cl);
+				
+				CoberturaClassTransformer coberturatransformer = new CoberturaClassTransformer(coverageDataFile);
+				if (coverageExcludes != null) {
+					for (String patt : coverageExcludes) {
+						coberturatransformer.addClassExclude(patt);
+					}
+				}
+				if (coverageIncludes != null) {
+					for (String patt : coverageIncludes) {
+						coberturatransformer.addClassInclude(patt);
+					}
+				}
+				TransformingProvider coberturaprovider = new TransformingProvider("cobertura", coberturatransformer);
+				coberturaprovider.setChainProvider(rootprovider);
+				root.setChainProvider(coberturaprovider);
+		        webapp.setClassLoader(root);
+			} else {
+			*/
+				webapp.setClassLoader(cl);
+			//}
 		} catch (Exception e1) {
 			throw new MojoExecutionException("Error setting up classloader", e1);
 		}
@@ -136,7 +246,9 @@
         
         try {
 			server.start();
-			if (!background) server.join();
+			if (!background) {
+				server.join();
+			}
 		} catch (Exception e) {
 			throw new MojoExecutionException("Error starting server", e);
 		}        	

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=792224&r1=792223&r2=792224&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
Wed Jul  8 16:45:32 2009
@@ -807,7 +807,7 @@
         // Forking
         // ----------------------------------------------------------------------
 
-        ForkConfiguration fork = new ForkConfiguration();
+        MagmaForkConfiguration fork = new MagmaForkConfiguration();
 
         fork.setForkMode( forkMode );
 
@@ -867,7 +867,7 @@
 					}
 					*/
                 	//art = (Artifact) project.getPluginArtifactMap().get(ArtifactUtils.versionlessKey(
"org.apache.magma.tools", "maven-magma-plugin"));
-                	art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin",
VersionRange.createFromVersion("0.0.3-rev13"));
+                	art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin",
VersionRange.createFromVersion("0.0.3-rev14"));
                 	artifactResolver.resolve(art, project.getPluginArtifactRepositories(), localRepository);
                 	if (art.getFile() == null) throw new ArtifactResolutionException("Cannot
find file", art);
 				} catch (ArtifactResolutionException e) {
@@ -875,10 +875,8 @@
 				} catch (ArtifactNotFoundException e) {
 					e.printStackTrace();
 				}
-            	argLine = "-javaagent:" + art.getFile().getAbsolutePath() + " " + (argLine !=
null ? argLine : "");
-            	
-            	argLine += " -Dmagma.env=test";
-            	
+            	fork.addAgent(art.getFile().getAbsolutePath());
+            	            	
             	File writecp = new File(testClassesDirectory, "magma-test-classpath.txt");
             	try {
 					writecp.createNewFile();
@@ -897,13 +895,17 @@
 					e.printStackTrace();
 				}
             }
-            
+
             // SG: add the load time weaver to the test runner jvm
             key = ArtifactUtils.versionlessKey( "org.aspectj", "aspectjweaver");
             art = (Artifact) pluginArtifactMap.get(key);
-            argLine = "-javaagent:" + art.getFile().getAbsolutePath() + " " + (argLine !=
null ? argLine : "");
+            
+            fork.addAgent(art.getFile().getAbsolutePath());
+        	argLine = "-Dmagma.env=test " + (argLine != null ? argLine : "");
+        	// /SG
             
             fork.setArgLine(argLine);
+            
 
             fork.setEnvironmentVariables( environmentVariables );
 



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


Mime
View raw message