1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- 4 build.xml 5 6 Author: Lasse Collin <lasse.collin@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}" target="${sourcever}" 51 includesfile="fileset-src.txt" 52 excludes="**/package-info.java"> 53 <compilerarg compiler="modern" value="-Xlint"/> 54 </javac> 55 </target> 56 57 <target name="jar" depends="compile" 58 description="Creates JAR packages"> 59 <mkdir dir="${jar_dir}"/> 60 61 <jar destfile="${jar_dir}/xz.jar" basedir="${classes_dir}" 62 includes="org/tukaani/xz/**"> 63 <manifest> 64 <attribute name="Implementation-Title" value="${title}"/> 65 <attribute name="Implementation-Version" value="${version}"/> 66 <attribute name="Implementation-URL" value="${homepage}"/> 67 <attribute name="Sealed" value="true"/> 68 <attribute name="Automatic-Module-Name" 69 value="org.tukaani.xz"/> 70 <!-- Attributes required for OSGi bundles. --> 71 <attribute name="Bundle-ManifestVersion" value="2"/> 72 <attribute name="Bundle-SymbolicName" value="org.tukaani.xz"/> 73 <attribute name="Bundle-Version" value="${version}"/> 74 <attribute name="Export-Package" value="org.tukaani.xz"/> 75 <attribute name="Bundle-Name" value="${title}"/> 76 <attribute name="Bundle-DocURL" value="${homepage}"/> 77 </manifest> 78 </jar> 79 80 <jar destfile="${jar_dir}/TestAllocSpeed.jar" basedir="${classes_dir}" 81 includes="TestAllocSpeed.class"> 82 <manifest> 83 <attribute name="Main-Class" value="TestAllocSpeed"/> 84 <attribute name="Class-Path" value="xz.jar"/> 85 </manifest> 86 </jar> 87 88 <jar destfile="${jar_dir}/XZEncDemo.jar" basedir="${classes_dir}" 89 includes="XZEncDemo.class"> 90 <manifest> 91 <attribute name="Main-Class" value="XZEncDemo"/> 92 <attribute name="Class-Path" value="xz.jar"/> 93 </manifest> 94 </jar> 95 96 <jar destfile="${jar_dir}/XZDecDemo.jar" basedir="${classes_dir}" 97 includes="XZDecDemo.class"> 98 <manifest> 99 <attribute name="Main-Class" value="XZDecDemo"/> 100 <attribute name="Class-Path" value="xz.jar"/> 101 </manifest> 102 </jar> 103 104 <jar destfile="${jar_dir}/XZSeekEncDemo.jar" basedir="${classes_dir}" 105 includes="XZSeekEncDemo.class"> 106 <manifest> 107 <attribute name="Main-Class" value="XZSeekEncDemo"/> 108 <attribute name="Class-Path" value="xz.jar"/> 109 </manifest> 110 </jar> 111 112 <jar destfile="${jar_dir}/XZSeekDecDemo.jar" basedir="${classes_dir}" 113 includes="XZSeekDecDemo.class"> 114 <manifest> 115 <attribute name="Main-Class" value="XZSeekDecDemo"/> 116 <attribute name="Class-Path" value="xz.jar"/> 117 </manifest> 118 </jar> 119 120 <jar destfile="${jar_dir}/LZMAEncDemo.jar" basedir="${classes_dir}" 121 includes="LZMAEncDemo.class"> 122 <manifest> 123 <attribute name="Main-Class" value="LZMAEncDemo"/> 124 <attribute name="Class-Path" value="xz.jar"/> 125 </manifest> 126 </jar> 127 128 <jar destfile="${jar_dir}/LZMADecDemo.jar" basedir="${classes_dir}" 129 includes="LZMADecDemo.class"> 130 <manifest> 131 <attribute name="Main-Class" value="LZMADecDemo"/> 132 <attribute name="Class-Path" value="xz.jar"/> 133 </manifest> 134 </jar> 135 </target> 136 137 <!-- It's an ugly quick hack. Maybe some day there will be a cleaner 138 version (e.g. by using Maven). --> 139 <target name="maven" depends="dist, doc, jar" 140 description="Creates the files for a Maven repository"> 141 <mkdir dir="${maven_dir}"/> 142 143 <copy file="${pom_template}" tofile="${maven_dir}/xz-${version}.pom" 144 overwrite="true"> 145 <filterset> 146 <filter token="VERSION" value="${version}"/> 147 <filter token="TITLE" value="${title}"/> 148 <filter token="HOMEPAGE" value="${homepage}"/> 149 </filterset> 150 </copy> 151 152 <copy file="${jar_dir}/xz.jar" tofile="${maven_dir}/xz-${version}.jar" 153 preservelastmodified="true" overwrite="true"/> 154 155 <jar destfile="${maven_dir}/xz-${version}-javadoc.jar" 156 basedir="${doc_dir}"/> 157 158 <jar destfile="${maven_dir}/xz-${version}-sources.jar" 159 basedir="${src_dir}" includes="org/tukaani/xz/**"/> 160 </target> 161 162</project> 163