incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1405921 - in /incubator/easyant/plugins/trunk/manifest/src: main/resources/manifest.ant test/antunit/manifest-test.xml
Date Mon, 05 Nov 2012 18:55:25 GMT
Author: jlboudart
Date: Mon Nov  5 18:55:25 2012
New Revision: 1405921

URL: http://svn.apache.org/viewvc?rev=1405921&view=rev
Log:
Make manifest plugin less dependent of retrieve.dependencies property
Don't fail if no dependencies was found

Modified:
    incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant
    incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml

Modified: incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant?rev=1405921&r1=1405920&r2=1405921&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant (original)
+++ incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant Mon Nov  5 18:55:25
2012
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<project name="org.apache.easyant.plugins#manifest" xmlns:ea="antlib:org.apache.easyant">
+<project name="org.apache.easyant.plugins#manifest" xmlns:ea="antlib:org.apache.easyant"
xmlns:ac="antlib:net.sf.antcontrib">
     <ea:core-version requiredrevision="[0.9,+]" />
     <ea:import mrid="org.apache.easyant.plugins#abstract-provisioning;0.9" />
 
@@ -22,9 +22,12 @@
         <ea:parameter property="project.main.classname"
             description="Used to define the project main class. The mainclass will then be
used by many plugins (manifest, run-java, etc...)" />
         <ea:parameter property="manifest.main.classname" default="${project.main.classname}">
-            If defined, Main-Class and Class-Path attributes are added to produce an executable
jar file.
-            By default this property take the same value as 'project.main.classname' property.
-            If you are looking for a way to reference your mainclass one time for all plugins
you should set project.main.classname
+            If defined, Main-Class and Class-Path
+            attributes are added to produce an executable jar file.
+            By default this property take the same value as
+            'project.main.classname' property.
+            If you are looking for a way to reference your mainclass one time for all
+            plugins you should set project.main.classname
             instead.
         </ea:parameter>
         <ea:parameter property="manifest.classpath" required="false"
@@ -83,15 +86,22 @@
     <!-- currently this target is only available if we use retrieve.dependencies=true
because manifestclasspath is excepting a relative based structure which is not really usable
using the ivy cache for example -->
     <target name="manifest:manifest-runnable" depends="manifest:manifest" description="add
manifest attributes required for an executable jar"
         if="is.manifest.runnable">
-        <condition property="is.retrieve.dependencies.enabled">
-            <istrue value="${retrieve.dependencies}" />
-        </condition>
-        <fail unless="is.retrieve.dependencies.enabled"
-            message="manifest runnable feature can only be used if your the property retrieve.dependencies
is enabled" />
+        <fileset id="lib.main.fileset" dir="${lib.main}" erroronmissingdir="false">
+            <include name="*.jar" />
+        </fileset>
+
+        <ac:if>
+            <length length="0">
+                <fileset refid="lib.main.fileset" />
+            </length>
+            <ac:then>
+                <echo level="warn"
+                    message="no dependencies found in ${lib.main}, will not be able to set
Classpath attribute correctly" />
+            </ac:then>
+        </ac:if>
+
         <path id="manifest.main.classpath">
-            <fileset id="lib.main.fileset" dir="${lib.main}">
-                <include name="*.jar" />
-            </fileset>
+            <fileset refid="lib.main.fileset" />
         </path>
 
         <!-- create the target artifact dir if it does not exists -->
@@ -105,4 +115,4 @@
             <attribute name="Class-Path" value="${manifest.classpath}" />
         </manifest>
     </target>
-</project>
\ No newline at end of file
+</project>

Modified: incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml?rev=1405921&r1=1405920&r2=1405921&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml (original)
+++ incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml Mon Nov  5
18:55:25 2012
@@ -64,15 +64,24 @@
     </target>
 
     <target name="prepare-manifest-runnable">
-        <property name="retrieve.dependencies" value="true" />
         <property name="project.main.classname" value="foobar" />
         <mkdir dir="${lib.main}" />
         <echo file="${lib.main}/myjar.jar" />
     </target>
     
     <target name="test-manifest:manifest-runnable" depends="prepare-manifest-runnable,
manifest:manifest-runnable">
-        <!--FIXME: manifest-runable fails if ${lib.main} doesn't exists -->
+        <au:assertLogDoesntContain text="no dependencies found in ${lib.main}, will not
be able to set Classpath attribute correctly" level="warn"/>
         <au:assertReferenceSet refid="manifest.main.classpath" />
         <au:assertPropertyEquals name="manifest.classpath" value="lib/main/myjar.jar"
/>
     </target>
+    
+    <target name="prepare-manifest-runnable-without-dependencies">
+        <property name="project.main.classname" value="foobar" />
+    </target>
+    
+    <target name="test-manifest:manifest-runnable-without-dependecies" depends="prepare-manifest-runnable-without-dependencies,
manifest:manifest-runnable">
+        <au:assertLogContains text="no dependencies found in ${lib.main}, will not be
able to set Classpath attribute correctly" level="warn"/>
+        <au:assertReferenceSet refid="manifest.main.classpath" />
+        <au:assertPropertyEquals name="manifest.classpath" value="" />
+    </target>
 </project>
\ No newline at end of file



Mime
View raw message