You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ju...@apache.org on 2009/03/26 16:19:45 UTC

svn commit: r758676 - /incubator/pdfbox/jempbox/trunk/build.xml

Author: jukka
Date: Thu Mar 26 15:19:37 2009
New Revision: 758676

URL: http://svn.apache.org/viewvc?rev=758676&view=rev
Log:
PDFBOX-437: Prepare JempBox and FontBox for release

Automate downloads of jars required for the build

Add all top level .txt files to build artifacts.

Ignore the website build for now, we don't use it ATM.

Modified:
    incubator/pdfbox/jempbox/trunk/build.xml

Modified: incubator/pdfbox/jempbox/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/pdfbox/jempbox/trunk/build.xml?rev=758676&r1=758675&r2=758676&view=diff
==============================================================================
--- incubator/pdfbox/jempbox/trunk/build.xml (original)
+++ incubator/pdfbox/jempbox/trunk/build.xml Thu Mar 26 15:19:37 2009
@@ -23,15 +23,14 @@
     <property name="build.compiler" value="modern" />
     <property name="src.dir" value="src/main/java" />
     <property name="test.dir" value="src/test/java" />
-    <property name="dest.dir" value="classes" />
+    <property name="target.dir" value="target" />
+    <property name="dest.dir" value="${target.dir}/classes" />
+    <property name="test.classes.dir" value="${target.dir}/test-classes" />
     <property name="tool.dir" value="tools" />
     <property name="bin.dir" value="bin" />
     <property name="website.dir" value="website" />
     <property name="website.build.dir" value="${website.dir}/build/site" />
     <property name="docs.dir" value="${website.dir}/build/site/javadoc" />
-    <property name="lib.dir" value="lib" />
-    <property name="dist.dir" value="dist" />
-    <property name="resources.dir" value="Resources" />
     <property name="checkstyle.config" value="jempbox-checkstyle.xml" />
 
     <property name="project.name" value="jempbox"/>
@@ -56,8 +55,11 @@
     <property name="ikvmc" value="${ikvm.dir}/bin/ikvmc.exe"/>
 
     <path id="build.classpath">
-        <pathelement path="${dest.dir}" />
-        <pathelement path="." />
+        <pathelement path="${dest.dir}"/>
+    </path>
+
+    <path id="junit.classpath">
+        <pathelement path="${junit.jar}"/>
     </path>
 
     <path id="checkstyle.classpath">
@@ -68,63 +70,45 @@
     </path>
 
     <target name="clean" description="Remove all generated files">
+        <delete dir="${target.dir}"/>
     	<delete failonerror="false">
-	        <fileset dir="${dest.dir}"/>
 	        <fileset dir="${docs.dir}"/>
 	        <fileset dir="${bin.dir}"/>
-	    	<fileset dir="${lib.dir}"/>
 	        <fileset dir="." file="checkstyle.cache" />
         </delete>
     </target>
-    
-    <target name="jempbox.init">
-        <mkdir dir="${lib.dir}"/>
-        <mkdir dir="${dest.dir}"/>
-        <mkdir dir="${tool.dir}"/>
-        <mkdir dir="${docs.dir}" />
-        <mkdir dir="${dist.dir}" />
-        <mkdir dir="${bin.dir}" />
-    </target>
 
     <target name="testexist">
         <echo message="Testing for ${destfile}" level="debug"/>
         <available file="${destfile}" property="exist"/>
     </target>
     <target name="downloadfile" unless="exist" depends="testexist">
-        <get src="${sourcefile}" dest="${destfile}" />
+        <dirname property="destdir" file="${destfile}"/>
+        <mkdir dir="${destdir}"/>
+        <get src="${sourcefile}" dest="${destfile}"/>
     </target>
 
-    <target name="get.junit">
+    <target name="find.junit">
+        <available property="junit.found"
+                   classname="junit.framework.Test"
+                   classpathref="junit.classpath"/>
+    </target>
+
+    <target name="get.junit" unless="junit.found" depends="find.junit">
         <antcall target="downloadfile">
             <param name="sourcefile" value="${junit.url}"/>
             <param name="destfile" value="${junit.jar}"/>
         </antcall>
     </target>
 
-    <target name="compile" depends="jempbox.init" description="Compile Java source files">
-        <!-- required encoding flag to be able to build using ibm-jdk on redhat ES-->
-        <javac srcdir="${src.dir}" destdir="${dest.dir}"
-               target="1.4" source="1.4" classpathref="build.classpath"
-               debug="on" deprecation="on" encoding="ISO-8859-1"/>
-        <javac srcdir="${test.dir}" destdir="${dest.dir}"
-               target="1.4" source="1.4" classpathref="build.classpath"
-               debug="on" deprecation="on" encoding="ISO-8859-1"/>
-    </target>
-
-    <target name="junit" depends="clean,compile,get.junit"
-            description="run junit tests">
-        <junit printsummary="off" fork="on" dir=".">
-            <classpath>
-                <pathelement path="${junit.jar}"/>
-                <pathelement path="${dest.dir}"/>
-                <pathelement path="." />
-            </classpath>
-            <formatter usefile="false" type="plain" />
-            <test name="org.apache.jempbox.xmp.AllTests" />
-        </junit>
+    <target name="find.checkstyle">
+        <available property="checkstyle.found"
+                   classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
+                   classpathref="checkstyle.classpath"/>
     </target>
 
-    <target name="checkstyle" depends="compile">
+    <target name="get.checkstyle"
+            unless="checkstyle.found" depends="find.checkstyle">
         <antcall target="downloadfile">
             <param name="sourcefile" value="${checkstyle.url}"/>
             <param name="destfile" value="${checkstyle.jar}"/>
