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 10:43:59 UTC
svn commit: r1242267 - in /incubator/npanday/trunk:
dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/
dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/WpfApplication1/WpfApplication1/
plugins/netpl...
Author: brett
Date: Thu Feb 9 10:43:58 2012
New Revision: 1242267
URL: http://svn.apache.org/viewvc?rev=1242267&view=rev
Log:
[NPANDAY-539] Revise solution - ensure resources are all copied in multi-module and CPU-based projects, instead of adding extra resources to the resgen configuration
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
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
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=1242267&r1=1242266&r2=1242267&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 10:43:58 2012
@@ -142,14 +142,9 @@ 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(
@@ -161,18 +156,20 @@ 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;
- embeddedResourceList.Add(createResourceEntry(sourceFile, parseEmbeddedName(projectDigest.RootNamespace, sourceFile)));
+ value.Add("sourceFile", sourceFile);
+ value.Add("name", parseEmbeddedName(projectDigest.RootNamespace, sourceFile));
+
+ embeddedResourceList.Add(value);
}
else
{
@@ -190,14 +187,6 @@ 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=1242267&r1=1242266&r2=1242267&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 10:43:58 2012
@@ -108,9 +108,8 @@ 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, resourceAdded = false;
+ bool msBuildPluginAdded = false;
foreach (Compile compile in projectDigest.Compiles)
{
string compilesFile = PomHelperUtility.GetRelativePath(baseDir, new FileInfo(compile.IncludeFullPath));
@@ -120,42 +119,38 @@ namespace NPanday.ProjectImporter.Conver
if (compilesFile.EndsWith(".xaml.cs") || compilesFile.EndsWith(".xaml.vb"))
{
//add the MsBuild plugin to auto generate the .g.cs/g.vb files
+ string platform = null;
+ // ignore AnyCPU or unknown values
+ if (projectDigest.Platform == "x64" || projectDigest.Platform == "x86" || projectDigest.Platform == "Itanium")
+ platform = projectDigest.Platform;
+
+ // TODO: support others
+ string configuration = "Debug";
+
if (!msBuildPluginAdded)
{
Plugin msBuildPlugin = AddPlugin("org.apache.npanday.plugins", "NPanday.Plugin.Msbuild.JavaBinding", null, false);
AddPluginExecution(msBuildPlugin, "compile", "validate");
AddPluginConfiguration(msBuildPlugin, "frameworkVersion", ProjectDigest.TargetFramework);
+ if (platform != null)
+ AddPluginConfiguration(msBuildPlugin, "platform", platform);
+ if (configuration != null && configuration != "Debug")
+ AddPluginConfiguration(msBuildPlugin, "configuration", configuration);
msBuildPluginAdded = true;
}
- 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":
- prefix = @"obj\Debug\";
- break;
- case "x64":
- prefix = @"obj\x64\Debug\";
- break;
- case "x86":
- prefix = @"obj\x86\Debug\";
- break;
- case "Itanium":
- prefix = @"obj\Itanium\Debug\";
- break;
- default:
- prefix = @"obj\Debug\";
- break;
- }
- string sub = compilesFile.Substring(compilesFile.Length - 3);
- compiles.Add(prefix + compilesFile.Replace(".xaml" + sub, ".g" + sub));
+ string gFile = "obj";
+ if (platform != null)
+ gFile += "\\" + platform;
+ gFile += "\\" + configuration + "\\";
+
+ if (compilesFile.EndsWith(".cs"))
+ gFile += compilesFile.Replace(".xaml.cs", ".g.cs");
+ else
+ gFile += compilesFile.Replace(".xaml.vb", ".g.vb");
- if (!resourceAdded)
- {
- generatedResourceList.Add(createResourceEntry(prefix + projectDigest.RootNamespace + ".g.resources", projectDigest.RootNamespace + ".g"));
- resourceAdded = true;
- }
+ compiles.Add(gFile);
}
}
AddPluginConfiguration(compilePlugin, "includeSources", "includeSource", compiles.ToArray());
@@ -206,7 +201,7 @@ namespace NPanday.ProjectImporter.Conver
AddWebReferences();
//Add EmbeddedResources maven-resgen-plugin
- AddEmbeddedResources(generatedResourceList);
+ AddEmbeddedResources();
// 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=1242267&r1=1242266&r2=1242267&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 10:43:58 2012
@@ -52,10 +52,6 @@
<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>
Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java?rev=1242267&r1=1242266&r2=1242267&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java (original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java Thu Feb 9 10:43:58 2012
@@ -100,6 +100,16 @@ public class MsbuildMojo
private File referencesDirectory;
/**
+ * @parameter default-value="Debug"
+ */
+ private String configuration;
+
+ /**
+ * @parameter
+ */
+ private String platform;
+
+ /**
* @parameter default-value="true"
*/
private boolean copyReferences = true;
@@ -208,9 +218,16 @@ public class MsbuildMojo
}
// #12549 - add resources generated by MSBuild to the project
- // TODO: should be configurable?
+ String directory = new File( project.getBasedir(), "obj" ).getAbsolutePath();
+ if ( platform != null )
+ {
+ directory += "/" + platform;
+ }
+ directory += "/" + configuration;
+
+ getLog().info( "Adding resources from " + directory + " generated by MSBuild" );
Resource resource = new Resource();
- resource.setDirectory( "obj/Debug" );
+ resource.setDirectory( directory );
resource.addInclude( "**/*.resources" );
project.addResource( resource );