[NPANDAY-328] - support for VS2010 WPF Project
[NPANDAY-329] - support for VS2010 WCF Project
[NPANDAY-330] - support for VS2010 MVC Project
* Submitted patch by Artem Fedorenko
* fixed formatting
git-svn-id: https://svn.apache.org/repos/asf/incubator/npanday/branches/npanday-vs2010-support@1023230 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/components/dotnet-core/src/main/java/npanday/ArtifactType.java b/components/dotnet-core/src/main/java/npanday/ArtifactType.java
index a5886c0..c3a2d25 100644
--- a/components/dotnet-core/src/main/java/npanday/ArtifactType.java
+++ b/components/dotnet-core/src/main/java/npanday/ArtifactType.java
@@ -156,7 +156,11 @@
GAC_32 ( "gac_32", null, "dll"),
- GAC_64 ( "gac_64", null, "dll"),
+ GAC_32_4 ( "gac_32_4", null, "dll"),
+
+ GAC_64 ( "gac_64", null, "dll"),
+
+ GAC_64_4 ( "gac_64_4", null, "dll"),
COM_REFERENCE( "com_reference", null, "dll");
diff --git a/components/dotnet-core/src/main/java/npanday/ArtifactTypeHelper.java b/components/dotnet-core/src/main/java/npanday/ArtifactTypeHelper.java
index b652527..33bf6ef 100644
--- a/components/dotnet-core/src/main/java/npanday/ArtifactTypeHelper.java
+++ b/components/dotnet-core/src/main/java/npanday/ArtifactTypeHelper.java
@@ -104,8 +104,22 @@
|| packaging.equals( ArtifactType.GAC_GENERIC )
|| packaging.equals( ArtifactType.GAC )
|| packaging.equals( ArtifactType.GAC_32)
- || packaging.equals( ArtifactType.GAC_64)
+ || packaging.equals( ArtifactType.GAC_32_4)
+ || packaging.equals( ArtifactType.GAC_64)
+ || packaging.equals( ArtifactType.GAC_64_4)
|| packaging.equals( ArtifactType.GAC_MSIL )
|| packaging.equals( ArtifactType.GAC_MSIL4 );
}
+
+ public static boolean isDotnet4Gac(String packaging)
+ {
+ return isDotnet4Gac( ArtifactType.getArtifactTypeForPackagingName( packaging ) );
+ }
+
+ public static boolean isDotnet4Gac(ArtifactType packaging)
+ {
+ return packaging.equals( ArtifactType.GAC_MSIL4 )
+ || packaging.equals( ArtifactType.GAC_32_4)
+ || packaging.equals( ArtifactType.GAC_64_4);
+ }
}
diff --git a/components/dotnet-core/src/main/java/npanday/PathUtil.java b/components/dotnet-core/src/main/java/npanday/PathUtil.java
index 591e215..2b48de2 100644
--- a/components/dotnet-core/src/main/java/npanday/PathUtil.java
+++ b/components/dotnet-core/src/main/java/npanday/PathUtil.java
@@ -46,6 +46,16 @@
gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" +
artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
}
+ else if (type.equals(ArtifactType.GAC_32_4.getPackagingType())) {
+ String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_32\\";
+ gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" +
+ artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
+ }
+ else if (type.equals(ArtifactType.GAC_64_4.getPackagingType())) {
+ String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_64\\";
+ gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" +
+ artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
+ }
else {
gacFile = artifact.getFile();
}
diff --git a/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java b/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
index 9563dca..f319c70 100644
--- a/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
+++ b/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
@@ -586,22 +586,20 @@
// 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 )
{
@@ -1295,20 +1293,24 @@
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);
+ }
+ }
+ else
+ {
+ artifactFile = PathUtil.getUserAssemblyCacheFileFor( assembly, new File( System.getProperty( "user.home" ),
+ File.separator + ".m2" + File.separator + "repository") );
+ }
assembly.setFile( artifactFile );
return assembly;
diff --git a/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java b/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
index cc7ce04..b09eefa 100644
--- a/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
+++ b/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
@@ -434,13 +434,25 @@
setArtifactGacFile( gacRoot, artifact );
libraries.add( artifact );
}
+ else if ( type.equals( ArtifactType.GAC_32_4.getPackagingType() ) )
+ {
+ String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_32\\";
+ setArtifactGacFile( gacRoot, artifact );
+ libraries.add( artifact );
+ }
else if ( type.equals( ArtifactType.GAC_64.getPackagingType() ) )
{
String gacRoot = ( compilerRequirement.getVendor().equals( Vendor.MONO ) ) ? getGacRootForMono()
: System.getenv( "SystemRoot" ) + "\\assembly\\GAC_64\\";
setArtifactGacFile( gacRoot, artifact );
libraries.add( artifact );
- }
+ }
+ else if ( type.equals( ArtifactType.GAC_64_4.getPackagingType() ) )
+ {
+ String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_64\\";
+ setArtifactGacFile( gacRoot, artifact );
+ libraries.add( artifact );
+ }
else if ( type.equals( ArtifactType.GAC_MSIL.getPackagingType() ) )
{
String gacRoot = ( compilerRequirement.getVendor().equals( Vendor.MONO ) ) ? getGacRootForMono()
@@ -635,7 +647,7 @@
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" );
}
diff --git a/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoRepositoryImpl.java b/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoRepositoryImpl.java
index 92d71be..93db668 100644
--- a/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoRepositoryImpl.java
+++ b/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoRepositoryImpl.java
@@ -252,14 +252,26 @@
{
return new File(System.getenv("SystemRoot"), "\\assembly\\GAC_32\\" );
}
+ else if ( artifactType.equals( ArtifactType.GAC_32_4.getPackagingType() ) )
+ {
+ return new File(System.getenv("SystemRoot"), "\\Microsoft.NET\\assembly\\GAC_32\\" );
+ }
else if ( artifactType.equals( ArtifactType.GAC_64.getPackagingType() ) )
{
return new File(System.getenv("SystemRoot"), "\\assembly\\GAC_64\\" );
- }
+ }
+ else if ( artifactType.equals( ArtifactType.GAC_64_4.getPackagingType() ) )
+ {
+ return new File(System.getenv("SystemRoot"), "\\Microsoft.NET\\assembly\\GAC_64\\" );
+ }
else if ( artifactType.equals( ArtifactType.GAC_MSIL.getPackagingType() ) )
{
return new File( System.getenv("SystemRoot"), "\\assembly\\GAC_MSIL\\" );
}
+ else if ( artifactType.equals( ArtifactType.GAC_MSIL4.getPackagingType() ) )
+ {
+ return new File( System.getenv("SystemRoot"), "\\Microsoft.NET\\assembly\\GAC_MSIL\\" );
+ }
throw new PlatformUnsupportedException("NPANDAY-xxx-000: Could not locate a valid GAC");
}
}
diff --git a/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs b/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
index c7072fa..bd8cd7b 100644
--- a/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
+++ b/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
@@ -100,11 +100,9 @@
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;
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs
index 4da932c..83ff8e8 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/AbstractPomConverter.cs
@@ -518,7 +518,7 @@
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 @@
// 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 @@
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";
+ }
}
else if ("x86".Equals(reference.ProcessorArchitecture, StringComparison.OrdinalIgnoreCase))
{
- refDependency.type = "gac_32";
+ if ("4.0.0.0".Equals(reference.Version))
+ {
+ refDependency.type = "gac_32_4";
+ }
+ else
+ {
+ refDependency.type = "gac_32";
+ }
}
- //check if Project is imported on a 64bit machine
- else if ("AMD64".Equals(reference.ProcessorArchitecture, StringComparison.OrdinalIgnoreCase))
+ else if ("IA64".Equals(reference.ProcessorArchitecture, StringComparison.OrdinalIgnoreCase) ||
+ "AMD64".Equals(reference.ProcessorArchitecture, StringComparison.OrdinalIgnoreCase))
{
- refDependency.type = "gac_64";
+ if ("4.0.0.0".Equals(reference.Version))
+ {
+ refDependency.type = "gac_64_4";
+ }
+ else
+ {
+ refDependency.type = "gac_64";
+ }
}
- //Assemblies that with null ProcessorArchitecture esp ASP.net assmblies (e.g MVC)
+
+ //Assemblies that with null ProcessorArchitecture esp ASP.net assmblies (e.g MVC)
else if ((reference.ProcessorArchitecture == null) && ("31bf3856ad364e35".Equals(reference.PublicKeyToken.ToLower(), StringComparison.OrdinalIgnoreCase)))
{
- refDependency.type = "gac_msil";
+ if ("4.0.0.0".Equals(reference.Version))
+ {
+ refDependency.type = "gac_msil4";
+ }
+ else
+ {
+ refDependency.type = "gac_msil";
+ }
}
else
@@ -765,7 +794,7 @@
refDependency.version = reference.Version ?? "1.0.0.0";
//exclude ProcessArchitecture when loading assembly on a non-32 bit machine
- System.Reflection.Assembly a = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName(gacUtil.GetAssemblyInfo(reference.Name)).FullName);
+ System.Reflection.Assembly a = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName(gacUtil.GetAssemblyInfo(reference.Name, reference.Version, null)).FullName);
if (reference.PublicKeyToken != null)
{
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/NormalPomConverter.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/NormalPomConverter.cs
index 409b478..1fb512a 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/NormalPomConverter.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/NormalPomConverter.cs
@@ -100,20 +100,28 @@
Plugin msBuildPlugin = AddPlugin("npanday.plugin", "NPanday.Plugin.Msbuild.JavaBinding", null, false);
AddPluginExecution(msBuildPlugin, "compile", "validate");
msBuildPluginAdded = true;
- }
-
- string gFile;
-
- //if project is imported in 64-bit path should include "x86"
- if (projectDigest.Platform.Contains("x86"))
- {
- gFile = @"obj\x86\Debug\";
- }
- else
- {
- gFile = @"obj\Debug\";
- }
+ }
+ string gFile;
+ //set the path *.g.cs and *.g.vb files depending on target architecture of WPF projects as this changes path under obj folder
+ switch (projectDigest.Platform)
+ {
+ case "AnyCPU":
+ gFile = @"obj\Debug\";
+ break;
+ case "x64":
+ gFile = @"obj\x64\Debug\";
+ break;
+ case "x86":
+ gFile = @"obj\x86\Debug\";
+ break;
+ case "Itanium":
+ gFile = @"obj\Itanium\Debug\";
+ break;
+ default:
+ gFile = @"obj\Debug\";
+ break;
+ }
if (compilesFile.EndsWith(".cs"))
gFile += compilesFile.Replace(".xaml.cs", ".g.cs");
else
@@ -162,7 +170,13 @@
false
);
AddPluginConfiguration(testPlugin, "integrationTest", "true");
-
+
+ // for running .net framework 4.0 unit tests add new parameter in order to tell NUnit which runtime to use. If there is a way to get this
+ // parameter from maven-compile-plugin use it
+ if (projectDigest.TargetFramework == "4.0")
+ {
+ AddPluginConfiguration(testPlugin, "executionFrameworkVersion", "4.0");
+ }
}
// Add Com Reference Dependencies
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs
index 6cf177c..125c1ee 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Converter/Algorithms/WebWithVbOrCsProjectFilePomConverter.cs
@@ -52,6 +52,11 @@
// 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);
// add msbuild plugin config in pom if there's a maven-resgen-plugin but no msbuild config
// generates resources in target/bin folder
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs
index 49f5818..00fa000 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Algorithms/NormalProjectDigestAlgorithm.cs
@@ -164,6 +164,18 @@
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")
+ {
+ reference.Version = "4.0.0.0"; //Then we will use this version when resolving references from GAC
+ }
+ //set processorArchitecture property to platform, it will be used by GacUtility in
+ // order to resolve artifact to right processor architecture
+ if (!string.IsNullOrEmpty(projectDigest.Platform))
+ {
+ reference.ProcessorArchitecture = projectDigest.Platform;
+ }
string hintPath = buildItem.GetMetadata("HintPath");
if (!string.IsNullOrEmpty(hintPath))
{
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
index 11e11b7..879d9c5 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
@@ -17,7 +17,6 @@
public class Reference : IncludeBase
{
-
#region Constructors
public Reference(string projectBasePath, GacUtility gac)
@@ -218,7 +217,9 @@
// 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)
+ if (asmm.GetName().Name.Equals(Path.GetFileNameWithoutExtension(path), StringComparison.OrdinalIgnoreCase))
{
asm = asmm;
asmNotLoaded = false;
@@ -516,7 +517,7 @@
private void SetAssemblyValuesFromGac(string name)
{
this.Name = name.Split(',')[0].Trim();
- string str = GacUtility.GetAssemblyInfo(this.Name);
+ string str = GacUtility.GetAssemblyInfo(this.Name, version, processorArchitecture);
SetAssemblyInfoValues(str);
}
diff --git a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs
index 1e25820..ca718c9 100644
--- a/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs
+++ b/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/PomConverter.cs
@@ -128,8 +128,8 @@
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.
scmHolder.url = scmTag;
model.scm = scmHolder;
}
diff --git a/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/GacUtility.cs b/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/GacUtility.cs
index 177dd95..faf5857 100644
--- a/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/GacUtility.cs
+++ b/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/GacUtility.cs
@@ -47,9 +47,10 @@
string msBuildPath = Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(string)).Location);
string f35 = Path.GetFullPath(Environment.SystemDirectory + @"\..\Microsoft.NET\Framework\v3.5");
- if (Directory.Exists(f35))
+ string f4 = Path.GetFullPath(Environment.SystemDirectory + @"\..\Microsoft.NET\Framework\v4.0.30319");
+ if (Directory.Exists(f4))
{
- msBuildPath = f35;
+ msBuildPath = f4;
}
try
{
@@ -69,16 +70,31 @@
}
- public string GetAssemblyInfo(string assemblyName)
+ public string GetAssemblyInfo(string assemblyName, string version, string processorArchitecture)
{
if (string.IsNullOrEmpty(assemblyName))
{
return null;
}
- Regex regex = new Regex(@"\s*" + assemblyName + @",\s*.*", RegexOptions.IgnoreCase);
- MatchCollection matches = regex.Matches(gacs);
+ string architecture = String.Empty;
+ if (! string.IsNullOrEmpty(processorArchitecture))
+ {
+ architecture = GetRegexProcessorArchitectureFromString(processorArchitecture);
+ }
+ Regex regex;
+ if (string.IsNullOrEmpty(version))
+ {
+ regex = new Regex(@"\s*" + assemblyName + @",.*processorArchitecture=" + architecture + ".*", RegexOptions.IgnoreCase);
+
+ }
+ else
+ {
+ regex = new Regex(@"\s*" + assemblyName + @",\s*Version=" + Regex.Escape(version) + @".*processorArchitecture=" + architecture + ".*", RegexOptions.IgnoreCase);
+ }
+
+ MatchCollection matches = regex.Matches(gacs);
foreach (Match match in matches)
{
@@ -143,5 +159,22 @@
return false;
}
+
+ private static string GetRegexProcessorArchitectureFromString(string input)
+ {
+ switch (input)
+ {
+ case "x64":
+ return "(AMD64|MSIL)";
+ case "Itanium":
+ return "(IA64|MSIL)";
+ case "x86":
+ return "(x86|MSIL)";
+ case "AnyCPU":
+ return "(x86|MSIL)";
+ default:
+ return input;
+ }
+ }
}
}
diff --git a/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/PomHelperUtility.cs b/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/PomHelperUtility.cs
index 44abced..737b3a7 100644
--- a/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/PomHelperUtility.cs
+++ b/dotnet/assemblies/NPanday.Utils/src/main/csharp/NPanday/Utils/PomHelperUtility.cs
@@ -97,8 +97,8 @@
foreach (Plugin plugin in model.build.plugins)
{
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
@@ -673,7 +673,7 @@
{
foreach (Dependency dependency in model.dependencies)
{
- if (artifactId.ToLower().Equals(dependency.artifactId.ToLower()))
+ if (artifactId.ToLower().Equals(dependency.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
// consider groupId and version if not empty
if (!string.IsNullOrEmpty(groupId)
@@ -989,8 +989,8 @@
foreach (Plugin plugin in model.build.plugins)
{
- if ("npanday.plugin".Equals(plugin.groupId.ToLower())
- && "maven-compile-plugin".Equals(plugin.artifactId.ToLower()))
+ if ("npanday.plugin".Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && "maven-compile-plugin".Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1078,8 +1078,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1128,8 +1128,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1181,8 +1181,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1232,8 +1232,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1303,8 +1303,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1371,8 +1371,8 @@
{
XmlDocument xmlDocument = new XmlDocument();
- if (pluginGroupId.Equals(plugin.groupId.ToLower())
- && pluginArtifactId.Equals(plugin.artifactId.ToLower()))
+ if (pluginGroupId.Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && pluginArtifactId.Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
if (plugin.configuration == null && plugin.configuration.Any == null)
{
@@ -1573,7 +1573,7 @@
{
foreach (XmlElement elem in elems)
{
- if (!string.IsNullOrEmpty(elem.Name) && elem.Name.ToLower().Equals(elementName.ToLower()))
+ if (!string.IsNullOrEmpty(elem.Name) && elem.Name.ToLower().Equals(elementName.ToLower(), StringComparison.InvariantCultureIgnoreCase))
return elem;
}
return null;
@@ -1598,8 +1598,8 @@
}
}
- if ("npanday.plugin".Equals(plugin.groupId.ToLower())
- && "maven-compile-plugin".Equals(plugin.artifactId.ToLower()))
+ if ("npanday.plugin".Equals(plugin.groupId.ToLower(), StringComparison.InvariantCultureIgnoreCase)
+ && "maven-compile-plugin".Equals(plugin.artifactId.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
XmlElement[] elems = ((XmlElement[])plugin.configuration.Any);
for (int count = elems.Length; count-- > 0; )
@@ -1657,16 +1657,16 @@
{
XmlNode removeMe = null;
if (!string.IsNullOrEmpty(elem.Name) &&
- elem.Name.ToLower().Equals("webreferences"))
+ elem.Name.ToLower().Equals("webreferences", StringComparison.InvariantCultureIgnoreCase))
{
foreach (XmlNode node in elem.ChildNodes)
{
- if (node.Name.ToLower().Equals("webreference"))
+ if (node.Name.ToLower().Equals("webreference", StringComparison.InvariantCultureIgnoreCase))
{
foreach (XmlNode node1 in node.ChildNodes)
{
- if (node1.Name.ToLower().Equals("namespace") &&
- node1.InnerText.ToLower().Equals(name.ToLower()))
+ if (node1.Name.ToLower().Equals("namespace", StringComparison.InvariantCultureIgnoreCase) &&
+ node1.InnerText.ToLower().Equals(name.ToLower(), StringComparison.InvariantCultureIgnoreCase))
{
removeMe = node;
break;
diff --git a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs
index 9a54e0c..e1c2ee9 100644
--- a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs
+++ b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs
@@ -19,6 +19,7 @@
//
#endregion
+using System.Globalization;
using Extensibility;
using EnvDTE;
using EnvDTE80;
@@ -233,7 +234,7 @@
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 @@
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;
diff --git a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs
index e97b4a0..8a5a688 100644
--- a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs
+++ b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs
@@ -208,7 +208,7 @@
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 @@
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 @@
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 @@
}
+ /// <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;
+ }
+
private static string getWebReference(ProjectItem projectItem)
{
string projectPath = Path.GetDirectoryName(projectItem.ContainingProject.FullName);
string path = projectPath + "\\" + Messages.MSG_D_WEB_REF + "\\" + projectItem.Name;
- string[] files = Directory.GetFiles(path, "*.wsdl");
-
- if (files.Length > 0)
+ if (Directory.Exists(path))
{
- return Path.GetFileName(files[0]);
+ string[] files = Directory.GetFiles(path, "*.wsdl");
+
+ if (files.Length > 0)
+ {
+ return Path.GetFileName(files[0]);
+ }
}
+
return null;
}
@@ -738,7 +758,7 @@
if (pReference.Type == prjReferenceType.prjReferenceTypeActiveX)
{
refType = "com_reference";
- if (refName.ToLower().StartsWith("interop."))
+ if (refName.ToLower().StartsWith("interop.", true, CultureInfo.InvariantCulture))
refName = refName.Substring(8);
refToken = pReference.Identity.Substring(0, pReference.Identity.LastIndexOf(@"\")).Replace("\\", "-");
refGroupId = refName;
@@ -752,8 +772,18 @@
{
if (a.Location.ToLower().IndexOf(@"\gac_32\") >= 0)
refType = "gac_32";
+ else if (a.Location.ToLower().IndexOf(@"\gac_64\") >= 0)
+ refType = "gac_64";
else if (a.Location.ToLower().IndexOf(@"\gac\") >= 0)
refType = "gac";
+ else if (a.Location.ToLower().IndexOf(@"\gac-msil4\") >= 0)
+ refType = "gac-msil4";
+ else if (a.Location.ToLower().IndexOf(@"\gac-32-4\") >= 0)
+ refType = "gac-32-4";
+ else if (a.Location.ToLower().IndexOf(@"\gac-64-4\") >= 0)
+ refType = "gac-64-4";
+ else if (a.Location.ToLower().IndexOf(@"\gac-msil\") >= 0)
+ refType = "gac-msil";
if (!a.GlobalAssemblyCache)
{
@@ -1307,7 +1337,7 @@
PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, pReference.ContainingProject);
string refName = pReference.Name;
- if (pReference.Type == prjReferenceType.prjReferenceTypeActiveX && refName.ToLower().StartsWith("interop."))
+ if (pReference.Type == prjReferenceType.prjReferenceTypeActiveX && refName.ToLower().StartsWith("interop.", true, CultureInfo.InvariantCulture))
refName = refName.Substring(8);
pomUtil.RemovePomDependency(refName);
diff --git a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/FolderWatcher.cs b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/FolderWatcher.cs
index c1c4af8..73d5cab 100644
--- a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/FolderWatcher.cs
+++ b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/FolderWatcher.cs
@@ -15,7 +15,7 @@
foreach (string f in Directory.GetFiles(referenceDirectory))
{
string fext = Path.GetExtension(f).ToLower();
- if (fext.Equals(".map") || fext.Equals(".discomap"))
+ if (fext.Equals(".map", StringComparison.InvariantCultureIgnoreCase) || fext.Equals(".discomap", StringComparison.InvariantCultureIgnoreCase))
{
fname = f;
break;
@@ -31,7 +31,7 @@
foreach (string f in Directory.GetFiles(referenceDirectory))
{
string fext = Path.GetExtension(f).ToLower();
- if (fext.Equals(".wsdl"))
+ if (fext.Equals(".wsdl", StringComparison.InvariantCultureIgnoreCase))
{
fname = f;
break;
@@ -265,7 +265,7 @@
public void Init(string wsPath)
{
- if (!this.referenceDirectory.Equals(Path.Combine(wsPath, this.Name)))
+ if (!this.referenceDirectory.Equals(Path.Combine(wsPath, this.Name), StringComparison.InvariantCultureIgnoreCase))
{
this.referenceDirectory = Path.Combine(wsPath, this.Name);
}
diff --git a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.Designer.cs b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.Designer.cs
index a744f62..875b211 100644
--- a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.Designer.cs
+++ b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.Designer.cs
@@ -37,6 +37,8 @@
this.txtGroupId = new System.Windows.Forms.TextBox();
this.lblSCM = new System.Windows.Forms.Label();
this.txtSCMTag = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtVersion = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnBrowse
@@ -71,7 +73,7 @@
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(450, 76);
+ this.btnCancel.Location = new System.Drawing.Point(451, 107);
this.btnCancel.Margin = new System.Windows.Forms.Padding(2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(64, 21);
@@ -82,7 +84,7 @@
//
// btnGenerate
//
- this.btnGenerate.Location = new System.Drawing.Point(343, 76);
+ this.btnGenerate.Location = new System.Drawing.Point(341, 107);
this.btnGenerate.Margin = new System.Windows.Forms.Padding(2);
this.btnGenerate.Name = "btnGenerate";
this.btnGenerate.Size = new System.Drawing.Size(104, 21);
@@ -124,16 +126,35 @@
this.txtSCMTag.Size = new System.Drawing.Size(396, 20);
this.txtSCMTag.TabIndex = 13;
this.txtSCMTag.Text = "<OPTIONAL: svn url>";
- this.txtSCMTag.DoubleClick += new System.EventHandler(this.txtSCMTag_DoubleClick);
- this.txtSCMTag.TextChanged += new System.EventHandler(this.txtSCMTag_TextChanged);
this.txtSCMTag.Click += new System.EventHandler(this.txtSCMTag_Click);
+ this.txtSCMTag.TextChanged += new System.EventHandler(this.txtSCMTag_TextChanged);
+ this.txtSCMTag.DoubleClick += new System.EventHandler(this.txtSCMTag_DoubleClick);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(10, 110);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(45, 13);
+ this.label2.TabIndex = 14;
+ this.label2.Text = "Version:";
+ //
+ // txtVersion
+ //
+ this.txtVersion.Location = new System.Drawing.Point(118, 107);
+ this.txtVersion.Margin = new System.Windows.Forms.Padding(2);
+ this.txtVersion.Name = "txtVersion";
+ this.txtVersion.Size = new System.Drawing.Size(171, 20);
+ this.txtVersion.TabIndex = 15;
//
// NPandayImportProjectForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(526, 107);
+ this.ClientSize = new System.Drawing.Size(526, 136);
this.ControlBox = false;
+ this.Controls.Add(this.txtVersion);
+ this.Controls.Add(this.label2);
this.Controls.Add(this.txtSCMTag);
this.Controls.Add(this.lblSCM);
this.Controls.Add(this.txtGroupId);
@@ -164,5 +185,7 @@
private System.Windows.Forms.TextBox txtGroupId;
private System.Windows.Forms.Label lblSCM;
private System.Windows.Forms.TextBox txtSCMTag;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtVersion;
}
}
diff --git a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.cs b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.cs
index 85bd34c..53f58d7 100644
--- a/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.cs
+++ b/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandayImportProjectForm.cs
@@ -7,7 +7,7 @@
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
-
+using System.Xml.XPath;
using Extensibility;
using EnvDTE;
using EnvDTE80;
@@ -60,12 +60,34 @@
groupId = ConvertToPascalCase(groupId);
groupId = FilterID(groupId) + "." + FilterID(ConvertToPascalCase(new FileInfo(applicationObject.Solution.FileName).Name.Replace(".sln", "")));
txtGroupId.Text = groupId;
- string scmTag = getSCMTag(applicationObject.Solution.FileName);
- if(scmTag!=string.Empty && scmTag!=null)
+ string scmTag = string.Empty; //getSCMTag(applicationObject.Solution.FileName);
+ string version = "1.0-SNAPSHOT";
+ string pomFilePath = applicationObject.Solution.FileName.Substring(0, applicationObject.Solution.FileName.LastIndexOf("\\"));
+ pomFilePath += "\\pom.xml";
+ if (File.Exists(pomFilePath))
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load(pomFilePath);
+ System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(doc.NameTable);
+ xmlnsManager.AddNamespace("pom", "http://maven.apache.org/POM/4.0.0");
+ XmlNode node = doc.SelectSingleNode("/pom:project/pom:scm/pom:developerConnection", xmlnsManager);
+ if (node != null)
+ {
+ scmTag = node.InnerText;
+ }
+ node = doc.SelectSingleNode("/pom:project/pom:version", xmlnsManager);
+ if (node != null)
+ {
+ version = node.InnerText;
+ }
+ }
+
+ if(! string.IsNullOrEmpty(scmTag))
{
txtSCMTag.Text = scmTag;
}
+ txtVersion.Text = version;
}
catch { /*do nothing*/}
@@ -130,42 +152,6 @@
}
- private string getSCMTag(string filePath)
- {
- string pomFilePath = string.Empty;
- string scmTag = string.Empty;
- try
- {
-
- //construct the path for the pom file and check for file existance.
- //return if file does not exist.
- pomFilePath = filePath.Substring(0, filePath.LastIndexOf("\\"));
- pomFilePath += "\\pom.xml";
- if (!File.Exists(pomFilePath))
- {
- return scmTag;
- }
-
- XmlDocument doc = new XmlDocument();
- doc.Load(pomFilePath);
-
- XmlNodeList devCon = doc.GetElementsByTagName("developerConnection");
-
- foreach (XmlNode item in devCon)
- {
- scmTag = item.InnerText;
- }
-
-
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
-
- return scmTag;
- }
-
private void btnGenerate_Click(object sender, EventArgs e)
{
string warningMsg = string.Empty;
@@ -182,6 +168,7 @@
//string groupId = FilterID(ConvertToPascalCase(txtGroupId.Text));
string groupId = FilterID(txtGroupId.Text);
string scmTag = txtSCMTag.Text;
+ string version = txtVersion.Text;
if (scmTag == null)
{
@@ -231,7 +218,7 @@
validateSolutionStructure();
resyncAllArtifacts();
- string[] generatedPoms = ProjectImporter.NPandayImporter.ImportProject(file.FullName, groupId, artifactId, "1.0-SNAPSHOT", scmTag, true, ref warningMsg);
+ string[] generatedPoms = ProjectImporter.NPandayImporter.ImportProject(file.FullName, groupId, artifactId, version, scmTag, true, ref warningMsg);
string str = string.Format("NPanday Import Project has Successfully Generated Pom Files!\n");
foreach (string pom in generatedPoms)
diff --git a/misc/npanday-installer/src/main/groovy/generateWxs.groovy b/misc/npanday-installer/src/main/groovy/generateWxs.groovy
index 5967ae9..9444b40 100644
--- a/misc/npanday-installer/src/main/groovy/generateWxs.groovy
+++ b/misc/npanday-installer/src/main/groovy/generateWxs.groovy
@@ -8,7 +8,7 @@
def repositoryComponentIds = []
def repositoryBasedir = new File(project.build.directory + "/repository/releases");
def generateGuid = { "{"+java.util.UUID.randomUUID().toString().toUpperCase() + "}" }
-def visualStudioVersions = ['2005', '2008']
+def visualStudioVersions = ['2005', '2008', '2010']
def addinArtifacts = []
new File(project.build.directory + "/addin").eachFile { addinArtifacts << it }
@@ -39,8 +39,13 @@
Property(Id:"VS2008INSTALLED") {
RegistrySearch(Id:"VS2008INSTALLED", Root:"HKCR", Key:"VisualStudio.DTE.9.0", Type: "raw")
}
+ Property(Id:"VS2010INSTALLED") {
+ RegistrySearch(Id:"VS2010INSTALLED", Root:"HKCR", Key:"VisualStudio.DTE.10.0", Type: "raw")
+ }
Condition(Message:"NPanday cannot be installed on Windows 9x/ME", "VersionNT")
+ Condition(Message:"You need to be an administrator to install this product.", "AdminUser")
+
// TODO: check .NET version -- see http://wix.sourceforge.net/manual-wix3/check_for_dotnet.htm
// need to decide on best approach here - require .NET 3.5 SP1 + Windows 6.0A SDK for VS2008 installation feature, and lower for the others?
@@ -107,12 +112,16 @@
Source:"${project.basedir}/src/main/wix/NPanday.VisualStudio.Addin")
'util:XmlFile'(Id:"VS${vs}XmlModifyAssembly", Action:"setValue",
ElementPath:"/Extensibility/Addin/Assembly",
- File:"[VS${vs}Addin]\\NPanday.VisualStudio.Addin",
+ File:"[VS${vs}Addin]NPanday.VisualStudio.Addin",
Value:"[BinDir]NPanday.VisualStudio.Addin.dll")
'util:XmlFile'(Id:"VS${vs}XmlModifyDescription", Action:"setValue",
ElementPath:"/Extensibility/Addin/Description",
- File:"[VS${vs}Addin]\\NPanday.VisualStudio.Addin",
+ File:"[VS${vs}Addin]NPanday.VisualStudio.Addin",
Value:"${project.description}")
+ 'util:XmlFile'(Id:"VS${vs}XmlModifyFriendlyName", Action:"setValue",
+ ElementPath:"/Extensibility/Addin/FriendlyName",
+ File:"[VS${vs}Addin]NPanday.VisualStudio.Addin",
+ Value:"NPanday ${pom.version} Maven in .NET Applications")
}
}
}
diff --git a/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java b/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
index fa9a8ea..42096e4 100644
--- a/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
+++ b/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
@@ -155,6 +155,13 @@
*/
private String nunitCommand;
+ /**
+ * The framework version to run the tests: 1.1, 2.0, 3.5, 4.0
+ *
+ * @parameter expression = "${executionFrameworkVersion}"
+ */
+ private String executionFrameworkVersion;
+
private String getExecutableFor( VendorInfo vendorInfo )
{
String exe;
@@ -357,7 +364,7 @@
VendorInfo vendorInfo = VendorInfo.Factory.createDefaultVendorInfo();
getLog().debug( "NPANDAY-1100-014.1: Vendor info:" + vendorInfo );
vendorInfo.setVendorVersion( "" );
- vendorInfo.setFrameworkVersion( null );
+ vendorInfo.setFrameworkVersion( executionFrameworkVersion );
getLog().debug( "NPANDAY-1100-014.2: Vendor info:" + vendorInfo );
try