On 17/11/2010, at 11:57 AM, Josimpson Ocaba wrote:

>>> +        
>>> +        
>>> +        try
>>> +        {    
>>> +              FileUtils.copyFile(new File( source ), targetFile);
>>> +        }   
>>> +        catch (IOException ioe) 
>>> +        {
>>> +            logger.warning("\nNPANDAY-1005-0001: Error copying
>> dependency " + artifact +" "+ioe.getMessage());
>>> +        }
>> 
>> Should this only be a warning? Won't it cause problems later? I'd
>> think it should be thrown...
> 
> Ok Noted. But wouldn't it have to be caught somewhere else? I caught it here 
> thinking that way. So that the build will not break.

Right - but my question was *should* the build actually break if this happens? 
Is it recoverable?

>> 
>> You shouldn't construct the path yourself. I'm not sure where this is
>> used, but it should be passed from the result of artifact resolution.
>> Is artifact.getFile() already set?
> 
> Sometimes artifact.getFile() returns a null that is why there is the need for 
> the generation.

Under what situations? I would think that's a faulty lifecycle / plugin that 
should be fixed in that case rather than hard coding here.
> 
> 
>>> 
>>> Modified:
>> incubator/npanday/trunk/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> ---
>> incubator/npanday/trunk/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
>> (original)
>>> +++
>> incubator/npanday/trunk/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
>> Thu Oct 21 03:02:36 2010
>>> @@ -294,12 +294,16 @@ public final class ProjectDaoImpl
>>> 
>>>            if ( !result.hasNext() )
>>>            {
>>> -                if ( artifactType != null &&
>> ArtifactTypeHelper.isDotnetAnyGac( artifactType ) )
>>> +                
>>> +                //if ( artifactType != null &&
>> ArtifactTypeHelper.isDotnetAnyGac( artifactType ) )
>>> +                if ( artifactType != null )
>> 
>> why was this changed?

Not sure if you answered this in another question?

>> 
>>> Modified:
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> ---
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
>> (original)
>>> +++
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
>> Thu Oct 21 03:02:36 2010
>>> @@ -108,7 +108,11 @@ public final class DefaultCompiler
>>>            for ( Artifact artifact : references )
>>>            {
>>>                String path = artifact.getFile().getAbsolutePath();
>>> -                commands.add( "/reference:" + path );
>>> +          
>>> +                if( !path.contains( ".jar" ) )
>>> +                {
>>> +                    commands.add( "/reference:" + path );
>>> +                }
>> 
>> This hardcoding doesn't seem good - it seems linked to the other
>> change above about unknown extensions. Shouldn't it be checking the
>> artifact types against suitable references?
> 
> It was including the jars and it was causing problems during compilation 
> since csc/vbc aren't using them.

Which JARs would be included? I was suggesting you should have a list of 
suitable references and check the actual type against that. At the moment, 
foo.war would be included, and cookie.jar-1.0.dll would be excluded.

> 
>>> 
>>> Modified:
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> ---
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
>> (original)
>>> +++
>> incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
>> Thu Oct 21 03:02:36 2010
>>> @@ -28,6 +28,7 @@ import npanday.executable.compiler.*;
>>> import npanday.artifact.ArtifactContext;
>>> import npanday.artifact.ArtifactException;
>>> import npanday.ArtifactType;
>>> +import npanday.PathUtil;
>>> 
>>> import org.apache.maven.project.MavenProject;
>>> import org.apache.maven.artifact.Artifact;
>>> @@ -388,7 +389,19 @@ public final class CompilerContextImpl
>>>                logger.debug( "NPANDAY-061-006: Artifact Type:" +
>> type);
>>>                logger.debug( "NPANDAY-061-007: Artifact Type:" +
>> ArtifactTypeHelper.isDotnetGenericGac( type ));
>>>                ArtifactType artifactType =
>> ArtifactType.getArtifactTypeForPackagingName( type );
>>> -
>>> +                if ( ArtifactTypeHelper.isDotnetModule( type ))
>>> +                {
>>> +                    modules.add( artifact );
>>> +                }
>>> +                else if ( (artifactType != ArtifactType.NULL && (
>>> +                            StringUtils.equals(
>> artifactType.getTargetCompileType(), "library" )
>>> +                            || artifactType.getExtension().equals(
>> "dll" )
>>> +                            || artifactType.getExtension().equals(
>> "exe" ))
>>> +                          )
>>> +                          || type.equals( "jar" ) )
>>> +                {
>>> +                    libraries.add( artifact );
>>> +                }
>> 
>> Is there an isDotnet* method that better represents this? Why .jar?

Maybe related to above?
>> 
>> 
>>> Modified:
>> incubator/npanday/trunk/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> ---
>> incubator/npanday/trunk/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java
>> (original)
>>> +++
>> incubator/npanday/trunk/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java
>> Thu Oct 21 03:02:36 2010
>>> @@ -30,64 +30,7 @@ public class RepositoryConverterImplTest
>>> 
>>>    private static File basedir = new File( System.getProperty(
>> "basedir" ) );
>>> 
>>> -
>>> -    public void testConvertArtifact()
>>> -    {
>>> -        File testRepo = new File( System.getProperty( "basedir" ),
>> "target/test-repo/repository-1" );
>>> -        testRepo.mkdir();
>>> -
>>> -        Repository repository = this.createRepository();
>>> -        ProjectDao dao = this.createProjectDao( repository );
>>> -
>>> -        Project project = new Project();
>>> -        project.setGroupId( "npanday.model" );
>>> -        project.setArtifactId( "NPanday.Model.Pom" );
>>> -        project.setVersion( "1.0" );
>>> -        project.setArtifactType( "library" );
>>> -        project.setPublicKeyTokenId( "abc" );
>>> -
>>> -        ProjectDependency test2 = createProjectDependency(
>> "npanday", "NPanday.Test", "1.0" );
>>> -        test2.setArtifactType( "library" );
>>> -        project.addProjectDependency( test2 );
>>> -
>>> -        try
>>> -        {
>>> -            dao.storeProjectAndResolveDependencies( project,
>> testRepo, new ArrayList<ArtifactRepository>() );
>>> -        }
>>> -        catch ( java.io.IOException e )
>>> -        {
>>> -            e.printStackTrace();
>>> -            fail( "Could not store the project: " + e.getMessage()
>> );
>>> -        }
>>> -
>>> -        RepositoryConverterImpl repositoryConverter = new
>> RepositoryConverterImpl();
>>> -        repositoryConverter.initTest( new
>> DataAccessObjectRegistryStub(), new ArtifactFactoryTestStub(),
>>> -                                      null, new
>> ArtifactResolverTestStub() );
>>> -
>>> -        ArtifactFactory artifactFactory = new
>> ArtifactFactoryTestStub();
>>> -        Artifact artifact =
>> artifactFactory.createArtifactWithClassifier( project.getGroupId(),
>> project.getArtifactId(),
>>> -                                                                   
>>      project.getVersion(),
>>> -                                                                   
>>      project.getArtifactType(), "abc" );
>>> -        File artifactFile = new File( testRepo.getParentFile(),
>>> -                                     
>> "/uac/gac_msil/NPanday.Model.Pom/1.0__npanday.model/NPanday.Model.Pom.dll"
>> );
>>> -
>>> -        artifact.setFile( artifactFile );
>>> -        try
>>> -        {
>>> -            repositoryConverter.convertRepositoryFormatFor(
>> artifact, null, repository, testRepo );
>>> -        }
>>> -        catch ( IOException e )
>>> -        {
>>> -            fail( "Could not convert the repository: " +
>> e.getMessage() );
>>> -        }
>>> -        this.exportRepositoryToRdf( "testConvertArtifact-rdf.xml",
>> testRepo, repository );
>>> -
>>> -        assertTrue( new File( testRepo,
>> "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0-abc.dll"
>> ).exists() );
>>> -        assertTrue( new File( testRepo,
>> "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.pom"
>> ).exists() );
>>> -        assertFalse( new File( testRepo,
>> "/npanday/NPanday.Test/1.0/NPanday.Test-1.0.dll" ).exists() );
>>> -        assertFalse( new File( testRepo,
>> "/npanday/NPanday.Test/1.0/NPanday.Test-1.0.pom" ).exists() );
>>> -    }
>> 
>> Why was this removed?

Did I miss the answer to this?

>> 
>>> -
>>> +    
>>>    public void testConvert()
>>>    {
>>>        File testRepo = new File( System.getProperty( "basedir" ),
>> "target/test-repo/repository" );
>>> @@ -101,9 +44,8 @@ public class RepositoryConverterImplTest
>>>        project.setArtifactId( "NPanday.Model.Pom" );
>>>        project.setVersion( "1.0" );
>>>        project.setArtifactType( "library" );
>>> -        project.setPublicKeyTokenId( "abc" );
>>> 
>>> -        ProjectDependency test2 = createProjectDependency(
>> "npanday", "NPanday.Test", "1.0" );
>>> +        ProjectDependency test2 = createProjectDependency(
>> "npanday", "ClassLibrary1", "1.0" );
>>>        test2.setArtifactType( "library" );
>>>        project.addProjectDependency( test2 );
>>> 
>>> @@ -130,10 +72,10 @@ public class RepositoryConverterImplTest
>>>        }
>>>        this.exportRepositoryToRdf( "testConvert-rdf.xml", testRepo,
>> repository );
>>> 
>>> -        assertTrue( new File( testRepo,
>> "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0-abc.dll"
>> ).exists() );
>>> +        assertTrue( new File( testRepo,
>> "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.dll"
>> ).exists() );
>>>        assertTrue( new File( testRepo,
>> "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.pom"
>> ).exists() );
>>> -        assertTrue( new File( testRepo,
>> "/npanday/NPanday.Test/1.0/NPanday.Test-1.0.dll" ).exists() );
>>> -        assertTrue( new File( testRepo,
>> "/npanday/NPanday.Test/1.0/NPanday.Test-1.0.pom" ).exists() );
>>> +        assertTrue( new File( testRepo,
>> "/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.dll" ).exists() );
>>> +
>> 
>> Are these results correct? I realise you needed to remove the UAC, but
>> not sure why the test for the model (particularly the classifier) was
>> removed.

Same here...

>> 
>>> 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=1025815&r1=1025814&r2=1025815&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
>> Thu Oct 21 03:02:36 2010
>>> @@ -26,6 +26,7 @@ using System.Text;
>>> using System.Xml;
>>> using System.Xml.Serialization;
>>> using System.Windows.Forms;
>>> +using NPanday.Model.Setting;
>>> 
>>> namespace NPanday.Artifact
>>> {
>>> @@ -34,8 +35,14 @@ namespace NPanday.Artifact
>>> 
>>>        public string GetLocalUacPath(Artifact artifact, string
>> ext)
>>>        {
>>> -            return Path.Combine(localRepository.FullName,
>> string.Format(@"uac\gac_msil\{1}\{2}__{0}\{1}{3}", artifact.GroupId,
>> artifact.ArtifactId, artifact.Version, ext));
>>> +            return
>> Path.Combine(SettingsUtil.GetLocalRepositoryPath(),
>> string.Format(@"{0}\{1}\{1}{2}-{3}", Tokenize(artifact.GroupId),
>> artifact.ArtifactId, artifact.Version, 
>> 
>> This is duplicated with PathUtil.cs. They should be shared. Also, does
>> the Artifact type support classifiers? They don't seem to be included
>> here.

Did you get a chance to fix this already?
> 
>> 
>>> 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=1025815&r1=1025814&r2=1025815&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
>> Thu Oct 21 03:02:36 2010
>>> @@ -23,21 +23,35 @@ using System;
>>> using System.Collections.Generic;
>>> using System.IO;
>>> using System.Text;
>>> +using NPanday.Model.Setting;
>>> 
>>> namespace NPanday.Artifact
>>> {
>>>    public class PathUtil
>>>    {
>>> -        public static FileInfo
>> GetPrivateApplicationBaseFileFor(Artifact artifact, DirectoryInfo
>> localRepository)
>>> +        public static FileInfo
>> GetPrivateApplicationBaseFileFor(Artifact artifact, DirectoryInfo
>> localRepository, string currentDir)
>>>        {
>>> -            return new FileInfo(localRepository.Parent.FullName +
>> @"\pab\gac_msil\" + artifact.ArtifactId + @"\" + artifact.Version +
>> "__" +
>>> -                artifact.GroupId + @"\" + artifact.ArtifactId + "."
>> + artifact.Extension);
>>> +            FileInfo target = new FileInfo(currentDir +
>> Path.PathSeparator + "target" + Path.PathSeparator+artifact.ArtifactId
>> + artifact.Extension);
>> 
>> This is probably ok, but if there's a way to read it from the POM or
>> pass in the target directory rather than just the basedir, that'd be
>> more flexible. 
> 
> Ok, but wouldn't reading from the pom take up more resources? But I agree 
> with making npanday as flexible as possible.

I'd guess the POM is already read somewhere? But otherwise, it'd be good to 
centralise the code.

> 
>> 
>>> +           
>>> +            FileInfo source = GetUserAssemblyCacheFileFor(artifact,
>> localRepository);
>>> +
>>> +            if(source.Exists)
>>> +            {
>>> +                   File.Copy( source.ToString(),
>> target.ToString());
>>> +            } 
>>> +            
>>> +           
>> 
>> Why might these be different?

Not sure if you caught this one in the middle too :)

> 
> 
>>> Modified: incubator/npanday/trunk/dotnet/pom.xml
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/pom.xml?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> --- incubator/npanday/trunk/dotnet/pom.xml (original)
>>> +++ incubator/npanday/trunk/dotnet/pom.xml Thu Oct 21 03:02:36 2010
>>> @@ -35,7 +35,8 @@ under the License.
>>>  </modules>  
>>>  <build> 
>>>    <sourceDirectory>src/main/csharp</sourceDirectory>  
>>> -    <testSourceDirectory>src/test/csharp</testSourceDirectory>  
>>> +    <!-- Disabled because of NUnit-console Issue NPANDAY-332 -->
>>> +    <!-- <testSourceDirectory>src/test/csharp</testSourceDirectory>
>> -->
>> 
>> Did this work for you before you applied your changes? Or could it be
>> related to the VS2010 changes?
> 
> This was already failing for me before I added in any changes for the pab & 
> uac removal

Do we need to backtrack to the problem?

> 
>>> 
>>> Modified:
>> incubator/npanday/trunk/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryRdfExporterMojo.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryRdfExporterMojo.java?rev=1025815&r1=1025814&r2=1025815&view=diff
>>> 
>> ==============================================================================
>>> ---
>> incubator/npanday/trunk/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryRdfExporterMojo.java
>> (original)
>>> +++
>> incubator/npanday/trunk/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryRdfExporterMojo.java
>> Thu Oct 21 03:02:36 2010
>>> @@ -67,8 +71,7 @@ public class RepositoryRdfExporterMojo
>>>        RDFHandler rdfxmlWriter;
>>>        try
>>>        {
>>> -            File exportFile = new File(
>> localRepository.getParentFile(),
>> "/uac/rdfRepository/rdf-repository-export.xml" );
>>> -            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream(
>> exportFile ) );
>>> +            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream(
>> localRepository ) );
>> 
>> This seems to have dropped the filename.
>> 
>>> @@ -478,7 +478,8 @@ under the License.
>>>    <mavenVersion>2.0.9</mavenVersion>  
>>> 
>> <npanday.snapshots.url>http://repo.npanday.org/archiva/repository/npanday-snapshots</npanday.snapshots.url>
>>> 
>> <npanday.releases.url>http://repo.npanday.org/archiva/repository/npanday-releases</npanday.releases.url>
>>> -    <stable.npanday.version>1.2</stable.npanday.version>
>>> +    <!--<stable.npanday.version>1.2</stable.npanday.version>-->
>>> +    
>> <stable.npanday.version>1.2.2-incubating-SNAPSHOT</stable.npanday.version>
>> 
>> This will make it hard to release. I noticed your comment when
>> resolving the issue about this. What problem occurs if you use the
>> released version?
>> 
>> (Note that old versions should be able to coincide with new ones)
> 
> The problem was it used the old compilers so we need a way to have the 
> unreleased compilers used. Because if we use the release once. It will still 
> have the pab and uac removal. But I think just for release purposes we can 
> use the old compilers to release the new one. and Then after the release we 
> can go back one version earlier.

Does it fail, or is it just that it uses the UAC again? I would have expected 
them to work side by side

- Brett

--
Brett Porter
[email protected]
http://brettporter.wordpress.com/

Reply via email to