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 ma...@apache.org on 2012/01/10 15:07:59 UTC
svn commit: r1229583 - in /incubator/npanday/branches/NPANDAY-529:
components/dotnet-assembler/src/main/java/npanday/assembler/
components/dotnet-assembler/src/main/java/npanday/assembler/impl/
plugins/maven-compile-plugin/src/main/java/npanday/plugin/...
Author: matzew
Date: Tue Jan 10 15:07:59 2012
New Revision: 1229583
URL: http://svn.apache.org/viewvc?rev=1229583&view=rev
Log:
Committing first round of work for NPANDAY-529
Modified:
incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/AssemblyInfo.java
incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/impl/DefaultAssemblyInfoMarshaller.java
incubator/npanday/branches/NPANDAY-529/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java
Modified: incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/AssemblyInfo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/AssemblyInfo.java?rev=1229583&r1=1229582&r2=1229583&view=diff
==============================================================================
--- incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/AssemblyInfo.java (original)
+++ incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/AssemblyInfo.java Tue Jan 10 15:07:59 2012
@@ -89,7 +89,12 @@ public class AssemblyInfo
private Map<String, String> customStringAttributes;
- private static final Map<String, String> EMPTY_CUSTOM_STRING_ATTRIBUTES = Collections.emptyMap();;
+ private static final Map<String, String> EMPTY_CUSTOM_STRING_ATTRIBUTES = Collections.emptyMap();
+
+ private Map<String, String> assemblyAttributes;
+
+ private static final Map<String, String> EMPTY_ASSEMBLY_ATTRIBUTES = Collections.emptyMap();
+
/**
* Default constructor
@@ -260,6 +265,16 @@ public class AssemblyInfo
{
this.customStringAttributes = attributes;
}
+
+ public Map<String, String> getAssemblyAttributes()
+ {
+ return (assemblyAttributes != null) ? assemblyAttributes : EMPTY_ASSEMBLY_ATTRIBUTES;
+ }
+
+ public void setAssemblyAttributes(Map<String, String> assemblyAttributes)
+ {
+ this.assemblyAttributes = assemblyAttributes;
+ }
public boolean equals( Object o )
{
Modified: incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/impl/DefaultAssemblyInfoMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/impl/DefaultAssemblyInfoMarshaller.java?rev=1229583&r1=1229582&r2=1229583&view=diff
==============================================================================
--- incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/impl/DefaultAssemblyInfoMarshaller.java (original)
+++ incubator/npanday/branches/NPANDAY-529/components/dotnet-assembler/src/main/java/npanday/assembler/impl/DefaultAssemblyInfoMarshaller.java Tue Jan 10 15:07:59 2012
@@ -32,6 +32,7 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.util.StringTokenizer;
import java.util.Map.Entry;
import org.apache.maven.project.MavenProject;
@@ -95,6 +96,27 @@ final class DefaultAssemblyInfoMarshalle
sb.append( ")]" ).append("\r\n" );
}
+ for(Entry<String, String> e: assemblyInfo.getAssemblyAttributes().entrySet()) {
+ if(StringUtils.isEmpty(e.getValue()))
+ continue;
+
+ // get all values per key (e.g. "A;B;C")
+ String valuesPerElement = e.getValue();
+
+ StringTokenizer st = new StringTokenizer(valuesPerElement, ";");
+
+ while (st.hasMoreTokens()) {
+ // each value will be assigned to the enclosing key/element
+ sb.append( "[assembly: ")
+ .append(e.getKey())
+ .append("(\"")
+ .append(st.nextToken())
+ .append("\")]")
+ .append("\r\n" );
+ }
+ }
+
+
boolean wroteCustomStringAttribute = false;
for(Entry<String, String> e: assemblyInfo.getCustomStringAttributes().entrySet()) {
if(StringUtils.isEmpty(e.getValue()))
Modified: incubator/npanday/branches/NPANDAY-529/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/NPANDAY-529/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java?rev=1229583&r1=1229582&r2=1229583&view=diff
==============================================================================
--- incubator/npanday/branches/NPANDAY-529/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java (original)
+++ incubator/npanday/branches/NPANDAY-529/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java Tue Jan 10 15:07:59 2012
@@ -19,26 +19,26 @@ package npanday.plugin.compile;
* under the License.
*/
-import npanday.ArtifactTypeHelper;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.IOException;
import java.io.File;
-import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import npanday.InitializationException;
-import npanday.PlatformUnsupportedException;
-import npanday.vendor.*;
+import npanday.ArtifactTypeHelper;
import npanday.assembler.AssemblerContext;
-import npanday.assembler.AssemblyInfoMarshaller;
-import npanday.assembler.AssemblyInfoException;
import npanday.assembler.AssemblyInfo;
+import npanday.assembler.AssemblyInfoException;
+import npanday.assembler.AssemblyInfoMarshaller;
+import npanday.vendor.Vendor;
+import npanday.vendor.VendorFactory;
+import npanday.vendor.VendorInfo;
+import npanday.vendor.VendorUnsupportedException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
/**
* Generates an AssemblyInfo.* class based on information within the pom file.
@@ -128,6 +128,11 @@ public class AssemblyInfoGeneratorMojo
protected Map assemblyInfo = new HashMap();
/**
+ * @parameter
+ */
+ protected Map assemblyAttributes = new HashMap();
+
+ /**
* If an AssemblyInfo file exists in the source directory, then this method will not generate an AssemblyInfo.
*
* @throws MojoExecutionException
@@ -183,6 +188,9 @@ public class AssemblyInfoGeneratorMojo
AssemblyInfo assemblyInfo = assemblerContext.getAssemblyInfo();
assemblyInfo.setCustomStringAttributes(this.assemblyInfo);
+ // apply the custom attributes :
+ assemblyInfo.setAssemblyAttributes(this.assemblyAttributes);
+
try
{
stateMachineProcessor.process( vendorInfo );