aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1589560 - in /aries/trunk/esa-maven-plugin/src: main/java/org/apache/aries/plugin/esa/EsaMojo.java test/java/org/apache/aries/plugin/esa/EsaMojoTest.java test/resources/unit/basic-esa-custom-instructions/plugin-config.xml
Date Thu, 24 Apr 2014 03:12:49 GMT
Author: gawor
Date: Thu Apr 24 03:12:49 2014
New Revision: 1589560

URL: http://svn.apache.org/r1589560
Log:
ARIES-1176: Override subsystem name and description

Modified:
    aries/trunk/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java
    aries/trunk/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java
    aries/trunk/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml

Modified: aries/trunk/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java
URL: http://svn.apache.org/viewvc/aries/trunk/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java?rev=1589560&r1=1589559&r2=1589560&view=diff
==============================================================================
--- aries/trunk/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java (original)
+++ aries/trunk/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java Thu
Apr 24 03:12:49 2014
@@ -419,9 +419,11 @@ public class EsaMojo
                     + getSubsystemSymbolicName(project.getArtifact()) + "\n");
             FileUtils.fileAppend(fileName, SUBSYSTEM_VERSION + ": "
                     + getSubsystemVersion() + "\n");
-            FileUtils.fileAppend(fileName, SUBSYSTEM_NAME + ": " + project.getName() + "\n");
-            FileUtils.fileAppend(fileName, SUBSYSTEM_DESCRIPTION + ": "
-                    + project.getDescription() + "\n");
+            FileUtils.fileAppend(fileName, SUBSYSTEM_NAME + ": " + getSubsystemName() + "\n");
+            String description = getSubsystemDescription();
+            if (description != null) {
+                FileUtils.fileAppend(fileName, SUBSYSTEM_DESCRIPTION + ": " + description
+ "\n");
+            }
 
             // Write the SUBSYSTEM-CONTENT
             // TODO: check that the dependencies are bundles (currently, the converter
@@ -497,6 +499,20 @@ public class EsaMojo
         return aQute.lib.osgi.Analyzer.cleanupVersion(project.getVersion());
     }
     
+    private String getSubsystemName() {
+        if (instructions.containsKey(SUBSYSTEM_NAME)) {
+            return instructions.get(SUBSYSTEM_NAME).toString();
+        }
+        return project.getName();
+    }
+    
+    private String getSubsystemDescription() {
+        if (instructions.containsKey(SUBSYSTEM_DESCRIPTION)) {
+            return instructions.get(SUBSYSTEM_DESCRIPTION).toString();
+        }
+        return project.getDescription();
+    }
+    
     private File getBuildDir() {
         if (buildDir == null) {
             buildDir = new File(workDirectory);

Modified: aries/trunk/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java?rev=1589560&r1=1589559&r2=1589560&view=diff
==============================================================================
--- aries/trunk/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java
(original)
+++ aries/trunk/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java
Thu Apr 24 03:12:49 2014
@@ -498,6 +498,9 @@ public class EsaMojoTest
 
         // Test for the MyHeader header
         testForHeader(esa, "MyHeader", "MyHeader: myValue");
+        
+        // Test for the Subsystem-Name header
+        testForHeader(esa, "Subsystem-Name", "Subsystem-Name: myName");
     }
 
     private int getSizeOfExpectedFiles( Enumeration entries, List expectedFiles )

Modified: aries/trunk/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml
URL: http://svn.apache.org/viewvc/aries/trunk/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml?rev=1589560&r1=1589559&r2=1589560&view=diff
==============================================================================
--- aries/trunk/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml
(original)
+++ aries/trunk/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml
Thu Apr 24 03:12:49 2014
@@ -29,6 +29,7 @@ under the License.
              <Subsystem-Type>feature</Subsystem-Type>
              <MyHeader>myValue</MyHeader>
              <Foo>bar</Foo>
+             <Subsystem-Name>myName</Subsystem-Name>
           </instructions>
           <addMavenDescriptor>false</addMavenDescriptor>
           <includeEmptyDirs>true</includeEmptyDirs>



Mime
View raw message