Author: brett
Date: Wed Jul 9 04:22:17 2014
New Revision: 1609007
URL: http://svn.apache.org/r1609007
Log:
remove some dead code and move plugin copying to the related place
Modified:
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
Modified:
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java?rev=1609007&r1=1609006&r2=1609007&view=diff
==============================================================================
---
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
(original)
+++
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
Wed Jul 9 04:22:17 2014
@@ -19,10 +19,7 @@ package npanday;
* 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 @@ public final class PathUtil
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 )
{
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=1609007&r1=1609006&r2=1609007&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
Wed Jul 9 04:22:17 2014
@@ -19,10 +19,6 @@ 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.executable.CapabilityMatcher;
@@ -33,38 +29,18 @@ import npanday.executable.ExecutableRequ
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 @@ public class NetExecutableFactoryImpl
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 );
}
Modified:
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java?rev=1609007&r1=1609006&r2=1609007&view=diff
==============================================================================
---
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
(original)
+++
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetPluginExecutableFactoryImpl.java
Wed Jul 9 04:22:17 2014
@@ -26,8 +26,6 @@ import npanday.InitializationException;
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.resolve
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 @@ public class NetPluginExecutableFactoryI
*/
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 @@ public class NetPluginExecutableFactoryI
// 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 @@ public class NetPluginExecutableFactoryI
for(Object ao : results.getArtifacts()){
Artifact a = (Artifact)ao;
- a.setFile( PathUtil.getPrivateApplicationBaseFileFor( a, null,
targetDir ) );
+ a.setFile( getPrivateApplicationBaseFileFor(a, targetDir) );
}
return results.getArtifacts();