incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1369441 - in /incubator/easyant/plugins/trunk/manifest/src: main/resources/manifest.ant test/ test/antunit/ test/antunit/manifest-test.xml
Date Sat, 04 Aug 2012 21:15:33 GMT
Author: jlboudart
Date: Sat Aug  4 21:15:33 2012
New Revision: 1369441

URL: http://svn.apache.org/viewvc?rev=1369441&view=rev
Log:
Add manifest test case

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

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=1369441&r1=1369440&r2=1369441&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant (original)
+++ incubator/easyant/plugins/trunk/manifest/src/main/resources/manifest.ant Sat Aug  4 21:15:33
2012
@@ -17,6 +17,7 @@
 <project name="org.apache.easyant.plugins#manifest" xmlns:ea="antlib:org.apache.easyant">
 
     <ea:core-version requiredrevision="[0.9,+]" />
+    <ea:import mrid="org.apache.easyant.plugins#abstract-provisioning;0.9" />
 
     <target name="manifest:init">
         <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...)"/>
@@ -26,6 +27,8 @@
     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" description="If manifest.main.classname
is defined, this will be used for the Class-Path attribute.  by default this will be automatically
computed from the Ivy dependencies of the target artifact." />
+        <ea:parameter property="target.main.classes" default="${target}/main/classes"
+        description="destination directory for compiled classes" />
         <mkdir dir="${target.main.classes}/META-INF"/>
         <ea:parameter property="manifest.file" default="${target}/MANIFEST.MF" description="the
manifest-file to create/update." />
         <ea:parameter property="version.properties.file" default="${target.main.classes}/META-INF/version.properties"
description="the version.properties file to create/update." />
@@ -79,12 +82,17 @@
             <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"/>
+        <path id="manifest.main.classpath">
+            <fileset id="lib.main.fileset" dir="${lib.main}">
+                <include name="*.jar" />
+            </fileset>
+        </path>
 
         <!-- create the target artifact dir if it does not exists -->
         <dirname file="${target.main.artifact}" property="target.artifacts"/>
         <mkdir dir="${target.artifacts}"/>
         <manifestclasspath property="manifest.classpath" jarfile="${target.main.artifact}">
-            <classpath refid="project.lib.main.classpath"/>
+            <classpath refid="manifest.main.classpath"/>
         </manifestclasspath>
         <manifest file="${manifest.file}" mode="update">
             <attribute name="Main-Class" value="${manifest.main.classname}" />

Added: 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=1369441&view=auto
==============================================================================
--- incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml (added)
+++ incubator/easyant/plugins/trunk/manifest/src/test/antunit/manifest-test.xml Sat Aug  4
21:15:33 2012
@@ -0,0 +1,80 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project name="org.apache.easyant.plugins;manifest-test" 
+    xmlns:au="antlib:org.apache.ant.antunit" 
+    xmlns:ivy="antlib:org.apache.ivy.ant"
+    xmlns:ea="antlib:org.apache.easyant">
+    
+    <!-- Import your plugin --> 
+    <property name="target" value="target/test-antunit"/>
+    <!-- configure easyant in current project -->
+    <ea:configure-easyant-ivy-instance />
+    <!-- import our local plugin -->
+    <ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources"/>
+
+    <!-- Defines a setUp / tearDown (before each test) that cleans the environnement -->

+    <target name="clean" description="remove stale build artifacts before / after each
test">
+        <delete dir="${basedir}" includeemptydirs="true">
+            <include name="**/target/**"/>
+            <include name="**/lib/**"/>
+        </delete>
+    </target>
+    
+    <target name="setUp" depends="clean">
+        <property name="ivy.module" value="mytest"/>
+        <property name="ivy.organisation" value="myorg"/>
+        <property name="ivy.revision" value="1.0"/>
+<!--
+        <property name="version" value="1.0"/>
+-->
+    </target>
+    <target name="tearDown" depends="clean"/>
+    
+    <target name="test-manifest:init" depends="manifest:init">
+<!-- FIXME: check unset properties
+        <au:assertPropertyNotSet name="project.main.classname" />
+        <au:assertPropertyNotSet name="manifest.main.classname" />
+        <au:assertPropertyNotSet name="manifest.classpath" />
+-->
+        <au:assertPropertyEquals name="target.main.classes" value="${target}/main/classes"/>
+        <au:assertFileExists file="${target.main.classes}/META-INF"/>
+        <au:assertPropertyEquals name="manifest.file" value="${target}/MANIFEST.MF"/>
+        <au:assertPropertyEquals name="version.properties.file" value="${target.main.classes}/META-INF/version.properties"/>
+    </target>
+
+    <target name="test-manifest:generate-version-number" depends="-manifest:generate-version-number">
+        <au:assertPropertyEquals name="version" value="${ivy.revision}-build-${now}"/>
+    </target>
+
+    <target name="test-manifest:manifest" depends="manifest:manifest">
+        <au:assertFileExists file="${manifest.file}"/>
+        <au:assertFileExists file="${version.properties.file}"/>
+    </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:assertReferenceSet refid="manifest.main.classpath"/>
+        <au:assertPropertyEquals name="manifest.classpath" value="lib/main/myjar.jar"/>
+
+    </target>
+</project>



Mime
View raw message