You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2012/02/09 08:14:23 UTC

svn commit: r1242234 - in /incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src: main/csharp/Converter/Algorithms/ test/resource/WpfApplication1/WpfApplication1/

Author: brett
Date: Thu Feb  9 08:14:22 2012
New Revision: 1242234

URL: http://svn.apache.org/viewvc?rev=1242234&view=rev
Log:
[NPANDAY-539] make sure that resources generated for WPF projects are included in the final executable

Modified:
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AbstractPomConverter.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/NormalPomConverter.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/pom.test

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AbstractPomConverter.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AbstractPomConverter.cs?rev=1242234&r1=1242233&r2=1242234&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AbstractPomConverter.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AbstractPomConverter.cs Thu Feb  9 08:14:22 2012
@@ -142,9 +142,14 @@ namespace NPanday.ProjectImporter.Conver
 
 
         }
-        
+
         protected void AddEmbeddedResources()
         {
+            AddEmbeddedResources(new List<Dictionary<string, string>>());
+        }
+
+        protected void AddEmbeddedResources(List<Dictionary<string,string>> generatedResourceList)
+        {
             if (projectDigest != null && projectDigest.EmbeddedResources != null && projectDigest.EmbeddedResources.Length > 0)
             {
                 Plugin embeddedResourcePlugin = AddPlugin(
@@ -156,20 +161,18 @@ namespace NPanday.ProjectImporter.Conver
 
 
                 List<Dictionary<string, string>> embeddedResourceList = new List<Dictionary<string, string>>();
+                embeddedResourceList.AddRange(generatedResourceList);
+
                 List<string> resourceList = new List<string>();   
                 foreach (EmbeddedResource embeddedResource in projectDigest.EmbeddedResources)
                 {
                     if (isResgenSupported(embeddedResource.IncludePath))
                     {
-                        Dictionary<string, string> value = new Dictionary<string, string>();
                         string sourceFile = embeddedResource.IncludePath;
                         if (sourceFile == null)
                             continue;
 
-                        value.Add("sourceFile", sourceFile);
-                        value.Add("name", parseEmbeddedName(projectDigest.RootNamespace, sourceFile));
-
-                        embeddedResourceList.Add(value);
+                        embeddedResourceList.Add(createResourceEntry(sourceFile, parseEmbeddedName(projectDigest.RootNamespace, sourceFile)));
                     }
                     else
                     {
@@ -187,6 +190,14 @@ namespace NPanday.ProjectImporter.Conver
             }
         }
 
+        protected Dictionary<string, string> createResourceEntry(string sourceFile, string name)
+        {
+            Dictionary<string, string> value = new Dictionary<string, string>();
+            value.Add("sourceFile", sourceFile);
+            value.Add("name", name);
+            return value;
+        }
+
         string parseEmbeddedName(string nameSpace, string sourceFilePath)
         {
             string returnVal = string.Empty;

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/NormalPomConverter.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/NormalPomConverter.cs?rev=1242234&r1=1242233&r2=1242234&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/NormalPomConverter.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/NormalPomConverter.cs Thu Feb  9 08:14:22 2012
@@ -108,8 +108,9 @@ namespace NPanday.ProjectImporter.Conver
 
             // add include list for the compiling
             DirectoryInfo baseDir = new DirectoryInfo(Path.GetDirectoryName(projectDigest.FullFileName));
+            List<Dictionary<string, string>> generatedResourceList = new List<Dictionary<string, string>>();
             List<string> compiles = new List<string>();
-            bool msBuildPluginAdded = false;
+            bool msBuildPluginAdded = false, resourceAdded = false;
             foreach (Compile compile in projectDigest.Compiles)
             {
                 string compilesFile = PomHelperUtility.GetRelativePath(baseDir, new FileInfo(compile.IncludeFullPath));
@@ -127,34 +128,34 @@ namespace NPanday.ProjectImporter.Conver
                         msBuildPluginAdded = true;
                     }                    
 
-                    string gFile;
+                    string prefix;
                     //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\";
+                            prefix = @"obj\Debug\";
                             break;
                         case "x64":
-                            gFile = @"obj\x64\Debug\";
+                            prefix = @"obj\x64\Debug\";
                             break;
                         case "x86":
-                            gFile = @"obj\x86\Debug\";
+                            prefix = @"obj\x86\Debug\";
                             break;
                         case "Itanium":
-                            gFile = @"obj\Itanium\Debug\";
+                            prefix = @"obj\Itanium\Debug\";
                             break;
                         default:
-                            gFile = @"obj\Debug\";
+                            prefix = @"obj\Debug\";
                             break;
                     }
-                    if (compilesFile.EndsWith(".cs"))
-                        gFile += compilesFile.Replace(".xaml.cs", ".g.cs");
-                    else
-                        gFile += compilesFile.Replace(".xaml.vb", ".g.vb");
-
-                    string gFullPath = compile.IncludeFullPath.Replace(compilesFile, gFile);
-                    
-                    compiles.Add(gFile);
+                    string sub = compilesFile.Substring(compilesFile.Length - 3);
+                    compiles.Add(prefix + compilesFile.Replace(".xaml" + sub, ".g" + sub));
+
+                    if (!resourceAdded)
+                    {
+                        generatedResourceList.Add(createResourceEntry(prefix + projectDigest.RootNamespace + ".g.resources", projectDigest.RootNamespace + ".g"));
+                        resourceAdded = true;
+                    }
                 }
             }
             AddPluginConfiguration(compilePlugin, "includeSources", "includeSource", compiles.ToArray());
@@ -205,7 +206,7 @@ namespace NPanday.ProjectImporter.Conver
             AddWebReferences();
 
             //Add EmbeddedResources maven-resgen-plugin
-            AddEmbeddedResources();
+            AddEmbeddedResources(generatedResourceList);
             
 
             // Add Project Inter-dependencies

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/pom.test
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/pom.test?rev=1242234&r1=1242233&r2=1242234&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/pom.test (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/pom.test Thu Feb  9 08:14:22 2012
@@ -52,6 +52,10 @@
         <configuration>
           <embeddedResources>
             <embeddedResource>
+              <sourceFile>obj\x86\Debug\WpfApplication1.g.resources</sourceFile>
+              <name>WpfApplication1.g</name>
+            </embeddedResource>
+            <embeddedResource>
               <sourceFile>Properties\Resources.resx</sourceFile>
               <name>WpfApplication1.Properties.Resources</name>
             </embeddedResource>