You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by lc...@apache.org on 2012/04/27 11:39:16 UTC
svn commit: r1331360 [2/3] - in /incubator/npanday/trunk: ./ components/
components/dotnet-assembler/
components/dotnet-assembler/src/main/java/npanday/assembler/
components/dotnet-core/ components/dotnet-core/src/main/java/npanday/
components/dotnet-c...
Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java (original)
+++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java Fri Apr 27 11:39:13 2012
@@ -19,10 +19,12 @@ package npanday.executable.impl;
* under the License.
*/
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import npanday.ArtifactType;
import npanday.InitializationException;
import npanday.PathUtil;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.ArtifactContext;
import npanday.executable.CapabilityMatcher;
import npanday.executable.ExecutableCapability;
import npanday.executable.ExecutableConfig;
@@ -38,6 +40,7 @@ import npanday.executable.compiler.Compi
import npanday.executable.compiler.CompilerExecutable;
import npanday.executable.compiler.CompilerRequirement;
import npanday.registry.RepositoryRegistry;
+import npanday.resolver.NPandayArtifactResolver;
import npanday.vendor.IllegalStateException;
import npanday.vendor.StateMachineProcessor;
import npanday.vendor.Vendor;
@@ -45,6 +48,14 @@ import npanday.vendor.VendorInfo;
import npanday.vendor.VendorInfoRepository;
import npanday.vendor.VendorRequirement;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+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.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -52,6 +63,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Provides an implementation of <code>NetExecutableFactory</code>.
@@ -73,11 +86,6 @@ public class NetExecutableFactoryImpl
/**
* @plexus.requirement
*/
- private ArtifactContext artifactContext;
-
- /**
- * @plexus.requirement
- */
private RepositoryExecutableContext repositoryExecutableContext;
/**
@@ -105,11 +113,26 @@ public class NetExecutableFactoryImpl
*/
private StateMachineProcessor processor;
+ /**
+ * @plexus.requirement
+ */
+ private NPandayArtifactResolver artifactResolver;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArtifactMetadataSource artifactMetadataSource;
/**
* @see NetExecutableFactory
*/
- public NetExecutable getNetExecutableFor( ExecutableRequirement executableRequirement, List<String> commands, File netHome )
+ public NetExecutable getExecutable(
+ ExecutableRequirement executableRequirement, List<String> commands, File netHome )
throws PlatformUnsupportedException
{
// TODO: construct ExcecutableConfig from the outside
@@ -146,11 +169,11 @@ public class NetExecutableFactoryImpl
}
/**
- * @see NetExecutableFactory#getCompilerExecutableFor(npanday.executable.compiler.CompilerRequirement,
+ * @see NetExecutableFactory#getCompilerExecutable(npanday.executable.compiler.CompilerRequirement,
* npanday.executable.compiler.CompilerConfig, org.apache.maven.project.MavenProject)
*/
- public CompilerExecutable getCompilerExecutableFor( CompilerRequirement compilerRequirement,
- CompilerConfig compilerConfig, MavenProject project)
+ public CompilerExecutable getCompilerExecutable(
+ CompilerRequirement compilerRequirement, CompilerConfig compilerConfig, MavenProject project )
throws PlatformUnsupportedException
{
File targetDir = PathUtil.getPrivateApplicationBaseDirectory( project );
@@ -167,16 +190,13 @@ public class NetExecutableFactoryImpl
if ( executionPaths == null || executionPaths.size() == 0 )
{
- String netDependencyId = compilerCapability.getNetDependencyId();
-
- if ( netDependencyId != null )
+ getLogger().warn( "NPANDAY-231: previously netDependencyId was used to resolve some private bin path..." );
+ // TODO: remove!
+ Artifact artifact = null;
+ if ( artifact != null )
{
- Artifact artifact = artifactContext.getArtifactByID( netDependencyId );
- if ( artifact != null )
- {
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, compilerConfig.getLocalRepository(), targetDir );
- executionPaths.add( artifactPath.getParentFile().getAbsolutePath() );
- }
+ File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, compilerConfig.getLocalRepository(), targetDir );
+ executionPaths.add( artifactPath.getParentFile().getAbsolutePath() );
}
compilerConfig.setExecutionPaths( executionPaths );
@@ -192,46 +212,66 @@ public class NetExecutableFactoryImpl
}
}
- public NetExecutable getNetExecutableFromRepository( String groupId, String artifactId,
- VendorRequirement vendorRequirement, File localRepository,
- List<String> commands, boolean isIsolatedAppDomain, File targetDir )
- throws PlatformUnsupportedException
+ public NetExecutable getPluginRunner(
+ MavenProject project, Artifact pluginArtifact, Set<Artifact> additionalDependencies,
+ VendorRequirement vendorRequirement, ArtifactRepository localRepository, List<String> commands,
+ File targetDir ) throws
+
+ PlatformUnsupportedException,
+ ArtifactResolutionException,
+ ArtifactNotFoundException{
+
+ Set dependencies = Sets.newHashSet(pluginArtifact);
+ if (additionalDependencies != null)
+ {
+ dependencies.addAll( additionalDependencies );
+ }
+
+ // need to resolve what we can here since we need the path!
+ Set<Artifact> artifacts = makeAvailable(
+ project.getArtifact(), project.getManagedVersionMap(), dependencies, targetDir, localRepository,
+ // TODO: consider, if this must be getRemotePluginRepositories()!!
+ project.getRemoteArtifactRepositories()
+ );
+
+ commands.add( "startProcessAssembly=" + pluginArtifact.getFile().getAbsolutePath() );
+ String pluginArtifactPath = findArtifact( artifacts, "NPanday.Plugin").getFile().getAbsolutePath();
+ commands.add( "pluginArtifactPath=" + pluginArtifactPath );
+
+ return getArtifactExecutable(
+ project, createPluginRunnerArtifact(), dependencies, vendorRequirement, localRepository, commands, targetDir
+ );
+ }
+
+ public NetExecutable getArtifactExecutable(
+ MavenProject project, Artifact executableArtifact, Set<Artifact> additionalDependencies,
+ VendorRequirement vendorRequirement, ArtifactRepository localRepository, List<String> commands,
+ File targetDir ) throws
+
+ PlatformUnsupportedException,
+ ArtifactResolutionException,
+ ArtifactNotFoundException
{
- if ( isIsolatedAppDomain )
- {
- List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
- if ( artifacts.size() == 0 )
- {
- throw new PlatformUnsupportedException(
- "NPANDAY-066-024: Could not locate the executable - missing entry in the net-dependencies.xml file: GroupId = "
- + groupId + ", ArtifactId = " + artifactId );
- }
+ Set dependencies = Sets.newHashSet(executableArtifact);
+ if (additionalDependencies != null){
+ dependencies.addAll( additionalDependencies );
+ }
- Artifact artifact = artifacts.get( 0 );
- if ( artifact == null )
- {
- throw new PlatformUnsupportedException(
- "NPANDAY-066-025: Could not locate the executable: GroupId = " + groupId + ", ArtifactId = "
- + artifactId );
- }
+ makeAvailable(
+ project.getArtifact(), project.getManagedVersionMap(), dependencies, targetDir, localRepository,
+ // TODO: consider, if this must be getRemotePluginRepositories()!!
+ project.getRemoteArtifactRepositories()
+ );
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository, targetDir );
- commands.add( "startProcessAssembly=" + artifactPath.getAbsolutePath() );
- //TODO: Replace
- String pluginArtifactPath = PathUtil.getPrivateApplicationBaseFileFor(
- artifactContext.getArtifactsFor( "org.apache.npanday.plugins", "NPanday.Plugin", null, null ).get( 0 ),
- localRepository, targetDir ).getAbsolutePath();
-
- commands.add( "pluginArtifactPath=" + pluginArtifactPath );
- return getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.Runner",
- vendorRequirement, localRepository, commands, false, targetDir );
- }
+ File artifactPath = executableArtifact.getFile();
if ( commands == null )
{
commands = new ArrayList<String>();
}
+ // TODO: this should be a separate implementation of NetExecutable, configured only for MONO!!!
+
VendorInfo vendorInfo;
try
{
@@ -247,22 +287,13 @@ public class NetExecutableFactoryImpl
{
throw new PlatformUnsupportedException( "NPANDAY-066-020: Missing Vendor Information: " + vendorInfo );
}
- List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
- if ( artifacts.size() == 0 )
- {
- throw new PlatformUnsupportedException(
- "NPANDAY-066-022: Could not locate the executable- missing entry in the net-dependencies.xml: GroupId = "
- + groupId + ", ArtifactId = " + artifactId );
- }
- Artifact artifact = artifacts.get( 0 );
-
getLogger().debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository, targetDir );
+
+
List<String> modifiedCommands = new ArrayList<String>();
String exe = null;
- // TODO: this should be a separate implementation of NetExecutable, configured only for MONO!!!
if ( vendorInfo.getVendor().equals( Vendor.MONO ) )
{
List<File> executablePaths = vendorInfo.getExecutablePaths();
@@ -323,60 +354,98 @@ public class NetExecutableFactoryImpl
}
}
- public NetExecutable getPluginLoaderFor( Artifact artifact, VendorRequirement vendorRequirement, String localRepository,
- File parameterFile, String mojoName, File targetDir )
- throws PlatformUnsupportedException
+ public Artifact findArtifact( Set<Artifact> artifacts, String artifactId ) throws ArtifactNotFoundException
{
- //AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout();
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, new File( localRepository ), targetDir );
+ List<String> ids = Lists.newArrayList();
+ for ( Artifact a : artifacts )
+ {
+ ids.add( a.getArtifactId() );
+
+ if ( a.getArtifactId().equalsIgnoreCase( artifactId ) )
+ {
+ return a;
+ }
+ }
+
+ throw new ArtifactNotFoundException(
+ "NPANDAY-066-11: Could not find artifact " + artifactId + " among " + ids, "*", artifactId, "*", "*", null,
+ null, null, null, null
+ );
+ }
+
+ public NetExecutable getPluginExecutable(
+ MavenProject project, Artifact pluginArtifact, VendorRequirement vendorRequirement,
+ ArtifactRepository localRepository, File parameterFile, String mojoName, File targetDir ) throws
+ PlatformUnsupportedException,
+ ArtifactResolutionException,
+ ArtifactNotFoundException
+ {
+ Set<Artifact> dependencies = Sets.newHashSet(pluginArtifact);
+
+ dependencies.add(
+ artifactFactory.createDependencyArtifact(
+ "org.apache.npanday", "NPanday.Model.Pom",
+ VersionRange.createFromVersion( "1.5.0-incubating-SNAPSHOT" ),
+ ArtifactType.DOTNET_LIBRARY.getPackagingType(), null, "runtime"
+ )
+ );
+
+ dependencies.add(
+ artifactFactory.createDependencyArtifact(
+ "org.apache.npanday.plugins", "NPanday.Plugin",
+ VersionRange.createFromVersion( "1.5.0-incubating-SNAPSHOT" ),
+ ArtifactType.DOTNET_LIBRARY.getPackagingType(), null, "runtime"
+ )
+ );
+
+ dependencies.add(
+ artifactFactory.createDependencyArtifact(
+ "org.apache.npanday.plugins", "NPanday.Plugin.Loader",
+ VersionRange.createFromVersion( "1.5.0-incubating-SNAPSHOT" ),
+ ArtifactType.DOTNET_LIBRARY.getPackagingType(), null, "runtime"
+ )
+ );
+
+ // preresolve this one
+ artifactResolver.resolve( pluginArtifact, project.getRemoteArtifactRepositories(), localRepository );
+ File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( pluginArtifact, null, targetDir );
List<String> commands = new ArrayList<String>();
commands.add( "parameterFile=" + parameterFile.getAbsolutePath() );
commands.add( "assemblyFile=" + artifactPath.getAbsolutePath() );
commands.add( "mojoName=" + mojoName );//ArtifactId = namespace
-
- // make sure plugin artifact is present to run with in the application base
- // TODO: can we do this transitively from the loader or the plugin artifact? Hardcoding the transitive deps
- // here
- Artifact modelArtifact = artifactContext.getArtifactsFor(
- "org.apache.npanday", "NPanday.Model.Pom", null, null
- ).get( 0 );
-
- PathUtil.getPrivateApplicationBaseFileFor( modelArtifact, new File( localRepository ), targetDir );
-
- Artifact pluginArtifact = artifactContext.getArtifactsFor(
- "org.apache.npanday.plugins", "NPanday.Plugin", null, null
- ).get( 0 );
-
- PathUtil.getPrivateApplicationBaseFileFor( pluginArtifact, new File( localRepository ), targetDir );
-
- Artifact pluginLoaderArtifact =
- artifactContext.getArtifactsFor( "org.apache.npanday.plugins", "NPanday.Plugin.Loader", null, null ).get(
- 0 );
- artifactPath = PathUtil.getPrivateApplicationBaseFileFor( pluginLoaderArtifact, new File( localRepository ), targetDir );
commands.add( "startProcessAssembly=" + artifactPath.getAbsolutePath() );
- return getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.Runner", vendorRequirement,
- new File( localRepository ), commands, false, targetDir );
+ return getPluginRunner(
+ project, pluginArtifact, dependencies, vendorRequirement, localRepository, commands, targetDir
+ );
}
- public Artifact getArtifactFor( String groupId, String artifactId )
- throws PlatformUnsupportedException
+ private Artifact createPluginRunnerArtifact()
{
- List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
- if ( artifacts.size() == 0 )
- {
- throw new PlatformUnsupportedException(
- "NPANDAY-066-023: Could not locate the plugin - missing entry in the net-dependencies.xml file: GroupId = "
- + groupId + ", ArtifactId = " + artifactId );
- }
+ return artifactFactory.createDependencyArtifact(
+ "org.apache.npanday.plugins", "NPanday.Plugin.Runner",
+ VersionRange.createFromVersion( "1.5.0-incubating-SNAPSHOT" ),
+ ArtifactType.DOTNET_EXECUTABLE.getPackagingType(), null, "runtime"
+ );
+ }
- Artifact artifact = artifacts.get( 0 );
- if ( artifact == null )
- {
- throw new PlatformUnsupportedException(
- "NPANDAY-066-021: Could not locate the plugin: GroupId = " + groupId + ", ArtifactId = " + artifactId );
+ private Set<Artifact> makeAvailable(
+ Artifact originating, Map managedVersions, Set<Artifact> artifacts, File targetDir,
+ ArtifactRepository localRepository, List remoteArtifactRepositories ) throws
+ ArtifactResolutionException,
+ ArtifactNotFoundException
+ {
+ ArtifactResolutionResult results = artifactResolver.resolveTransitively(
+ artifacts, originating, managedVersions, localRepository, remoteArtifactRepositories, artifactMetadataSource,
+ new ScopeArtifactFilter( "runtime" )
+ );
+
+ for(Object ao : results.getArtifacts()){
+ Artifact a = (Artifact)ao;
+ a.setFile( PathUtil.getPrivateApplicationBaseFileFor( a, null, targetDir ) );
}
- return artifact;
+
+ return results.getArtifacts();
}
}
Modified: incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo (original)
+++ incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo Fri Apr 27 11:39:13 2012
@@ -117,11 +117,6 @@
</association>
</field>
<field>
- <name>netDependencyId</name>
- <version>1.0.0+</version>
- <type>String</type>
- </field>
- <field>
<name>frameworkVersions</name>
<description>Supported framework version(s) of the compiler: 1.1.4322, 2.0.50727, 3.0</description>
<association>
Modified: incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml (original)
+++ incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml Fri Apr 27 11:39:13 2012
@@ -26,7 +26,6 @@
<vendor>MICROSOFT</vendor>
<vendorVersion>1</vendorVersion>
<executable>RubyCompiler.exe</executable>
- <netDependencyId>RubyCompiler</netDependencyId>
<language>RUBY</language>
<profile>FULL</profile>
<frameworkVersions>
Modified: incubator/npanday/trunk/components/dotnet-msbuild/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-msbuild/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-msbuild/pom.xml (original)
+++ incubator/npanday/trunk/components/dotnet-msbuild/pom.xml Fri Apr 27 11:39:13 2012
@@ -32,11 +32,7 @@
<dependency>
<groupId>org.apache.npanday</groupId>
<artifactId>dotnet-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.npanday</groupId>
- <artifactId>dotnet-artifact</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.npanday</groupId>
<artifactId>dotnet-model-executable-plugins</artifactId>
Modified: incubator/npanday/trunk/components/dotnet-msbuild/src/main/java/npanday/msbuild/MsbuildInvoker.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-msbuild/src/main/java/npanday/msbuild/MsbuildInvoker.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-msbuild/src/main/java/npanday/msbuild/MsbuildInvoker.java (original)
+++ incubator/npanday/trunk/components/dotnet-msbuild/src/main/java/npanday/msbuild/MsbuildInvoker.java Fri Apr 27 11:39:13 2012
@@ -43,8 +43,9 @@ public class MsbuildInvoker
PlatformUnsupportedException,
MsbuildException
{
- final NetExecutable executable = netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement(parameters.getVendorRequirement(), "MSBUILD"
+ final NetExecutable executable = netExecutableFactory.getExecutable(
+ new ExecutableRequirement(
+ parameters.getVendorRequirement(), "MSBUILD"
), buildCommands( parameters ), null
);
Modified: incubator/npanday/trunk/components/dotnet-nuget/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-nuget/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-nuget/pom.xml (original)
+++ incubator/npanday/trunk/components/dotnet-nuget/pom.xml Fri Apr 27 11:39:13 2012
@@ -33,11 +33,7 @@
<dependency>
<groupId>org.apache.npanday</groupId>
<artifactId>dotnet-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.npanday</groupId>
- <artifactId>dotnet-artifact</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.npanday</groupId>
<artifactId>dotnet-model-executable-plugins</artifactId>
Modified: incubator/npanday/trunk/components/dotnet-nuget/src/main/java/npanday/nuget/NugetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-nuget/src/main/java/npanday/nuget/NugetInvoker.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-nuget/src/main/java/npanday/nuget/NugetInvoker.java (original)
+++ incubator/npanday/trunk/components/dotnet-nuget/src/main/java/npanday/nuget/NugetInvoker.java Fri Apr 27 11:39:13 2012
@@ -19,19 +19,15 @@
package npanday.nuget;
-import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import npanday.PlatformUnsupportedException;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
-import npanday.executable.ExecutionResult;
import npanday.executable.NetExecutable;
import npanday.executable.NetExecutableFactory;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
@@ -50,7 +46,7 @@ public class NugetInvoker
PlatformUnsupportedException,
NugetException
{
- final NetExecutable executable = netExecutableFactory.getNetExecutableFor(
+ final NetExecutable executable = netExecutableFactory.getExecutable(
executableRequirement, buildCommands( parameters ), null
);
Modified: incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java (original)
+++ incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java Fri Apr 27 11:39:13 2012
@@ -19,23 +19,26 @@ package npanday.plugin;
* under the License.
*/
+import npanday.ArtifactType;
+import npanday.LocalRepositoryUtil;
import npanday.PathUtil;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.ArtifactContext;
-import npanday.artifact.AssemblyResolver;
-import npanday.artifact.NPandayArtifactResolutionException;
import npanday.executable.ExecutionException;
import npanday.executable.NetExecutableFactory;
import npanday.vendor.VendorRequirement;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Dependency;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+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.artifact.versioning.VersionRange;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
@@ -55,7 +58,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -76,6 +78,21 @@ public abstract class AbstractMojo
}
/**
+ * @component
+ */
+ private ArtifactResolver resolver;
+
+ /**
+ * @component
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * @component
+ */
+ private ArtifactMetadataSource metadataSource;
+
+ /**
* Executes the mojo.
*
* @throws MojoExecutionException
@@ -145,25 +162,28 @@ public abstract class AbstractMojo
}
MavenProject project = getMavenProject();
+
// TODO: should be configurable, but relies on it being passed into everywhere
File targetDir = PathUtil.getPrivateApplicationBaseDirectory( project );
- ArtifactContext artifactContext = null;
-
VendorRequirement vendorRequirement = new VendorRequirement( getVendor(), getVendorVersion(), getFrameworkVersion());
try
{
- String localRepository = getLocalRepository();
+ ArtifactRepository localRepository = LocalRepositoryUtil.create( getLocalRepository() );
- artifactContext = (ArtifactContext) container.lookup(ArtifactContext.ROLE);
- artifactContext.init( project, project.getRemoteArtifactRepositories(), new File( localRepository ) );
+ Artifact artifact = artifactFactory.createDependencyArtifact(
+ getMojoGroupId(),
+ getMojoArtifactId(),
+ VersionRange.createFromVersion(project.getVersion()),
+ ArtifactType.DOTNET_MAVEN_PLUGIN.getPackagingType(),
+ null,
+ "runtime"
+ );
- Artifact artifact = getNetExecutableFactory().getArtifactFor(getMojoGroupId(), getMojoArtifactId());
- resolveArtifact(project, artifact, targetDir);
- getNetExecutableFactory().getPluginLoaderFor( artifact, vendorRequirement,
- getLocalRepository(), paramFile,
- getClassName(), targetDir ).execute();
+ getNetExecutableFactory().getPluginExecutable(
+ project, artifact, vendorRequirement, localRepository, paramFile, getClassName(), targetDir
+ ).execute();
}
catch ( PlatformUnsupportedException e )
{
@@ -174,69 +194,18 @@ public abstract class AbstractMojo
{
throw new MojoExecutionException( "NPANDAY-115-006: Error occurred while running the .NET plugin", e );
}
- catch ( ComponentLookupException e )
+ catch ( ArtifactNotFoundException e )
{
- throw new MojoFailureException( "NPANDAY-115-007: Internal component composition error", e );
+ throw new MojoFailureException( "NPANDAY-115-010: Error on resolving plugin artifact(s)", e );
}
- finally
+ catch ( ArtifactResolutionException e )
{
- release(artifactContext);
+ throw new MojoFailureException( "NPANDAY-115-011: Error on resolving plugin artifact(s)", e );
}
postExecute();
}
- private void resolveArtifact( MavenProject project, Artifact artifact, File targetDir )
- throws ComponentLookupException, MojoExecutionException
- {
- File localRepository = new File(getLocalRepository());
-
- if (PathUtil.getPrivateApplicationBaseFileFor(artifact, localRepository, targetDir ).exists())
- {
- return;
- }
-
- AssemblyResolver assemblyResolver = null;
- try {
- assemblyResolver = (AssemblyResolver) container.lookup(AssemblyResolver.ROLE);
-
- Dependency dependency = new Dependency();
- dependency.setGroupId(artifact.getGroupId());
- dependency.setArtifactId(artifact.getArtifactId());
- dependency.setVersion(artifact.getVersion());
- dependency.setScope(Artifact.SCOPE_RUNTIME);
- dependency.setType(artifact.getType());
-
- try
- {
- assemblyResolver.resolveTransitivelyFor( project, Collections.singletonList( dependency ),
- project.getRemoteArtifactRepositories(), localRepository,
- false );
- }
- catch( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException( "NPANDAY-115-008: Error on resolving " + dependency, e );
- }
- catch (IOException e)
- {
- throw new MojoExecutionException( "NPANDAY-115-008: IO error on resolving " + dependency, e );
- }
- }
- finally {
- release(assemblyResolver);
- }
- }
-
- private void release(Object component) {
- try {
- if (component != null) {
- container.release(component);
- }
- } catch (ComponentLifecycleException e) {
- // ignore
- }
- }
-
private Set<Field> getAnnotatedFieldsFrom( Field[] fields )
{
Set<Field> fieldSet = new HashSet<Field>();
Modified: incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/RepositoryRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/RepositoryRegistryImpl.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/RepositoryRegistryImpl.java (original)
+++ incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/RepositoryRegistryImpl.java Fri Apr 27 11:39:13 2012
@@ -82,7 +82,7 @@ public class RepositoryRegistryImpl
}
catch ( NPandayRepositoryException e )
{
- throw new InitializationException( "NPANDAY-082-010: Error loading registry-config.xml = ", e );
+ throw new InitializationException( "NPANDAY-082-010: Error loading registry-config.xml", e );
}
}
Modified: incubator/npanday/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/components/pom.xml (original)
+++ incubator/npanday/trunk/components/pom.xml Fri Apr 27 11:39:13 2012
@@ -32,10 +32,8 @@
<name>NPanday :: Java Components</name>
<modules>
- <module>dotnet-artifact</module>
<module>dotnet-assembler</module>
<module>dotnet-core</module>
- <module>dotnet-dao-project</module>
<module>dotnet-executable</module>
<module>dotnet-model</module>
<module>dotnet-plugin</module>
Modified: incubator/npanday/trunk/dist/npanday-repository-builder/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dist/npanday-repository-builder/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/dist/npanday-repository-builder/pom.xml (original)
+++ incubator/npanday/trunk/dist/npanday-repository-builder/pom.xml Fri Apr 27 11:39:13 2012
@@ -194,13 +194,6 @@
<artifactId>maven-archetype-vb-simple</artifactId>
<version>1.5.0-incubating-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.npanday</groupId>
- <artifactId>dotnet-repository-builder</artifactId>
- <version>1.5.0-incubating-SNAPSHOT</version>
- <type>tar.gz</type>
- <classifier>bin</classifier>
- </dependency>
</dependencies>
<build>
<plugins>
Modified: incubator/npanday/trunk/dist/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dist/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/dist/pom.xml (original)
+++ incubator/npanday/trunk/dist/pom.xml Fri Apr 27 11:39:13 2012
@@ -18,19 +18,19 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
<groupId>org.apache.npanday</groupId>
- <version>1.5.0-incubating-SNAPSHOT</version>
+ <version>1.5.0-incubating-SNAPSHOT</version>
<artifactId>apache-npanday</artifactId>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>npanday-dist-parent</artifactId>
- <packaging>pom</packaging>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>npanday-dist-parent</artifactId>
+ <packaging>pom</packaging>
<name>NPanday :: Distribution Projects</name>
- <modules>
+ <modules>
<module>npanday-repository-builder</module>
- <module>dotnet-repository-builder</module>
<module>npanday-installer</module>
<module>npanday-skin</module>
</modules>
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/resources/pom-java.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/resources/pom-java.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/resources/pom-java.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/resources/pom-java.xml Fri Apr 27 11:39:13 2012
@@ -37,11 +37,6 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.npanday</groupId>
- <artifactId>dotnet-artifact</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.npanday</groupId>
<artifactId>dotnet-plugin</artifactId>
<version>${project.version}</version>
</dependency>
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Console/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Console/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Console/pom.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Console/pom.xml Fri Apr 27 11:39:13 2012
@@ -27,21 +27,21 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>NPanday.ProjectImporterConsole</artifactId>
- <packaging>dotnet-executable</packaging>
+ <packaging>dotnet-executable</packaging>
<name>NPanday :: Project Importer :: Console</name>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>src</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>src</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
<dependency>
<groupId>org.apache.npanday.visualstudio</groupId>
<artifactId>NPanday.ProjectImporterEngine</artifactId>
Modified: incubator/npanday/trunk/dotnet/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/pom.xml?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/pom.xml (original)
+++ incubator/npanday/trunk/dotnet/pom.xml Fri Apr 27 11:39:13 2012
@@ -73,10 +73,6 @@
<groupId>org.apache.npanday.plugins</groupId>
<artifactId>maven-resolver-plugin</artifactId>
<version>${bootstrap.npanday.version}</version>
- <configuration>
- <!-- TODO: Can we remove it, then? -->
- <skip>true</skip>
- </configuration>
</plugin>
<plugin>
<groupId>org.apache.npanday.plugins</groupId>
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/AbstractCSPackDeployMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/AbstractCSPackDeployMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/AbstractCSPackDeployMojo.java (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/AbstractCSPackDeployMojo.java Fri Apr 27 11:39:13 2012
@@ -68,7 +68,7 @@ public abstract class AbstractCSPackDepl
try
{
// TODO: confusion of 'identifier' and 'profile' / align to new NPANDAY-499
- final NetExecutable executable = netExecutableFactory.getNetExecutableFor(
+ final NetExecutable executable = netExecutableFactory.getExecutable(
new ExecutableRequirement(
vendor, vendorVersion, frameworkVersion, executableIdentifier, executableVersion
/*, executableProfile*/
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java Fri Apr 27 11:39:13 2012
@@ -1,5 +1,3 @@
-package npanday.plugin.azure;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package npanday.plugin.azure;
* under the License.
*/
+package npanday.plugin.azure;
+
import com.google.common.collect.Lists;
import npanday.ArtifactType;
import npanday.PathUtil;
@@ -40,7 +40,7 @@ import java.util.Set;
*
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
* @goal create-package
- * @requiresDependencyResolution runtime
+ * TODO requiresDependencyResolution runtime
*/
public class CreateCloudServicePackageMojo
extends AbstractCSPackDeployMojo
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java Fri Apr 27 11:39:13 2012
@@ -38,7 +38,7 @@ import java.util.Set;
*
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
* @goal resolve-worker-roles
- * @requiresDependencyResolution runtime
+ * TODO requiresDependencyResolution runtime
*/
public class ResolveWorkerRoleFilesMojo
extends AbstractNPandayMojo
Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java (original)
+++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java Fri Apr 27 11:39:13 2012
@@ -71,7 +71,7 @@ public class GeneratePackageManifestInfo
try
{
- executable = netExecutableFactory.getNetExecutableFor(
+ executable = netExecutableFactory.getExecutable(
getExecutableRequirement(), Lists.newArrayList(
libDir.getAbsolutePath(), "-x", "-r", "-q", "-o", manifestInfoFile.getAbsolutePath()
), null
Modified: incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java Fri Apr 27 11:39:13 2012
@@ -212,8 +212,9 @@ public class AspxCompilerMojo
try
{
- CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutableFor(
- compilerRequirement, compilerConfig, project );
+ CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutable(
+ compilerRequirement, compilerConfig, project
+ );
long startTimeCompile = System.currentTimeMillis();
compilerExecutable.execute();
Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java Fri Apr 27 11:39:13 2012
@@ -1114,9 +1114,9 @@ public abstract class AbstractCompilerMo
try
{
- CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutableFor(getCompilerRequirement(),
- getCompilerConfig(),
- project);
+ CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutable(
+ getCompilerRequirement(), getCompilerConfig(), project
+ );
File compiledArtifact = compilerExecutable.getCompiledArtifact();
Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java Fri Apr 27 11:39:13 2012
@@ -20,8 +20,6 @@ package npanday.plugin.compile;
*/
import npanday.InitializationException;
-import npanday.artifact.AssemblyResolver;
-import npanday.artifact.NPandayArtifactResolutionException;
import npanday.assembler.AssemblerContext;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -37,6 +35,8 @@ import java.io.File;
* @goal initialize
* @phase compile
* @description Initializes and validates the setup.
+ *
+ * @require
*/
public class ComponentInitializerMojo
extends AbstractMojo
@@ -56,10 +56,6 @@ public class ComponentInitializerMojo
*/
private File localRepository;
- /**
- * @component
- */
- private AssemblyResolver assemblyResolver;
/**
* @component
@@ -69,21 +65,8 @@ public class ComponentInitializerMojo
public void execute()
throws MojoExecutionException
{
- long startTime = System.currentTimeMillis();
- try
- {
- assemblyResolver.resolveTransitivelyFor( project, project.getDependencies(),
- project.getRemoteArtifactRepositories(), localRepository, true );
- }
- catch ( java.io.IOException e )
- {
- throw new MojoExecutionException( "NPANDAY-901-003: IO error on resolving project dependencies", e );
- }
- catch( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException( "NPANDAY-901-004: error on resolving project dependencies", e );
- }
+ getLog().warn( "NPANDAY-231: removed dependency resolution here!" );
try
{
@@ -95,6 +78,5 @@ public class ComponentInitializerMojo
}
long endTime = System.currentTimeMillis();
- getLog().info( "Mojo Execution Time = " + ( endTime - startTime ) );
}
}
Modified: incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopAggregateMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopAggregateMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopAggregateMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopAggregateMojo.java Fri Apr 27 11:39:13 2012
@@ -20,8 +20,6 @@ package npanday.plugin.fxcop;
import npanday.ArtifactType;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.AssemblyResolver;
-import npanday.artifact.NPandayArtifactResolutionException;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
import npanday.registry.RepositoryRegistry;
@@ -98,11 +96,6 @@ public class FxCopAggregateMojo
private String profile;
/**
- * @component
- */
- private AssemblyResolver assemblyResolver;
-
- /**
* @parameter expression="${settings.localRepository}"
* @readonly
*/
@@ -138,20 +131,7 @@ public class FxCopAggregateMojo
throw new MojoExecutionException("NPANDAY-xxx-000: Unable to add dependencies from " + project.getFile(), e);
}
- try
- {
- assemblyResolver.resolveTransitivelyFor( project, aggregateDependencies,
- project.getRemoteArtifactRepositories(), localRepository,
- true );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
- catch( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
+ getLog().warn( "NPANDAY-251: removed dependency resolution here!" );
for ( Artifact artifact : (Set<Artifact>) project.getDependencyArtifacts() )
{
@@ -170,7 +150,9 @@ public class FxCopAggregateMojo
try
{
- netExecutableFactory.getNetExecutableFor( new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null ).execute();
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null
+ ).execute();
}
catch ( ExecutionException e )
{
Modified: incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-fxcop-plugin/src/main/java/npanday/plugin/fxcop/FxCopMojo.java Fri Apr 27 11:39:13 2012
@@ -21,8 +21,6 @@ package npanday.plugin.fxcop;
import npanday.ArtifactType;
import npanday.ArtifactTypeHelper;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.AssemblyResolver;
-import npanday.artifact.NPandayArtifactResolutionException;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
import npanday.registry.RepositoryRegistry;
@@ -92,11 +90,6 @@ public class FxCopMojo
private String profile;
/**
- * @component
- */
- private AssemblyResolver assemblyResolver;
-
- /**
* @parameter expression="${settings.localRepository}"
* @readonly
*/
@@ -129,20 +122,7 @@ public class FxCopMojo
SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
- try
- {
- assemblyResolver.resolveTransitivelyFor( project, project.getDependencies(),
- project.getRemoteArtifactRepositories(), localRepository,
- true );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
- catch( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
+ getLog().warn( "NPANDAY-231: removed dependency resolution here!" );
Set<Artifact> artifacts = project.getDependencyArtifacts();
for ( Artifact artifact : artifacts )
@@ -166,7 +146,9 @@ public class FxCopMojo
try
{
- netExecutableFactory.getNetExecutableFor( new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null ).execute();
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null
+ ).execute();
}
catch ( ExecutionException e )
{
Modified: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java (original)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java Fri Apr 27 11:39:13 2012
@@ -54,7 +54,7 @@ import java.util.Set;
*
* @phase package
* @goal merge-assemblies
- * @requiresDependencyResolution runtime
+ * TODO requiresDependencyResolution runtime
*/
public class AssemblyMerger extends AbstractMojo
{
@@ -240,7 +240,7 @@ public class AssemblyMerger extends Abst
{
// ilmerge.exe
// determine how to set /lib:[assemblyPath]
- CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutableFor(
+ CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutable(
getCompilerRequirement(), getCompilerConfig(), project
);
@@ -395,7 +395,9 @@ public class AssemblyMerger extends Abst
}
outputDirectory.mkdirs();
- netExecutableFactory.getNetExecutableFor( new ExecutableRequirement( vendor, null, frameworkVersion, executable ), commands, netHome ).execute();
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, executable ), commands, netHome
+ ).execute();
if ( mergedArtifactTempDirectory != null )
{
Modified: incubator/npanday/trunk/plugins/maven-install-plugin/src/main/java/npanday/plugin/install/InstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-install-plugin/src/main/java/npanday/plugin/install/InstallerMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-install-plugin/src/main/java/npanday/plugin/install/InstallerMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-install-plugin/src/main/java/npanday/plugin/install/InstallerMojo.java Fri Apr 27 11:39:13 2012
@@ -18,23 +18,14 @@
*/
package npanday.plugin.install;
-import npanday.PathUtil;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.ArtifactContext;
-import npanday.dao.Project;
-import npanday.dao.ProjectDao;
-import npanday.dao.ProjectDaoException;
-import npanday.dao.ProjectDependency;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
import npanday.executable.NetExecutable;
import npanday.registry.RepositoryRegistry;
import npanday.vendor.SettingsUtil;
import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.installer.ArtifactInstallationException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -82,11 +73,6 @@ public class InstallerMojo
private File pomFile;
/**
- * @component
- */
- private ArtifactContext artifactContext;
-
- /**
* Install into the GAC?
*
* @parameter expression="${isGacInstall}" default-value = "false"
@@ -118,17 +104,12 @@ public class InstallerMojo
private String profile;
/**
- * @component
- */
- private npanday.registry.DataAccessObjectRegistry daoRegistry;
-
- /**
* The artifact factory component, which is used for creating artifacts.
*
* @component
*/
private ArtifactFactory artifactFactory;
-
+
/**
* Used for resolving snapshot
*
@@ -139,29 +120,19 @@ public class InstallerMojo
public void execute()
throws MojoExecutionException
{
- long startTime = System.currentTimeMillis();
-
- SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
+ SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
- ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
- dao.init( artifactFactory, artifactResolver );
- dao.openConnection();
-
- artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
- if ( project.getPackaging().equals( "pom" ) )
- {
- storeMavenProject( project );
- }
- else
+ if ( !project.getPackaging().equals( "pom" ) )
{
if ( isGacInstall )
{
try
{
- NetExecutable netExecutable = netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null );
+ NetExecutable netExecutable = netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null
+ );
netExecutable.execute();
- getLog().info( "NPANDAY-xxx-003: Installed Assembly into GAC: Assembly = " +
+ getLog().info( "NPANDAY-1400-003: Installed Assembly into GAC: Assembly = " +
project.getArtifact().getFile() + ", Vendor = " + netExecutable.getVendor().getVendorName() );
}
catch ( ExecutionException e )
@@ -174,22 +145,10 @@ public class InstallerMojo
throw new MojoExecutionException( "NPANDAY-1400-001: Platform Unsupported: Vendor " + vendor +
", frameworkVersion = " + frameworkVersion + ", Profile = " + profile, e );
}
- storeMavenProject( project );
}
- //UAC install
- try
- {
- artifactContext.getArtifactInstaller().installArtifactWithPom( project.getArtifact(), pomFile, true );
- }
- catch ( ArtifactInstallationException e )
- {
- throw new MojoExecutionException( "NPANDAY-1001-000: Failed to install artifacts", e );
- }
+ getLog().warn( "NPANDAY-251: removed UAC?? install here!" );
}
-
- long endTime = System.currentTimeMillis();
- getLog().info( "Mojo Execution Time = " + ( endTime - startTime ) );
}
public List<String> getCommands()
@@ -200,43 +159,4 @@ public class InstallerMojo
commands.add( project.getArtifact().getFile().getAbsolutePath() );
return commands;
}
-
- //TODO: Handle parent poms
- private void storeMavenProject( MavenProject project )
- throws MojoExecutionException
- {
- ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
- Project proj = new Project();
- proj.setGroupId( project.getGroupId() );
- proj.setArtifactId( project.getArtifactId() );
- proj.setVersion( project.getVersion() );
- proj.setPublicKeyTokenId( project.getArtifact().getClassifier() );
- proj.setArtifactType( project.getArtifact().getType() );
- proj.setResolved( true );
- for ( Dependency dependency : (List<Dependency>) project.getDependencies() )
- {
- ProjectDependency projectDependency = new ProjectDependency();
- projectDependency.setGroupId( dependency.getGroupId() );
- projectDependency.setArtifactId( dependency.getArtifactId() );
- projectDependency.setVersion( dependency.getVersion() );
- projectDependency.setPublicKeyTokenId( dependency.getClassifier() );
- projectDependency.setArtifactType( dependency.getType() );
- proj.addProjectDependency( projectDependency );
- }
-
- try
- {
- File targetDir = PathUtil.getPrivateApplicationBaseDirectory( project );
- dao.storeProjectAndResolveDependencies( proj, localRepository, new ArrayList<ArtifactRepository>(),
- targetDir );
- }
- catch ( java.io.IOException e )
- {
- throw new MojoExecutionException( "NPANDAY-1001-001: Failed to install artifacts", e );
- }
- catch( ProjectDaoException e )
- {
- throw new MojoExecutionException( "NPANDAY-1001-002: Failed to install artifacts", e );
- }
- }
}
Modified: incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java Fri Apr 27 11:39:13 2012
@@ -112,8 +112,9 @@ public class LinkerMojo
try
{
- netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null )
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, profile ), getCommands(), null
+ )
.execute();
}
catch ( ExecutionException e )
Modified: incubator/npanday/trunk/plugins/maven-mojo-generator-plugin/src/main/java/npanday/plugin/generator/MojoGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-mojo-generator-plugin/src/main/java/npanday/plugin/generator/MojoGeneratorMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-mojo-generator-plugin/src/main/java/npanday/plugin/generator/MojoGeneratorMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-mojo-generator-plugin/src/main/java/npanday/plugin/generator/MojoGeneratorMojo.java Fri Apr 27 11:39:13 2012
@@ -18,13 +18,19 @@
*/
package npanday.plugin.generator;
+import npanday.ArtifactType;
+import npanday.LocalRepositoryUtil;
import npanday.PathUtil;
-import npanday.artifact.ArtifactContext;
import npanday.PlatformUnsupportedException;
import npanday.executable.ExecutionException;
import npanday.registry.RepositoryRegistry;
import npanday.vendor.SettingsUtil;
import npanday.vendor.VendorRequirement;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -106,7 +112,7 @@ public class MojoGeneratorMojo
/**
* @component
*/
- private ArtifactContext artifactContext;
+ private ArtifactFactory artifactFactory;
/** @parameter default-value="false" */
private boolean skip;
@@ -121,7 +127,6 @@ public class MojoGeneratorMojo
SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
- artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
try
{
List<String> commands = new ArrayList<String>();
@@ -135,9 +140,20 @@ public class MojoGeneratorMojo
commands.add( "groupId=" + project.getGroupId() );
commands.add( "artifactId=" + project.getArtifactId() );
commands.add( "artifactVersion=" + project.getVersion());
- netExecutableFactory.getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.MojoGenerator",
- vendorRequirement, localRepository, commands,
- true, targetDir ).execute();
+
+ Artifact artifact = artifactFactory.createDependencyArtifact(
+ "org.apache.npanday.plugins",
+ "NPanday.Plugin.MojoGenerator",
+ VersionRange.createFromVersion( project.getVersion() ),
+ ArtifactType.DOTNET_EXECUTABLE.getPackagingType(),
+ null,
+ "runtime"
+ );
+
+ netExecutableFactory.getPluginRunner(
+ project, artifact, null, vendorRequirement, LocalRepositoryUtil.create( localRepository ), commands,
+ targetDir
+ ).execute();
}
catch ( PlatformUnsupportedException e )
{
@@ -147,5 +163,13 @@ public class MojoGeneratorMojo
{
throw new MojoExecutionException( "", e );
}
+ catch ( ArtifactNotFoundException e )
+ {
+ throw new MojoExecutionException( "", e );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException( "", e );
+ }
}
}
Modified: incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ExistingResxGenerator.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ExistingResxGenerator.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ExistingResxGenerator.java (original)
+++ incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ExistingResxGenerator.java Fri Apr 27 11:39:13 2012
@@ -128,8 +128,9 @@ public class ExistingResxGenerator exten
File file = new File(project.getBuild().getSourceDirectory() + File.separator + embeddedResource.getSourceFile());
if(!file.exists()) continue;
commands = getCommands(file.getAbsoluteFile(), resourceDirectory, embeddedResource.getName());
- netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, null, frameworkVersion, "RESGEN" ), commands, netHome )
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, "RESGEN" ), commands, netHome
+ )
.execute();
}
@@ -146,9 +147,9 @@ public class ExistingResxGenerator exten
name = project.getArtifactId() + "." + name.substring(0, name.lastIndexOf('.'));
commands = getCommands(file.getAbsoluteFile(), resourceDirectory, name);
- netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, null, frameworkVersion, "RESGEN" ), commands,
- netHome )
+ netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, null, frameworkVersion, "RESGEN" ), commands, netHome
+ )
.execute();
}
}
Modified: incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceGeneratorMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceGeneratorMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceGeneratorMojo.java Fri Apr 27 11:39:13 2012
@@ -18,7 +18,6 @@
*/
package npanday.plugin.resgen;
-import npanday.artifact.ArtifactContext;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -80,11 +79,6 @@ public class ResourceGeneratorMojo
/**
* @component
*/
- private ArtifactContext artifactContext;
-
- /**
- * @component
- */
private npanday.executable.NetExecutableFactory netExecutableFactory;
public void execute()
Copied: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java (from r1330657, incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java)
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java?p2=incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java&p1=incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java&r1=1330657&r2=1331360&rev=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java Fri Apr 27 11:39:13 2012
@@ -18,19 +18,20 @@
*/
package npanday.plugin.resolver;
-import npanday.artifact.ArtifactInstaller;
-import npanday.PlatformUnsupportedException;
-import npanday.artifact.ArtifactContext;
-import npanday.artifact.NPandayArtifactResolutionException;
-import npanday.artifact.NetDependenciesRepository;
-import npanday.artifact.NetDependencyMatchPolicy;
-import npanday.executable.ExecutableRequirement;
-import npanday.executable.ExecutionException;
-import npanday.executable.NetExecutable;
-import npanday.model.netdependency.NetDependency;
+import com.google.common.collect.Sets;
+import npanday.LocalRepositoryUtil;
import npanday.registry.RepositoryRegistry;
+import npanday.resolver.NPandayArtifactResolver;
+import npanday.resolver.NPandayDependencyResolution;
import npanday.vendor.SettingsUtil;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -38,17 +39,20 @@ import org.apache.maven.plugin.MojoFailu
import org.apache.maven.project.MavenProject;
import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
/**
+ * Resolves .NET assemblies from special locations, as for example the GAC.
+ * Run this only, if you want to resolve special dependencies before other
+ * NATIVE maven plugins that require the dependencies run.
+ *
+ * NPandays plugins should requrest the needed dependency resolution themselves.
+ *
* @author Shane Isbell
+ * @author <a href="me@lcorneliussen.de">Lars Corneliussen, Faktum Software</a>
* @goal resolve
- * @phase process-resources
- * @description Resolves the .NET assemblies that NPanday needs to run.
*/
-public class NetDependencyResolverMojo
+public class NPandayEarlyResolverMojo
extends AbstractMojo
{
/**
@@ -77,43 +81,14 @@ public class NetDependencyResolverMojo
private File localRepository;
/**
- * @parameter expression="${project.file}"
- * @required
- * @readonly
- */
- private File pomFile;
-
- /**
- * @parameter
- */
- private NetDependency[] netDependencies;
-
- /**
- * The Vendor for the executable.
- *
- * @parameter expression="${vendor}"
+ * @parameter default-value="compile"
*/
- private String vendor;
-
- /**
- * @parameter expression = "${frameworkVersion}"
- */
- private String frameworkVersion;
-
- /**
- * @parameter expression = "${installGacDependencies}" default-value="false"
- */
- private boolean isGacInstall;
+ private String requiredScope;
/**
* @component
*/
- private npanday.executable.NetExecutableFactory netExecutableFactory;
-
- /**
- * @component
- */
- private ArtifactContext artifactContext;
+ private NPandayDependencyResolution dependencyResolution;
/**
* @parameter default-value="false"
@@ -122,126 +97,28 @@ public class NetDependencyResolverMojo
public void execute() throws MojoExecutionException, MojoFailureException
{
- long startTime = System.currentTimeMillis();
-
if ( skip )
{
+ getLog().info( "NPANDAY-149-001: Mojo for resolving dependencies was intentionally skipped" );
return;
}
SettingsUtil.applyCustomSettingsIfAvailable( getLog(), repositoryRegistry, settingsPath );
- String profile = System.getProperty( "dependencyProfile" );
+ getLog().warn(
+ "NPANDAY-149-002: Mojo for resolving dependencies is executed! It should only be run, "
+ + "if native maven plugins require special dependencies to be resolved!"
+ );
- if ( netDependencies == null )
+ try
{
- netDependencies = new NetDependency[0];
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), requiredScope );
}
- List<Dependency> dependencies = new ArrayList<Dependency>();
- for ( NetDependency netDependency : netDependencies )
+ catch ( ArtifactResolutionException e )
{
- Dependency dependency = new Dependency();
- dependency.setGroupId( netDependency.getGroupId() );
- dependency.setArtifactId( netDependency.getArtifactId() );
- dependency.setVersion( netDependency.getVersion() );
- dependency.setScope( Artifact.SCOPE_RUNTIME );
- dependency.setType( netDependency.getType() );
- dependencies.add( dependency );
+ throw new MojoExecutionException( "NPANDAY-149-003: early dependency resolution for scope " + requiredScope + " failed!", e );
}
-
- artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
- if ( !new File( localRepository, "npanday.artifacts.resolved" ).exists() ) //performance optimization
- {
- try
- {
- ArtifactInstaller installer = artifactContext.getArtifactInstaller();
- installer.resolveAndInstallNetDependenciesForProfile( profile, dependencies, null, project );
- }
- catch ( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException(
- "NPANDAY-1600-007: Error on resolving configured .NET dependencies (param netDependencies)", e
- );
- }
- catch ( IOException e )
- {
- throw new MojoFailureException(
- "NPANDAY-1600-008: IO-error on resolving configured .NET dependencies (param netDependencies)", e
- );
- }
-
- new File( localRepository, "npanday.artifacts.resolved" ).mkdir();
- }
-
- //Do GAC Install, if needed
- //TODO: Add in the dependencies from the MOJO config
- if ( isGacInstall )
- {
- NetDependenciesRepository repository =
- (NetDependenciesRepository) repositoryRegistry.find( "net-dependencies" );
- getLog().info( "NPANDAY-1600-001: Found net dependencies: Number = " + dependencies.size() );
-
- List<NetDependencyMatchPolicy> gacInstallPolicies = new ArrayList<NetDependencyMatchPolicy>();
- gacInstallPolicies.add( new GacMatchPolicy( true ) );
- List<Dependency> gacInstallDependencies = repository.getDependenciesFor( gacInstallPolicies );
- for ( Dependency dependency : gacInstallDependencies )
- {
- List<Artifact> artifacts =
- artifactContext.getArtifactsFor( dependency.getGroupId(), dependency.getArtifactId(),
- dependency.getVersion(), dependency.getType() );
- try
- {
- NetExecutable netExecutable = netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, null, frameworkVersion, "GACUTIL" ),
- getGacInstallCommandsFor( artifacts.get( 0 ) ), null );
- netExecutable.execute();
- getLog().info( "NPANDAY-1600-004: Installed Assembly into GAC: Assembly = "
- + artifacts.get( 0 ).getFile().getAbsolutePath() + ", Vendor = "
- + netExecutable.getVendor().getVendorName() );
- }
- catch ( ExecutionException e )
- {
- throw new MojoExecutionException(
- "NPANDAY-1600-005: Unable to execute gacutil: Vendor " + vendor + ", frameworkVersion = "
- + frameworkVersion + ", Profile = " + profile, e );
- }
- catch ( PlatformUnsupportedException e )
- {
- throw new MojoExecutionException(
- "NPANDAY-1600-006: Platform Unsupported: Vendor " + vendor + ", frameworkVersion = "
- + frameworkVersion + ", Profile = " + profile, e );
- }
- }
- }
-
- long endTime = System.currentTimeMillis();
- getLog().info( "Mojo Execution Time = " + ( endTime - startTime ) );
}
- public List<String> getGacInstallCommandsFor( Artifact artifact )
- throws MojoExecutionException
- {
- List<String> commands = new ArrayList<String>();
- commands.add( "/nologo" );
- commands.add( "/i" );
- commands.add( artifact.getFile().getAbsolutePath() );
- return commands;
- }
- private class GacMatchPolicy
- implements NetDependencyMatchPolicy
- {
-
- private boolean isGacInstall;
-
- public GacMatchPolicy( boolean isGacInstall )
- {
- this.isGacInstall = isGacInstall;
- }
-
- public boolean match( NetDependency netDependency )
- {
- return netDependency.isIsGacInstall() == isGacInstall;
- }
- }
}
Propchange: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java?rev=1331360&r1=1331359&r2=1331360&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java Fri Apr 27 11:39:13 2012
@@ -20,9 +20,8 @@
package npanday.plugin.test;
import npanday.ArtifactTypeHelper;
+import npanday.PathUtil;
import npanday.PlatformUnsupportedException;
-import npanday.artifact.AssemblyResolver;
-import npanday.artifact.NPandayArtifactResolutionException;
import npanday.executable.CommandExecutor;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
@@ -145,11 +144,6 @@ public class TesterMojo extends Abstract
private File nUnitResultErrorOutputPath;
/**
- * @component
- */
- private AssemblyResolver assemblyResolver;
-
- /**
* The local Maven repository.
*
* @parameter expression="${settings.localRepository}"
@@ -284,19 +278,8 @@ public class TesterMojo extends Abstract
return;
}
- try
- {
- assemblyResolver.resolveTransitivelyFor( project, project.getDependencies(),
- project.getRemoteArtifactRepositories(), localRepository, true );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
- catch( NPandayArtifactResolutionException e )
- {
- throw new MojoExecutionException( e.getMessage() );
- }
+ // TODO: resolve dependencies with scope test here
+ getLog().warn( "NPANDAY-251: removed dependency resolution here!" );
List<Artifact> nunitLibs = new ArrayList<Artifact>();
Set<Artifact> artifacts = project.getDependencyArtifacts();
@@ -316,13 +299,11 @@ public class TesterMojo extends Abstract
{
try
{
- // TODO: adjust the filename to not include the version, if we aren't copying from the UAC later
- // (there will be several other instances of such uses of getFile() that need to be corrected)
- FileUtils.copyFileToDirectory( artifact.getFile(), new File( testAssemblyPath ) );
+ PathUtil.copyPlainArtifactFileToDirectory( artifact, new File( testAssemblyPath ) );
}
catch ( IOException e )
{
- throw new MojoExecutionException( "NPANDAY-1100-002: Artifact = " + artifact.toString(), e );
+ throw new MojoExecutionException( "NPANDAY-1100-002: Error on copying artifact " + artifact.toString(), e );
}
}
}
@@ -387,8 +368,10 @@ public class TesterMojo extends Abstract
{
try
{
- NetExecutable executable = netExecutableFactory.getNetExecutableFor(
- new ExecutableRequirement( vendor, vendorVersion, executionFrameworkVersion, profile), commands, executableHome );
+ NetExecutable executable = netExecutableFactory.getExecutable(
+ new ExecutableRequirement( vendor, vendorVersion, executionFrameworkVersion, profile ), commands,
+ executableHome
+ );
executable.execute();
}