You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-dev@incubator.apache.org by Brett Porter <br...@apache.org> on 2011/04/12 02:45:30 UTC

other old commits

Hi Liit,

These were a couple more comments I found on commits. It covers a number of things, but again there's some manual path construction that we might want to look at.


> 
> On 16/10/2010, at 9:29 PM, apadilla@apache.org wrote:
> 
>> 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=1023237&r1=1023236&r2=1023237&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 Sat Oct 16 10:29:17 2010
>> @@ -385,22 +385,12 @@ public final class CompilerContextImpl
>>            for ( Artifact artifact : artifacts )
>>            {
>>                String type = artifact.getType();
>> +                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 != null && (
>> -                            StringUtils.equals( artifactType.getTargetCompileType(), "library" )
>> -                            || artifactType.getExtension().equals( "dll" )
>> -                            || artifactType.getExtension().equals( "exe" ))
>> -                          )
>> -                          || type.equals( "jar" ) )
>> -                {
>> -                    libraries.add( artifact );
>> -                }
> 
> I see the latter bit moved down, but did you mean to remove the module support?
>> @@ -619,8 +631,21 @@ public final class CompilerContextImpl
>>    {
>>        // TODO: Refactor to PathUtil.getGlobalAssemblyCacheFileFor
>> 
>> -        File gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + artifact.getVersion() + "__" +
>> -            artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
>> +        String type = artifact.getType();
>> +        logger.debug( "NPANDAY-061-001: Gac Root:" + gacRoot);
>> +        logger.debug( "NPANDAY-061-003: Artifact Type:" + type);
>> +        File gacFile;
>> +        if ("gac_msil4".equalsIgnoreCase(type)) {
>> +            gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v" + compilerRequirement.getFrameworkVersion() + "_" + artifact.getVersion() + "__" +
>> +                artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
>> +        }
>> +        else {
>> +            gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + artifact.getVersion() + "__" +
>> +                artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
>> +        }
>> +
>> +        logger.debug( "NPANDAY-061-001: gacFile to:" + gacFile.getAbsolutePath() );
> 
> I think Joe already fixed this, but if not the hardcoding needs to be reviewed.
>> 
>> Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/DefaultRepositoryNetExecutable.java
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/DefaultRepositoryNetExecutable.java?rev=1023237&r1=1023236&r2=1023237&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/DefaultRepositoryNetExecutable.java (original)
>> +++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/DefaultRepositoryNetExecutable.java Sat Oct 16 10:29:17 2010
>> @@ -98,7 +98,8 @@ public class DefaultRepositoryNetExecuta
>>                ( ( getExecutionPath() != null ) ? getExecutionPath().getAbsolutePath() : "unknown" ) + ", Command = " +
>>                commands, e );
>>        }
>> -        if ( commandExecutor.getStandardOut().contains( "error" ) )
>> +        if ( commandExecutor.getStandardOut().contains( "error" )
>> +          && !commandExecutor.getStandardOut().contains( "exit code = 0" ) )        
> 
> I can't remember - but did this already get fixed after we discussed it before?
>> Modified: incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRegistryLoader.java
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRegistryLoader.java?rev=1023237&r1=1023236&r2=1023237&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRegistryLoader.java (original)
>> +++ incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRegistryLoader.java Sat Oct 16 10:29:17 2010
>> @@ -146,7 +147,13 @@ public class StandardRegistryLoader
>>                filePath.append( (char) path[i++] );
>>            }
>>        }//end for:i
>> -        return filePath.toString();
>> +        String str = filePath.toString();
>> +        if (!str.startsWith("/")) {
>> +            str = str.replaceAll("/", "\\\\");
>> +            str = str.replaceAll("\\\\:", ":");
>> +            str = str.replaceAll("\\\\\\\\", "\\\\");
>> +        }
>> +        return str;
> 
> What's the purpose of this?
>> 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=1023237&r1=1023236&r2=1023237&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 Sat Oct 16 10:29:17 2010
>> @@ -408,6 +408,13 @@ public abstract class AbstractCompilerMo
>>     * @parameter expression = "${resource}"
>>     */
>>    protected String resource;
>> +    
>> +    /**
>> +     * Embed the specified resource
>> +     *
>> +     * @parameter expression = "${embeddedResources}"
>> +     */
>> +    protected ArrayList<String> embeddedResources;    
> 
>> Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java?rev=1023237&r1=1023236&r2=1023237&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java (original)
>> +++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java Sat Oct 16 10:29:17 2010
>> @@ -213,6 +213,15 @@ public final class CompilerMojo
>>            params.add("/resource:" + resource);
>>        }
>> 
>> +		if (embeddedResources != null)
>> +        {
>> +			for ( String arg : embeddedResources )
>> +			{
>> +				params.add( "/resource:" + arg );
>> +			}
>> +            //params.add("/resource:" + resource);
>> +        }
>> +        
> 
> These seem unrelated. Did you intend it to be in this changeset? Are there new tests / doc / a ticket for it?
>> Modified: incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceCopierMojo.java
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceCopierMojo.java?rev=1023237&r1=1023236&r2=1023237&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceCopierMojo.java (original)
>> +++ incubator/npanday/trunk/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceCopierMojo.java Sat Oct 16 10:29:17 2010
>> @@ -56,16 +56,39 @@ public class ResourceCopierMojo
>>    public void execute()
>>        throws MojoExecutionException
>>    {
>> -        List<Resource> resources = project.getResources();
>> +		try 
>> +		{
>> +		
>> +			copyAllResources(project.getResources());
>> +			copyAllResources(project.getTestResources());
> 
> are the test resources meant to be in the same location? is there a chance they'll get included in the artifact?
> 

> On 20/10/2010, at 10:37 PM, apadilla@apache.org wrote:
> 
>> 
>> 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=1025511&r1=1025510&r2=1025511&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 Wed Oct 20 11:37:11 2010
>> @@ -586,22 +586,20 @@ public final class ProjectDaoImpl
>>                // project
>>                // now we need to generate the system path of the gac references so we can use
>>                // System.getenv("SystemRoot")
>> +                //we have already set file for the assembly above (in createArtifactFrom) so we do not need re-resovle it
>>                if ( !projectDependency.isResolved() )
>>                {
>>                    if ( ArtifactTypeHelper.isDotnetAnyGac( projectDependency.getArtifactType() ) )
>>                    {
>>                        try
>>                        {
>> -                            projectDependency.setResolved( true );
>> -                            if ( projectDependency.getSystemPath() == null )
>> +                            if (assembly.getFile().exists())
>>                            {
>> -                                projectDependency.setSystemPath( generateDependencySystemPath( projectDependency ) );
>> +                                projectDependency.setSystemPath( assembly.getFile().getAbsolutePath());
>> +                                projectDependency.setResolved( true );
>> +                                assembly.setResolved( true );
>>                            }
>> -                            File f = new File( projectDependency.getSystemPath() );
>> -                            assembly.setFile( f );
>> -                            assembly.setResolved( true );
>>                            artifactDependencies.add( assembly );
>> -
>>                        }
>>                        catch ( ExceptionInInitializerError e )
>>                        {
> 
> Are you sure this change is needed? It might be correct, but I can't see why it would be specific to .NET 4.0 support, and this is quite fragile code :) It might be best to make it a separately documented issue if it was to fix something else.
> 
>> @@ -1295,20 +1293,24 @@ public final class ProjectDaoImpl
>>                                                                      VersionRange.createFromVersion( version ),
>>                                                                      artifactType, publicKeyTokenId, scope,
>>                                                                      null );
>> -        // TODO: Use PathUtil!
>> -        File artifactFile = ArtifactTypeHelper.isDotnetAnyGac( artifactType ) ? new File(
>> -            "C:\\WINDOWS\\assembly\\" + artifactType + File.separator + artifactId + File.separator + version + "__" +
>> -                publicKeyTokenId + File.separator + artifactId + ".dll" ) : new File( System.getProperty( "user.home" ),
>> -                                                                                      File.separator + ".m2" +
>> -                                                                                          File.separator + "uac" +
>> -                                                                                          File.separator + "gac_msil" +
>> -                                                                                          File.separator + artifactId +
>> -                                                                                          File.separator + version +
>> -                                                                                          "__" + groupId +
>> -                                                                                          File.separator + artifactId +
>> -                                                                                          "." +
>> -                                                                                          ArtifactType.getArtifactTypeForPackagingName(
>> -                                                                                              artifactType ).getExtension() );
>> +        //using PathUtil
>> +        File artifactFile = null;
>> +        if (ArtifactTypeHelper.isDotnetAnyGac( artifactType ))
>> +        {
>> +            if (!ArtifactTypeHelper.isDotnet4Gac(artifactType))
>> +            {
>> +                artifactFile = PathUtil.getGlobalAssemblyCacheFileFor( assembly, new File("C:\\WINDOWS\\assembly\\") );
>> +            }
>> +            else
>> +            {
>> +                artifactFile = PathUtil.getGACFile4Artifact(assembly);
>> +            }
> 
> could this be handled inside the getG..A..C...FileFor method?
> 
>> +        }
>> +        else
>> +        {
>> +            artifactFile = PathUtil.getUserAssemblyCacheFileFor( assembly, new File( System.getProperty( "user.home" ),
>> +                                                                                      File.separator + ".m2" + File.separator + "repository") );
> 
> We shouldn't hardcode the system properties / local repository - can it be passed in? (the comments on Joe's changes might make it redundant).
> 
>> 
>> 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=1025511&r1=1025510&r2=1025511&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 Wed Oct 20 11:37:11 2010
>> 
>> @@ -635,7 +647,7 @@ public final class CompilerContextImpl
>>        logger.debug( "NPANDAY-061-001: Gac Root:" + gacRoot);
>>        logger.debug( "NPANDAY-061-003: Artifact Type:" + type);
>>        File gacFile;
>> -        if ("gac_msil4".equalsIgnoreCase(type)) {
>> +        if ("gac_msil4".equalsIgnoreCase(type) || "gac_32_4".equalsIgnoreCase(type) || "gac_64_4".equalsIgnoreCase(type)) {
>>            gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v" + compilerRequirement.getFrameworkVersion() + "_" + artifact.getVersion() + "__" +
>>                artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
>>        }
> 
> Should these be using the ArtifactType utilitiy as well?
> 
>> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs Wed Oct 20 11:37:11 2010
>> @@ -100,11 +100,9 @@ namespace NPanday.Plugin.MojoGenerator
>> 				jcuLocal.unmarshall(javaClass, fileInfo);
>> 			}
>> 			
>> -			ResourceManager resourceManager = new ResourceManager("NPanday.Plugin.MojoGenerator", 
>> -			                                                      Assembly.GetExecutingAssembly());
>> -			String pomXml = (String) resourceManager.GetObject("pom-java.xml");
>> -			TextReader reader = new StringReader(pomXml);
>> -		    XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
>> +            TextReader reader = new StreamReader(Assembly.GetExecutingAssembly().
>> +            GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]));
>> +			XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
>> 			NPanday.Model.Pom.Model model = (NPanday.Model.Pom.Model) serializer.Deserialize(reader);	
>> 			model.artifactId = artifactId + ".JavaBinding";
>> 			model.groupId = groupId;
> 
> I'm not sure I understand this change. Is it reading the POM as the first resource from an asembly?
> 
>> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs Wed Oct 20 11:37:11 2010
>> @@ -518,7 +518,7 @@ namespace NPanday.ProjectImporter.Conver
>> 
>>            foreach (Plugin plugin in model.build.plugins)
>>            {
>> -                if (groupId.ToLower().Equals(plugin.groupId.ToLower()) && artifactId.ToLower().Equals(plugin.artifactId.ToLower()))
>> +                if (groupId.ToLower().Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase) && artifactId.ToLower().Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
>>                {
>>                    if (!string.IsNullOrEmpty(version) && version.Equals(plugin.version))
>>                    {
>> @@ -730,7 +730,7 @@ namespace NPanday.ProjectImporter.Conver
>> 
>> 
>>            // resolve from GAC
>> -            if (!string.IsNullOrEmpty(gacUtil.GetAssemblyInfo(reference.Name)))
>> +            if (!string.IsNullOrEmpty(gacUtil.GetAssemblyInfo(reference.Name, null, projectDigest.Platform)))
>>            {
>>                // Assembly is found at the gac
>> 
>> @@ -740,21 +740,50 @@ namespace NPanday.ProjectImporter.Conver
>> 
>>                if ("MSIL".Equals(reference.ProcessorArchitecture, StringComparison.OrdinalIgnoreCase))
>>                {
>> -                    refDependency.type = "gac_msil";
>> +                    if ("4.0.0.0".Equals(reference.Version))
>> +                    {
>> +                        refDependency.type = "gac_msil4";
>> +                    }
>> +                    else
>> +                    {
>> +                        refDependency.type = "gac_msil";
> 
> This might be best in a utility method, in case a future version needs to be introduced that behaves the same (eg. 4.5.0.0).
> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs Wed Oct 20 11:37:11 2010
>> @@ -52,6 +52,11 @@ namespace NPanday.ProjectImporter.Conver
>>            // change the outputDirectory of the plugin
>>            Plugin compilePlugin = FindPlugin("npanday.plugin", "maven-compile-plugin");
>>            AddPluginConfiguration(compilePlugin, "outputDirectory", "bin");
>> +
>> +            // Add NPanday compile plugin 
>> +            Plugin aspxPlugin = AddPlugin("npanday.plugin", "maven-aspx-plugin");
>> +            if (!string.IsNullOrEmpty(projectDigest.TargetFramework))
>> +                AddPluginConfiguration(aspxPlugin, "frameworkVersion", projectDigest.TargetFramework);
> 
> Should the plugin only be added if the configuration will be set?
> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs Wed Oct 20 11:37:11 2010
>> @@ -164,6 +164,18 @@ namespace NPanday.ProjectImporter.Digest
>>                                break;
>>                            case "Reference":
>>                                Reference reference = new Reference(projectBasePath, gac);
>> +                                //quick workaround for cases of importing .net 4.0 targeted projects, as their referneces has to be also for 
>> +                                //.net framework 4.0 (that is their version in GAC is 4.0.0.0). Then we will use this 
>> +                                if (projectDigest.TargetFramework == "4.0")
> There's a couple of these checks - maybe need a utility method alo?
> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs Wed Oct 20 11:37:11 2010
>> @@ -17,7 +17,6 @@ namespace NPanday.ProjectImporter.Digest
>> 
>>    public class Reference : IncludeBase
>>    {
>> -
>>        #region Constructors
>> 
>>        public Reference(string projectBasePath, GacUtility gac) 
>> @@ -218,7 +217,9 @@ namespace NPanday.ProjectImporter.Digest
>>                // compare the assembly name to the filename of the reference to determine if it is a match
>>                // as the location might not be set
>>                // TODO: why do we need to load the assembly?
>> -                if (asmm.GetName().Name.Equals(Path.GetFileNameWithoutExtension(path)))
>> +                // added StringComparison.OrdinalIgnoreCase to assembly name compratison in order to avoid errors with 
>> +                // already loaded assemblies like nunit.framework and NUnit.Framework etc (note this can be reconsidered)
> 
> Do you need to elaborate on this on a separate thread on this list, about whether they need to be reconsidered? I'm not sure what problem you were seeing.
> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs Wed Oct 20 11:37:11 2010
>> @@ -128,8 +128,8 @@ namespace NPanday.ProjectImporter.Conver
>>                    scmTag = scmTag.Trim();
>> 
>>                    Scm scmHolder = new Scm();
>> -                    scmHolder.connection = string.Format("scm:svn:{0}",scmTag);
>> -                    scmHolder.developerConnection = string.Format("scm:svn:{0}", scmTag);
>> +                    scmHolder.connection = string.Format("scm:svn:{0}",scmTag); 
>> +                    scmHolder.developerConnection = string.Format("scm:svn:{0}", scmTag); //why forcibly Subversion? (scm:hg for example). Need to add more fields to configure.
> 
> This could perhaps be filed as an issue. At the moment I think the UI takes an SVN location only.
> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs Wed Oct 20 11:37:11 2010
>> @@ -19,6 +19,7 @@
>> //
>> #endregion
>> 
>> +using System.Globalization;
>> using Extensibility;
>> using EnvDTE;
>> using EnvDTE80;
>> @@ -233,7 +234,7 @@ namespace NPanday.VisualStudio.Addin
>>                    return false;
>>                }
>>            }
>> -            if (uri.ToLower().StartsWith("http") || uri.ToLower().StartsWith("mailto"))
>> +            if (uri.ToLower().StartsWith("http") || uri.ToLower().StartsWith("mailto", true, CultureInfo.InvariantCulture))
>>            {
>>                return false;
>>            }
>> @@ -443,7 +444,7 @@ namespace NPanday.VisualStudio.Addin
>>                VsWebSite.VSWebSite website = (VsWebSite.VSWebSite)project.Object;
>> 
>>                Assembly a = Assembly.LoadFile(artifact.FileInfo.FullName);
>> -                if (a.ToString().Split(",".ToCharArray())[0].ToLower().StartsWith("interop."))
>> +                if (a.ToString().Split(",".ToCharArray())[0].ToLower().StartsWith("interop.", true, CultureInfo.InvariantCulture))
>>                {
>>                    MessageBox.Show("Cannot add COM Interop reference from a Maven Artifact, just use Add Reference if you wish to add a COM reference.", "Add Maven Artifact", MessageBoxButtons.OK, MessageBoxIcon.Information);
>>                    return false;
>> 
>> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs (original)
>> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs Wed Oct 20 11:37:11 2010
>> @@ -208,7 +208,7 @@ namespace NPanday.VisualStudio.Addin
>>                if (projectItem.Name.Contains(".cs") || projectItem.Name.Contains(".vb"))
>>                {
>>                    //change addpluginConfiguration to accept xmlElement instead
>> -                    pomUtil.AddMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource", projectItem.Name);
>> +                    pomUtil.AddMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource", GetRelativePathToProject(projectItem, null));
>>                }
>> 
>>                if (projectItem.Name.Contains(".resx"))
>> @@ -280,7 +280,7 @@ namespace NPanday.VisualStudio.Addin
>>                    if (projectItem.Name.Contains(".cs") || projectItem.Name.Contains(".vb"))
>>                    {
>>                        //change addpluginConfiguration to accept xmlElement instead
>> -                        pomUtil.RemoveMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource", projectItem.Name);
>> +                        pomUtil.RemoveMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource", GetRelativePathToProject(projectItem, null));
>>                    }
>> 
>>                    if (projectItem.Name.Contains(".resx"))
>> @@ -302,7 +302,7 @@ namespace NPanday.VisualStudio.Addin
>>                if (projectItem.Name.Contains(".cs") || projectItem.Name.Contains(".vb"))
>>                {
>>                    //change addpluginConfiguration to accept xmlElement instead
>> -                    pomUtil.RenameMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource",oldName, projectItem.Name);
>> +                    pomUtil.RenameMavenCompilePluginConfiguration("npanday.plugin", "maven-compile-plugin", "includeSources", "includeSource", GetRelativePathToProject(projectItem, oldName), GetRelativePathToProject(projectItem, null));
>>                }
>> 
>>                if (projectItem.Name.Contains(".resx"))
>> @@ -315,17 +315,37 @@ namespace NPanday.VisualStudio.Addin
>> 
>>        }
>> 
>> +        /// <summary>
>> +        /// Returns either a relative path to project (if a project item is assciated with a file - like *.cs) or just the name of project item
>> +        /// </summary>
>> +        /// <param name="projectItem"></param>
>> +        /// <returns></returns>
>> +        private static string GetRelativePathToProject(ProjectItem projectItem, string fileName)
>> +        {
>> +            if (projectItem.FileCount == 1)
>> +            {
>> +                Uri fullPathUri = fileName == null ? new Uri(projectItem.get_FileNames(0)) : new Uri(Path.Combine(Path.GetDirectoryName(projectItem.get_FileNames(0)), fileName));
>> +                Uri projectUri = new Uri(Path.GetDirectoryName(projectItem.ContainingProject.FullName) + Path.DirectorySeparatorChar);
>> +                return projectUri.MakeRelativeUri(fullPathUri).ToString();
>> +            }
>> +            return projectItem.Name;
>> +        }    
> 
> Can you explain more why this is needed?

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





Re: other old commits

Posted by Lars Corneliussen <me...@lcorneliussen.de>.
Am 12.04.11 04:45, schrieb Brett Porter:
>> >>  
>> >>  Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
>> >>  URL:http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
>> >>  ==============================================================================
>> >>  --- incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs (original)
>> >>  +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs Wed Oct 20 11:37:11 2010
>> >>  @@ -100,11 +100,9 @@ namespace NPanday.Plugin.MojoGenerator
>> >>  				jcuLocal.unmarshall(javaClass, fileInfo);
>> >>  			}
>> >>  			
>> >>  -			ResourceManager resourceManager = new ResourceManager("NPanday.Plugin.MojoGenerator",
>> >>  -			                                                      Assembly.GetExecutingAssembly());
>> >>  -			String pomXml = (String) resourceManager.GetObject("pom-java.xml");
>> >>  -			TextReader reader = new StringReader(pomXml);
>> >>  -		    XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
>> >>  +            TextReader reader = new StreamReader(Assembly.GetExecutingAssembly().
>> >>  +            GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]));
>> >>  +			XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
>> >>  			NPanday.Model.Pom.Model model = (NPanday.Model.Pom.Model) serializer.Deserialize(reader);	
>> >>  			model.artifactId = artifactId + ".JavaBinding";
>> >>  			model.groupId = groupId;
> >  
> >  I'm not sure I understand this change. Is it reading the POM as the first resource from an asembly?
> >  
I also stumbled over that change and filed a "bug". Didn't know it was 
introduced lately:


    JavaBindings-Generator for .NET-Mojos is fragile (and not working
    for NPanday.Plugin.SettingsGenerator)
    <https://issues.apache.org/jira/browse/NPANDAY-385>


https://issues.apache.org/jira/browse/NPANDAY-385