1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <!-- 4 build.xml 5 6 Author: Lasse Collin <lasse.collin (a] tukaani.org> 7 8 This file has been put into the public domain. 9 You can do whatever you want with this file. 10 --> 11 12 <project name="XZ" default="jar"> 13 14 <property file="build.properties"/> 15 16 <target name="clean" 17 description="Deletes generated files except 'extdoc/package-list'"> 18 <delete dir="${build_dir}"/> 19 </target> 20 21 <target name="distclean" depends="clean" 22 description="Deletes all generated files"> 23 <delete dir="extdoc"/> 24 </target> 25 26 <target name="dist" description="Creates a source package (.zip)"> 27 <mkdir dir="${dist_dir}"/> 28 <zip destfile="${dist_file}"> 29 <fileset dir="." includesfile="fileset-misc.txt"/> 30 <fileset dir="." includesfile="fileset-src.txt"/> 31 </zip> 32 </target> 33 34 <target name="doc" 35 description="Generates HTML documentation with javadoc"> 36 <mkdir dir="${doc_dir}"/> 37 <mkdir dir="${extdoc_dir}"/> 38 <get src="${extdoc_url}/package-list" 39 dest="${extdoc_dir}/package-list" skipexisting="true"/> 40 <javadoc sourcepath="${src_dir}" destdir="${doc_dir}" 41 source="${sourcever}" packagenames="org.tukaani.xz" 42 windowtitle="XZ data compression" 43 linkoffline="${extdoc_url} ${extdoc_dir}"/> 44 </target> 45 46 <target name="compile" description="Compiles the classes"> 47 <mkdir dir="${classes_dir}"/> 48 <javac srcdir="." sourcepath="${src_dir}" destdir="${classes_dir}" 49 includeAntRuntime="false" debug="${debug}" 50 source="${sourcever}" includesfile="fileset-src.txt" 51 excludes="**/package-info.java"> 52 <compilerarg compiler="modern" value="-Xlint"/> 53 </javac> 54 </target> 55 56 <target name="jar" depends="compile" 57 description="Creates JAR packages"> 58 <mkdir dir="${jar_dir}"/> 59 60 <jar destfile="${jar_dir}/xz.jar" basedir="${classes_dir}" 61 includes="org/tukaani/xz/**"> 62 <manifest> 63 <attribute name="Implementation-Title" value="${title}"/> 64 <attribute name="Implementation-Version" value="${version}"/> 65 <attribute name="Implementation-URL" value="${homepage}"/> 66 <attribute name="Sealed" value="true"/> 67 <!-- Attributes required for OSGi bundles. --> 68 <attribute name="Bundle-ManifestVersion" value="2"/> 69 <attribute name="Bundle-SymbolicName" value="org.tukaani.xz"/> 70 <attribute name="Bundle-Version" value="${version}"/> 71 <attribute name="Export-Package" value="org.tukaani.xz"/> 72 <attribute name="Bundle-Name" value="${title}"/> 73 <attribute name="Bundle-DocURL" value="${homepage}"/> 74 </manifest> 75 </jar> 76 77 <jar destfile="${jar_dir}/XZEncDemo.jar" basedir="${classes_dir}" 78 includes="XZEncDemo.class"> 79 <manifest> 80 <attribute name="Main-Class" value="XZEncDemo"/> 81 <attribute name="Class-Path" value="xz.jar"/> 82 </manifest> 83 </jar> 84 85 <jar destfile="${jar_dir}/XZDecDemo.jar" basedir="${classes_dir}" 86 includes="XZDecDemo.class"> 87 <manifest> 88 <attribute name="Main-Class" value="XZDecDemo"/> 89 <attribute name="Class-Path" value="xz.jar"/> 90 </manifest> 91 </jar> 92 93 <jar destfile="${jar_dir}/XZSeekEncDemo.jar" basedir="${classes_dir}" 94 includes="XZSeekEncDemo.class"> 95 <manifest> 96 <attribute name="Main-Class" value="XZSeekEncDemo"/> 97 <attribute name="Class-Path" value="xz.jar"/> 98 </manifest> 99 </jar> 100 101 <jar destfile="${jar_dir}/XZSeekDecDemo.jar" basedir="${classes_dir}" 102 includes="XZSeekDecDemo.class"> 103 <manifest> 104 <attribute name="Main-Class" value="XZSeekDecDemo"/> 105 <attribute name="Class-Path" value="xz.jar"/> 106 </manifest> 107 </jar> 108 109 <jar destfile="${jar_dir}/LZMADecDemo.jar" basedir="${classes_dir}" 110 includes="LZMADecDemo.class"> 111 <manifest> 112 <attribute name="Main-Class" value="LZMADecDemo"/> 113 <attribute name="Class-Path" value="xz.jar"/> 114 </manifest> 115 </jar> 116 </target> 117 118 <!-- It's an ugly quick hack. Maybe some day there will be a cleaner 119 version (e.g. by using Maven). --> 120 <target name="maven" depends="dist, doc, jar" 121 description="Creates the files for a Maven repository"> 122 <mkdir dir="${maven_dir}"/> 123 124 <copy file="${pom_template}" tofile="${maven_dir}/xz-${version}.pom" 125 overwrite="true"> 126 <filterset> 127 <filter token="VERSION" value="${version}"/> 128 <filter token="TITLE" value="${title}"/> 129 <filter token="HOMEPAGE" value="${homepage}"/> 130 </filterset> 131 </copy> 132 133 <copy file="${jar_dir}/xz.jar" tofile="${maven_dir}/xz-${version}.jar" 134 preservelastmodified="true" overwrite="true"/> 135 136 <jar destfile="${maven_dir}/xz-${version}-javadoc.jar" 137 basedir="${doc_dir}"/> 138 139 <jar destfile="${maven_dir}/xz-${version}-sources.jar" 140 basedir="${src_dir}" includes="org/tukaani/xz/**"/> 141 </target> 142 143 </project> 144