@@ -141,7 +125,34 @@
             <param name="sourcefile" value="${antlr.url}"/>
             <param name="destfile" value="${antlr.jar}"/>
         </antcall>
+    </target>
+
+    <target name="compile" description="Compile Java source files">
+        <mkdir dir="${dest.dir}"/>
+        <!-- required encoding flag to be able to build using ibm-jdk on redhat ES-->
+        <javac srcdir="${src.dir}" destdir="${dest.dir}"
+               target="1.4" source="1.4" encoding="ISO-8859-1"
+               debug="on" deprecation="on"/>
+    </target>
+
+    <target name="junit" depends="compile,get.junit"
+            description="run junit tests">
+        <mkdir dir="${test.classes.dir}"/>
+        <javac srcdir="${test.dir}" destdir="${test.classes.dir}"
+               target="1.4" source="1.4" classpathref="build.classpath"
+               debug="on" deprecation="on" encoding="ISO-8859-1"/>
+        <junit printsummary="off" fork="on" dir=".">
+            <classpath>
+                <pathelement path="${junit.jar}"/>
+                <pathelement path="${dest.dir}"/>
+                <pathelement path="${test.classes.dir}"/>
+            </classpath>
+            <formatter usefile="false" type="plain" />
+            <test name="org.apache.jempbox.xmp.AllTests" />
+        </junit>
+    </target>
 
+    <target name="checkstyle" depends="compile,get.checkstyle">
         <!-- This doesn't work when run from netbeans for some reason -->
         <taskdef name="checkstyle"
                  classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
@@ -157,24 +168,13 @@
 
     <target name="package" depends="compile" description="Package JempBox">
         <property name="release.name" value="${project.name}-${project.version}" />
-        <propertyfile file="${resources.dir}/jempbox.version">
-            <entry  key="jempbox.version" value="${release.name}"/>
-        </propertyfile>
-
-        <jar jarfile="./lib/${release.name}.jar">
-            <fileset dir="${dest.dir}">
-                <include name="org/**/*.class"/>
-            </fileset>
-            <fileset dir=".">
-                <include name="${resources.dir}/**/*" />
-            </fileset>
+        <jar jarfile="${target.dir}/${release.name}.jar">
+            <fileset dir="${dest.dir}"/>
+            <zipfileset dir="." includes="*.txt" prefix="META-INF"/>
             <manifest>
-                <attribute name="Built-By" value="${user.name}"/>
-                <section name="common">
-                    <attribute name="Specification-Title" value="JempBox"/>
-                    <attribute name="Specification-Version" value="${project.version}"/>
-                    <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
-                </section>
+                <attribute name="Specification-Title" value="Apache JempBox"/>
+                <attribute name="Specification-Version" value="${project.version}"/>
+                <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
             </manifest>
         </jar>
     </target>
@@ -186,31 +186,21 @@
     </target>
 
     <target name="release-dist">
-        <delete dir="${dist.dir}"/>
         <antcall target="dist" />
     </target>
 
-    <target name="dist" depends="clean,package,checkstyle,junit,javadoc,website,build.NET" description="Create zip distribution file">
-        
-        <zip zipfile="${dist.dir}/${release.name}.zip">
+    <target name="dist" depends="clean,package,checkstyle,junit,javadoc,build.NET" description="Create zip distribution file">
+        <zip zipfile="${target.dir}/${release.name}.zip">
             <zipfileset dir="." prefix="${release.name}">
-                <include name="${lib.dir}/*.jar"/>
                 <include name="${src.dir}/**/*.java"/>
                 <include name="${test.dir}/**/*.java"/>
                 <include name="${src.dir}/**/*.html"/>
                 <include name="${test.dir}/**/*.html"/>
-                <include name="${resources.dir}/**/*" />
-                <include name="${bin.dir}/**/*" />
-                <include name="LICENSE.txt" />
-                <include name="NOTICE.txt" />
+                <include name="*.txt" />
                 <include name="build.xml" />
                 <include name="build.properties.example" />
                 <include name="${checkstyle.config}" />
             </zipfileset>
-            <zipfileset dir="${website.build.dir}" prefix="${release.name}/docs">
-                <include name="**/*" />
-                <exclude name="**/*.zip" />
-            </zipfileset>
             <zipfileset dir="." prefix="${release.name}">
                 <include name="website/**/*" />
                 <exclude name="website/build/**/*" />
@@ -236,12 +226,13 @@
             <arg value="-reference:${ikvm.dir}/bin/IKVM.GNU.Classpath.dll" />
             <arg value="-reference:${ikvm.dir}/bin/IKVM.AWT.WinForms.dll" />
             <arg value="-target:library" />
-            <arg value="-out:bin\${release.name}.dll" />
-            <arg value="lib\${release.name}.jar" />
+            <arg value="-out:${target.dir}\${release.name}.dll" />
+            <arg value="${target.dir}\${release.name}.jar" />
 	    </exec>
     </target>
 
     <target name="javadoc" depends="compile" description="Create Javadocs">
+        <mkdir dir="${docs.dir}"/>
         <property name="release.name" value="${project.name}-${project.version}" />
         <javadoc packagenames="org.*"
                sourcepath="${src.dir}"
@@ -256,7 +247,6 @@
                encoding="ISO-8859-1"
                breakiterator="yes">
             <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
-            <!--<link href="http://jakarta.apache.org/ant/manual/api/" />-->
         </javadoc>
     </target>
 
@@ -268,4 +258,4 @@
        <antcall target="site"/>
     </target>
 
-</project>
\ No newline at end of file
+</project>