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 ap...@apache.org on 2010/12/15 05:54:57 UTC

svn commit: r1049437 - in /incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact: ArtifactRepository.cs PathUtil.cs

Author: apadilla
Date: Wed Dec 15 05:54:57 2010
New Revision: 1049437

URL: http://svn.apache.org/viewvc?rev=1049437&view=rev
Log:
[NPANDAY-360] 
- fixed the incorrect display of artifacts in the Local tab when adding a Maven artifact
 * passed the repository configured in settings.xml so that NPanday will look into that as the local repository. 
 * revised parsing of tokens passed to display the correct information of the artifact

Modified:
    incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs?rev=1049437&r1=1049436&r2=1049437&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs Wed Dec 15 05:54:57 2010
@@ -110,16 +110,17 @@ namespace NPanday.Artifact
             List<Artifact> artifacts = new List<Artifact>();
             try
             {
-                DirectoryInfo uac = new DirectoryInfo(localRepository.FullName);
-                int directoryStartPosition = uac.FullName.Length;
+                String repo = localRepository.FullName + "\\repository";
+                DirectoryInfo localRepo = new DirectoryInfo(repo);
+                int directoryStartPosition = localRepo.FullName.Length;
 
-                List<FileInfo> fileInfos = GetArtifactsFromDirectory(uac);
+                List<FileInfo> fileInfos = GetArtifactsFromDirectory(localRepo);
 
                 foreach (FileInfo fileInfo in fileInfos)
                 {
                     try
                     {
-                        Artifact artifact = GetArtifact(uac, fileInfo);
+                        Artifact artifact = GetArtifact(localRepo, fileInfo);
                         artifacts.Add(artifact);
                     }
                     catch
@@ -174,15 +175,21 @@ namespace NPanday.Artifact
                 return null;
             }
 
-            string ext = Path.GetExtension(tokens[2]);
+            string fileName = tokens[tokens.Length - 1];
+            int index = fileName.LastIndexOf( "." );
+            
+            string ext = fileName.Substring( index + 1 );
+            string version = tokens[tokens.Length - 2];
+            string artifactId = tokens[tokens.Length - 3];
 
+            StringBuilder group = new StringBuilder();
 
-            // first file token is the artifact
-            // eg. NPanday.VisualStudio.Addin\1.1.1.1__NMaven.VisualStudio\NPanday.VisualStudio.Addin.dll
-            string artifactId = tokens[0];
-            string groupId = getGroupId(tokens[1]);
-            string version = getVersion(tokens[1]);
+            for( int i = 0; i < tokens.Length - 3; i++ )
+            {
+                group.Append( tokens[i]).Append( "." );
+            }
 
+            string groupId = group.ToString( 0, group.Length - 1 );
 
             Artifact artifact = new Artifact();
             artifact.ArtifactId = artifactId;
@@ -239,16 +246,17 @@ namespace NPanday.Artifact
 
         private List<FileInfo> GetArtifactsFromDirectory(DirectoryInfo baseDirectoryInfo)
         {
-            DirectoryInfo[] directories = baseDirectoryInfo.GetDirectories();
             List<FileInfo> fileInfos = new List<FileInfo>();
+
+            DirectoryInfo[] directories = baseDirectoryInfo.GetDirectories();
             foreach (DirectoryInfo directoryInfo in directories)
             {
                 foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
-                    if (fileInfo.Name.EndsWith(".dll") || fileInfo.Name.EndsWith(".exe") || fileInfo.Name.EndsWith(".netmodule") )
+                    if (fileInfo.Name.EndsWith(".dll") || fileInfo.Name.EndsWith(".exe") || fileInfo.Name.EndsWith(".netmodule"))
                     {
                         fileInfos.Add(fileInfo);
-                    }              
+                    }
                 }
                 fileInfos.AddRange(GetArtifactsFromDirectory(directoryInfo));
             }

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs?rev=1049437&r1=1049436&r2=1049437&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs Wed Dec 15 05:54:57 2010
@@ -88,7 +88,7 @@ namespace NPanday.Artifact
 
 
             list.AddRange(child);
-            list.RemoveRange(0, parent.Length - 1);
+            list.RemoveRange( 0, parent.Length );
 
             return list.ToArray();
 



Re: svn commit: r1049437 - in /incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact: ArtifactRepository.cs PathUtil.cs

Posted by Adelita Padilla <ap...@maestrodev.com>.
Hi Brett,

Revised the url passed in r1065518.


Thanks,

--

liit

----- "Brett Porter" <br...@apache.org> wrote:

> On 15/12/2010, at 4:54 PM, apadilla@apache.org wrote:
> 
> > Author: apadilla
> > Date: Wed Dec 15 05:54:57 2010
> > New Revision: 1049437
> > 
> > URL: http://svn.apache.org/viewvc?rev=1049437&view=rev
> > Log:
> > [NPANDAY-360] 
> > - fixed the incorrect display of artifacts in the Local tab when
> adding a Maven artifact
> > * passed the repository configured in settings.xml so that NPanday
> will look into that as the local repository. 
> > * revised parsing of tokens passed to display the correct
> information of the artifact
> > 
> > Modified:
> >   
> incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
> >   
> incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs
> > 
> > Modified:
> incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
> > URL:
> http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs?rev=1049437&r1=1049436&r2=1049437&view=diff
> >
> ==============================================================================
> > ---
> incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
> (original)
> > +++
> incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
> Wed Dec 15 05:54:57 2010
> > @@ -110,16 +110,17 @@ namespace NPanday.Artifact
> >             List<Artifact> artifacts = new List<Artifact>();
> >             try
> >             {
> > -                DirectoryInfo uac = new
> DirectoryInfo(localRepository.FullName);
> > -                int directoryStartPosition = uac.FullName.Length;
> > +                String repo = localRepository.FullName +
> "\\repository";
> 
> is appending \\repository intentional? That seems like it would change
> behaviour.
> 
> - Brett
> 
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter

Re: svn commit: r1049437 - in /incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact: ArtifactRepository.cs PathUtil.cs

Posted by Brett Porter <br...@apache.org>.
On 15/12/2010, at 4:54 PM, apadilla@apache.org wrote:

> Author: apadilla
> Date: Wed Dec 15 05:54:57 2010
> New Revision: 1049437
> 
> URL: http://svn.apache.org/viewvc?rev=1049437&view=rev
> Log:
> [NPANDAY-360] 
> - fixed the incorrect display of artifacts in the Local tab when adding a Maven artifact
> * passed the repository configured in settings.xml so that NPanday will look into that as the local repository. 
> * revised parsing of tokens passed to display the correct information of the artifact
> 
> Modified:
>    incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
>    incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/PathUtil.cs
> 
> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs
> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs?rev=1049437&r1=1049436&r2=1049437&view=diff
> ==============================================================================
> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs (original)
> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/ArtifactRepository.cs Wed Dec 15 05:54:57 2010
> @@ -110,16 +110,17 @@ namespace NPanday.Artifact
>             List<Artifact> artifacts = new List<Artifact>();
>             try
>             {
> -                DirectoryInfo uac = new DirectoryInfo(localRepository.FullName);
> -                int directoryStartPosition = uac.FullName.Length;
> +                String repo = localRepository.FullName + "\\repository";

is appending \\repository intentional? That seems like it would change behaviour.

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter