remove some dead code and move plugin copying to the related place
git-svn-id: https://svn.apache.org/repos/asf/incubator/npanday/trunk@1609007 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/components/dotnet-core/src/main/java/npanday/PathUtil.java b/components/dotnet-core/src/main/java/npanday/PathUtil.java
index cce1161..2dcc29f 100644
--- a/components/dotnet-core/src/main/java/npanday/PathUtil.java
+++ b/components/dotnet-core/src/main/java/npanday/PathUtil.java
@@ -19,10 +19,7 @@
* under the License.
*/
-import com.google.common.base.Preconditions;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
@@ -109,61 +106,6 @@
artifact.getArtifactId() + ".dll" );
}
- /**
- * Returns the path of the artifact within the private application base.
- *
- *
- * @param artifact the artifact to find the path of. This value should not be null.
- * @param localRepository the local repository. This value should not be null.
- * @param outputDir
- * @return the path of the artifact within the private application base or null if either of the specified
- * parameters is null
- */
- public static File getPrivateApplicationBaseFileFor( Artifact artifact, File localRepository, File outputDir )
- {
- if ( artifact == null )
- {
- logger.warning( "NPANDAY-040-003: Artifact is null - Cannot get application file." );
- return null;
- }
-
- return getDotNetArtifact( artifact, outputDir );
- }
-
- /**
- * Returns the path of the artifact within the user assembly cache.
- *
- *
- * @param artifact the artifact to find the path of. This value should not be null.
- * @param outputDir
- * @return the path of the artifact within the user assembly cache or null if either of the specified
- * parameters is null
- */
- public static File getDotNetArtifact( Artifact artifact, File outputDir )
- {
- if ( artifact == null )
- {
- logger.warning( "NPANDAY-040-0532: Artifact is null - Cannot get application file." );
- return null;
- }
-
- outputDir.mkdir();
-
- String filename = artifact.getArtifactId() + "." + artifact.getArtifactHandler().getExtension();
- File targetFile = new File( outputDir, filename );
-
- try
- {
- FileUtils.copyFile( artifact.getFile(), targetFile );
- }
- catch (IOException ioe)
- {
- logger.warning("\nNPANDAY-1005-0001: Error copying dependency " + artifact +" "+ioe.getMessage());
- }
-
- return targetFile;
- }
-
public static String getExecutable( String executable, Collection<String> executablePaths,
org.codehaus.plexus.logging.Logger logger )
{
diff --git a/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java b/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
index 49f1d31..7d6caa6 100644
--- a/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
+++ b/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
@@ -19,10 +19,6 @@
* 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.executable.CapabilityMatcher;
@@ -33,38 +29,18 @@
import npanday.executable.ExecutionException;
import npanday.executable.NetExecutable;
import npanday.executable.NetExecutableFactory;
-import npanday.executable.RepositoryExecutableContext;
import npanday.executable.compiler.CompilerCapability;
import npanday.executable.compiler.CompilerConfig;
import npanday.executable.compiler.CompilerContext;
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;
-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;
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>.
@@ -155,15 +131,6 @@
if ( executionPaths == null || executionPaths.size() == 0 )
{
- getLogger().warn( "NPANDAY-231: previously netDependencyId was used to resolve some private bin path..." );
- // TODO: remove!
- Artifact artifact = null;
- if ( artifact != null )
- {
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, compilerConfig.getLocalRepository(), targetDir );
- executionPaths.add( artifactPath.getParentFile().getAbsolutePath() );
- }
-
compilerConfig.setExecutionPaths( executionPaths );
}
diff --git a/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java b/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
index 8c080fb..016fc8d 100644
--- a/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
+++ b/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
@@ -26,8 +26,6 @@
import npanday.PathUtil;
import npanday.PlatformUnsupportedException;
import npanday.executable.*;
-import npanday.executable.compiler.*;
-import npanday.registry.RepositoryRegistry;
import npanday.resolver.NPandayArtifactResolver;
import npanday.vendor.IllegalStateException;
import npanday.vendor.*;
@@ -42,8 +40,10 @@
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
import java.io.File;
+import java.io.IOException;
import java.util.*;
/**
@@ -82,6 +82,40 @@
*/
private ArtifactMetadataSource artifactMetadataSource;
+ /**
+ * Returns the path of the artifact within the private application base.
+ *
+ *
+ *
+ * @param artifact the artifact to find the path of. This value should not be null.
+ * @param outputDir
+ * @return the path of the artifact within the private application base or null if either of the specified
+ * parameters is null
+ */
+ private File getPrivateApplicationBaseFileFor(Artifact artifact, File outputDir) throws ArtifactResolutionException {
+ if ( artifact == null )
+ {
+ getLogger().warn( "NPANDAY-040-003: Artifact is null - Cannot get application file." );
+ return null;
+ }
+
+ outputDir.mkdir();
+
+ String filename = artifact.getArtifactId() + "." + artifact.getArtifactHandler().getExtension();
+ File targetFile = new File(outputDir, filename );
+
+ try
+ {
+ FileUtils.copyFile(artifact.getFile(), targetFile);
+ }
+ catch (IOException ioe)
+ {
+ throw new ArtifactResolutionException("NPANDAY-1005-0001: Error copying dependency", artifact, ioe);
+ }
+
+ return targetFile;
+ }
+
public NetExecutable getPluginRunner(
MavenProject project, Artifact pluginArtifact, Set<Artifact> additionalDependencies,
VendorRequirement vendorRequirement, ArtifactRepository localRepository, List<String> commands, File targetDir,
@@ -264,7 +298,7 @@
// preresolve this one
artifactResolver.resolve( pluginArtifact, project.getRemoteArtifactRepositories(), localRepository );
- File pluginArtifactPath = PathUtil.getPrivateApplicationBaseFileFor( pluginArtifact, null, targetDir );
+ File pluginArtifactPath = getPrivateApplicationBaseFileFor(pluginArtifact, targetDir);
List<String> commands = new ArrayList<String>();
commands.add( "parameterFile=" + parameterFile.getAbsolutePath() );
@@ -299,7 +333,7 @@
for(Object ao : results.getArtifacts()){
Artifact a = (Artifact)ao;
- a.setFile( PathUtil.getPrivateApplicationBaseFileFor( a, null, targetDir ) );
+ a.setFile( getPrivateApplicationBaseFileFor(a, targetDir) );
}
return results.getArtifacts();