| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | |
|---|
| 3 | <project name="JLatexEditor" default="runJLatexEditor" basedir="."> |
|---|
| 4 | <!-- Update if needed. --> |
|---|
| 5 | <property name="jle.version" value="0.2"/> |
|---|
| 6 | <property name="program.name" value="${ant.project.name}"/> |
|---|
| 7 | <property name="program.cname" value="jlatexeditor"/> |
|---|
| 8 | <property name="program.jar" value="${ant.project.name}.jar"/> |
|---|
| 9 | |
|---|
| 10 | <!-- Locations --> |
|---|
| 11 | <property name="src" location="src"/> |
|---|
| 12 | <property name="src-test" location="test/src"/> |
|---|
| 13 | <property name="build" location="build"/> |
|---|
| 14 | <property name="lib" location="lib"/> |
|---|
| 15 | <property name="dist" location="dist"/> |
|---|
| 16 | <property name="upload" location="${dist}/${ant.project.name}"/> |
|---|
| 17 | <property name="uploadPrepare" location="${dist}/${ant.project.name}_prepare"/> |
|---|
| 18 | <property name="releases" location="${dist}/releases"/> |
|---|
| 19 | <property name="reports-test" location="reports"/> |
|---|
| 20 | |
|---|
| 21 | <property name="buildClasses" location="${build}/classes"/> |
|---|
| 22 | <property name="buildClasses-test" location="${build}/classes-test"/> |
|---|
| 23 | <property name="programJar" location="${uploadPrepare}/${program.jar}"/> |
|---|
| 24 | |
|---|
| 25 | <path id="libraries"> |
|---|
| 26 | <fileset dir="${lib}"> |
|---|
| 27 | <include name="*.jar"/> |
|---|
| 28 | </fileset> |
|---|
| 29 | </path> |
|---|
| 30 | |
|---|
| 31 | <path id="libraries-test"> |
|---|
| 32 | <fileset dir="test/lib"> |
|---|
| 33 | <include name="*.jar"/> |
|---|
| 34 | </fileset> |
|---|
| 35 | </path> |
|---|
| 36 | |
|---|
| 37 | <path id="ant-deb.classpath"> |
|---|
| 38 | <fileset dir="dist-resources/linux/deb-libs" includes="*.jar"/> |
|---|
| 39 | </path> |
|---|
| 40 | |
|---|
| 41 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 42 | | |
|---|
| 43 | | Task definitions |
|---|
| 44 | | |
|---|
| 45 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 46 | |
|---|
| 47 | <!-- Creates a linux desktopEntry--> |
|---|
| 48 | <taskdef name="desktopEntry" |
|---|
| 49 | classname="com.googlecode.ant_deb_task.DesktopEntry" |
|---|
| 50 | classpathref="ant-deb.classpath"/> |
|---|
| 51 | |
|---|
| 52 | <!-- Creates an Ubuntu package--> |
|---|
| 53 | <taskdef name="deb" |
|---|
| 54 | classname="com.googlecode.ant_deb_task.Deb" |
|---|
| 55 | classpathref="ant-deb.classpath"/> |
|---|
| 56 | |
|---|
| 57 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 58 | | |
|---|
| 59 | | Normal targets |
|---|
| 60 | | |
|---|
| 61 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 62 | |
|---|
| 63 | <!-- Run application. --> |
|---|
| 64 | <target name="runJLatexEditor" depends="compile"> |
|---|
| 65 | <java classname="jlatexeditor.JLatexEditorJFrame" fork="true"> |
|---|
| 66 | <classpath> |
|---|
| 67 | <pathelement location="${buildClasses}"/> |
|---|
| 68 | <!-- <path refid="libraries"/> --> |
|---|
| 69 | </classpath> |
|---|
| 70 | <!-- <jvmarg value="-Djava.util.logging.config.file=conf/logging.properties" />--> |
|---|
| 71 | </java> |
|---|
| 72 | </target> |
|---|
| 73 | |
|---|
| 74 | <!-- Delete class and jar files. --> |
|---|
| 75 | <target name="clean"> |
|---|
| 76 | <delete dir="${buildClasses}"/> |
|---|
| 77 | <delete dir="${buildClasses-test}"/> |
|---|
| 78 | <delete dir="${build}"/> |
|---|
| 79 | </target> |
|---|
| 80 | |
|---|
| 81 | <target name="clearDependentClasses"> |
|---|
| 82 | <mkdir dir="${buildClasses}"/> |
|---|
| 83 | |
|---|
| 84 | <!-- Cleaning dependent .class files. --> |
|---|
| 85 | <depend srcdir="${src}" destdir="${buildClasses}" cache="depcache"> |
|---|
| 86 | <include name= "**/*.java"/> |
|---|
| 87 | </depend> |
|---|
| 88 | </target> |
|---|
| 89 | |
|---|
| 90 | <!-- Compile application. --> |
|---|
| 91 | <target name="compile"> |
|---|
| 92 | <mkdir dir="${buildClasses}"/> |
|---|
| 93 | |
|---|
| 94 | <!-- Compile the project. --> |
|---|
| 95 | <javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on"> |
|---|
| 96 | <classpath> |
|---|
| 97 | <pathelement location="${buildClasses}"/> |
|---|
| 98 | <path refid="libraries"/> |
|---|
| 99 | </classpath> |
|---|
| 100 | </javac> |
|---|
| 101 | |
|---|
| 102 | <!-- Copy all non-java files to classes. --> |
|---|
| 103 | <copy todir="${buildClasses}"> |
|---|
| 104 | <fileset dir="${src}"> |
|---|
| 105 | <exclude name="**/*.java"/> |
|---|
| 106 | </fileset> |
|---|
| 107 | </copy> |
|---|
| 108 | </target> |
|---|
| 109 | |
|---|
| 110 | <!-- Compile application. --> |
|---|
| 111 | <target name="compile-test" depends="compile"> |
|---|
| 112 | <mkdir dir="${buildClasses-test}"/> |
|---|
| 113 | |
|---|
| 114 | <!-- Compile the project. --> |
|---|
| 115 | <javac srcdir="${src-test}" destdir="${buildClasses-test}" target="1.5" source="1.5" encoding="UTF-8" debug="on"> |
|---|
| 116 | <classpath> |
|---|
| 117 | <pathelement location="${buildClasses}"/> |
|---|
| 118 | <pathelement location="${buildClasses-test}"/> |
|---|
| 119 | <path refid="libraries"/> |
|---|
| 120 | <path refid="libraries-test"/> |
|---|
| 121 | </classpath> |
|---|
| 122 | </javac> |
|---|
| 123 | </target> |
|---|
| 124 | |
|---|
| 125 | <!-- Run tests. --> |
|---|
| 126 | <target name="test" depends="compile-test"> |
|---|
| 127 | <delete dir="${reports-test}" /> |
|---|
| 128 | <mkdir dir="${reports-test}" /> |
|---|
| 129 | |
|---|
| 130 | <junit printsummary="no" failureproperty="failure"> |
|---|
| 131 | <classpath> |
|---|
| 132 | <pathelement location="${buildClasses}"/> |
|---|
| 133 | <pathelement location="${buildClasses-test}"/> |
|---|
| 134 | <path refid="libraries"/> |
|---|
| 135 | <path refid="libraries-test"/> |
|---|
| 136 | </classpath> |
|---|
| 137 | |
|---|
| 138 | <formatter type="xml" usefile="true" /> |
|---|
| 139 | <formatter type="brief" usefile="false" /> |
|---|
| 140 | <batchtest todir="${reports-test}"> |
|---|
| 141 | <fileset dir="${buildClasses-test}" includes="**/*Test.class" /> |
|---|
| 142 | </batchtest> |
|---|
| 143 | </junit> |
|---|
| 144 | |
|---|
| 145 | <fail if="failure"/> |
|---|
| 146 | </target> |
|---|
| 147 | |
|---|
| 148 | <!-- Builds the upload directory including the jar file. --> |
|---|
| 149 | <target name="jar" depends="compile,updateBuildNumber"> |
|---|
| 150 | <delete dir="${uploadPrepare}"/> |
|---|
| 151 | <mkdir dir="${uploadPrepare}"/> |
|---|
| 152 | |
|---|
| 153 | <!-- Build jar file. --> |
|---|
| 154 | <jar jarfile="${programJar}" basedir="${buildClasses}"> |
|---|
| 155 | <fileset dir="."> |
|---|
| 156 | <include name="data/**"/> |
|---|
| 157 | </fileset> |
|---|
| 158 | <manifest> |
|---|
| 159 | <attribute name="Class-Path" value="lib/chardet.jar lib/extcos-0.2b-all.jar"/> |
|---|
| 160 | <attribute name="Main-Class" value="jlatexeditor.JLatexEditorJFrame"/> |
|---|
| 161 | </manifest> |
|---|
| 162 | </jar> |
|---|
| 163 | |
|---|
| 164 | <!-- Copy libs. --> |
|---|
| 165 | <mkdir dir="${uploadPrepare}/lib"/> |
|---|
| 166 | <copy todir="${uploadPrepare}/lib" file="lib/chardet.jar"/> |
|---|
| 167 | <copy todir="${uploadPrepare}/lib" file="lib/extcos-0.2b-all.jar"/> |
|---|
| 168 | |
|---|
| 169 | <!-- Copy start scripts. --> |
|---|
| 170 | <copy todir="${uploadPrepare}" file="CHANGELOG"/> |
|---|
| 171 | <copy todir="${uploadPrepare}" file="scripts/jlatexeditor"/> |
|---|
| 172 | <copy todir="${uploadPrepare}" file="scripts/jlatexeditor.bat"/> |
|---|
| 173 | <copy todir="${uploadPrepare}"> |
|---|
| 174 | <fileset dir="scripts" defaultexcludes="no"> |
|---|
| 175 | <filename name=".wstart.bat"/> |
|---|
| 176 | </fileset> |
|---|
| 177 | </copy> |
|---|
| 178 | <chmod file="${uploadPrepare}/jlatexeditor" perm="ugo+x"/> |
|---|
| 179 | </target> |
|---|
| 180 | |
|---|
| 181 | <!-- Increments the build number. --> |
|---|
| 182 | <target name="updateBuildNumber"> |
|---|
| 183 | <buildnumber/> |
|---|
| 184 | |
|---|
| 185 | <echo message="${jle.version}.${build.number}" file="${buildClasses}/version.txt"/> |
|---|
| 186 | </target> |
|---|
| 187 | |
|---|
| 188 | <!-- Build all files needed for deployment. --> |
|---|
| 189 | <target name="create_release" depends="clean,jar,dist-linux-deb"> |
|---|
| 190 | <mkdir dir="${releases}"/> |
|---|
| 191 | |
|---|
| 192 | <exec executable="scripts/create_release"> |
|---|
| 193 | <arg value="${jle.version}.${build.number}"/> |
|---|
| 194 | </exec> |
|---|
| 195 | </target> |
|---|
| 196 | |
|---|
| 197 | <!-- Validates the source code and creates a new release on the remote server. --> |
|---|
| 198 | <target name="create_remote_release" depends="compile"> |
|---|
| 199 | <exec executable="scripts/create_remote_release"> |
|---|
| 200 | <arg value="JLatexEditor-${jle.version}.${build.number}"/> |
|---|
| 201 | </exec> |
|---|
| 202 | </target> |
|---|
| 203 | |
|---|
| 204 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 205 | | |
|---|
| 206 | | OS dependent targets |
|---|
| 207 | | |
|---|
| 208 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 209 | |
|---|
| 210 | <property name="runtime.dir" value="${build}/runtime"/> |
|---|
| 211 | <property name="default.runtime.dir" value="${runtime.dir}/default"/> |
|---|
| 212 | |
|---|
| 213 | <property name="win.runtime.dir" value="${runtime.dir}/win"/> |
|---|
| 214 | <property name="linux.runtime.dir" value="${runtime.dir}/linux"/> |
|---|
| 215 | |
|---|
| 216 | <!-- Creates the desktop entry file for Linux platforms --> |
|---|
| 217 | <target name="desktop-entry"> |
|---|
| 218 | <mkdir dir="${linux.runtime.dir}"/> |
|---|
| 219 | <desktopEntry |
|---|
| 220 | toFile="${linux.runtime.dir}/${program.cname}.desktop" |
|---|
| 221 | name="${program.name}" |
|---|
| 222 | icon="images/icon_128.png" |
|---|
| 223 | exec="${program.cname}.sh" |
|---|
| 224 | tryExec="${program.cname}.sh" |
|---|
| 225 | categories="Office;" |
|---|
| 226 | type="Application" |
|---|
| 227 | > |
|---|
| 228 | <name lang="de" value="${program.name}"/> |
|---|
| 229 | <genericname value="Intelligent Latex Editor"/> |
|---|
| 230 | <genericname lang="de" value="Intelligenter Latex-Editor"/> |
|---|
| 231 | <comment value="Intelligent and configurable Latex Editor - written in Java"/> |
|---|
| 232 | <comment lang="de" value="Intelligenter und anpassbarer Latex-Editor - geschrieben in Java"/> |
|---|
| 233 | </desktopEntry> |
|---|
| 234 | </target> |
|---|
| 235 | |
|---|
| 236 | <!-- Creates the desktop entry file for Debian/Ubuntu platform --> |
|---|
| 237 | <target name="desktop-entry-deb"> |
|---|
| 238 | <mkdir dir="${linux.runtime.dir}"/> |
|---|
| 239 | <desktopEntry |
|---|
| 240 | toFile="${linux.runtime.dir}/${program.cname}.desktop" |
|---|
| 241 | name="${program.name}" |
|---|
| 242 | icon="/usr/share/${program.cname}/images/icon_128.png" |
|---|
| 243 | exec="${program.cname}" |
|---|
| 244 | categories="Office;" |
|---|
| 245 | type="Application" |
|---|
| 246 | > |
|---|
| 247 | <name lang="de" value="${program.name}"/> |
|---|
| 248 | <genericname value="Intelligent LaTeX Editor"/> |
|---|
| 249 | <genericname lang="de" value="Intelligenter LaTeX-Editor"/> |
|---|
| 250 | <comment value="Intelligent and configurable LaTeX Editor - written in Java"/> |
|---|
| 251 | <comment lang="de" value="Intelligenter und anpassbarer LaTeX-Editor - geschrieben in Java"/> |
|---|
| 252 | </desktopEntry> |
|---|
| 253 | </target> |
|---|
| 254 | |
|---|
| 255 | <target name="dist-linux-deb" depends="jar, runtime-linux, desktop-entry-deb" description="Creates binaries for Debian platforms"> |
|---|
| 256 | <mkdir dir="${releases}"/> |
|---|
| 257 | |
|---|
| 258 | <echo message="${jle.version}.${build.number}"/> |
|---|
| 259 | <deb |
|---|
| 260 | todir="${releases}" |
|---|
| 261 | package="${program.cname}" |
|---|
| 262 | section="tex" |
|---|
| 263 | depends="sun-java6-jre | openjdk-6-jre | sun-java7-jre | openjdk-7-jre | default-jre, texlive-base-bin, texlive-latex-base" |
|---|
| 264 | recommends="subversion, aspell | hunspell" |
|---|
| 265 | suggests="ghc6, libghc6-parsec3-dev"> |
|---|
| 266 | |
|---|
| 267 | <version upstream="${jle.version}.${build.number}"/> |
|---|
| 268 | <maintainer name="Stefan Endrullis" email="stefan@endrullis.de"/> |
|---|
| 269 | |
|---|
| 270 | <!-- do not indent the description, otherwise the indent will be visible in the package manager and other tools --> |
|---|
| 271 | <description synopsis="Intelligent LaTeX Editor">Intelligent and Configurable LaTeX Editor - written in Java.</description> |
|---|
| 272 | |
|---|
| 273 | <tarfileset dir="${linux.runtime.dir}" prefix="usr/share/${program.cname}"> |
|---|
| 274 | <include name="images/**"/> |
|---|
| 275 | <include name="lib/**"/> |
|---|
| 276 | <exclude name="${program.cname}"/> |
|---|
| 277 | <exclude name="${program.cname}.sh"/> |
|---|
| 278 | <exclude name="${program.cname}.desktop"/> |
|---|
| 279 | <include name="*"/> |
|---|
| 280 | </tarfileset> |
|---|
| 281 | <tarfileset dir="${linux.runtime.dir}" prefix="usr/share/${program.cname}" filemode="755" includes="${program.cname}.sh" /> |
|---|
| 282 | <tarfileset dir="${linux.runtime.dir}" prefix="usr/share/applications" includes="${program.cname}.desktop"/> |
|---|
| 283 | <tarfileset dir="${linux.runtime.dir}" prefix="usr/bin" filemode="755" includes="${program.cname}" /> |
|---|
| 284 | </deb> |
|---|
| 285 | </target> |
|---|
| 286 | |
|---|
| 287 | <target name="runtime-linux"> |
|---|
| 288 | <delete dir="${linux.runtime.dir}"/> |
|---|
| 289 | <mkdir dir="${linux.runtime.dir}/images"/> |
|---|
| 290 | <mkdir dir="${linux.runtime.dir}/lib"/> |
|---|
| 291 | <copy todir="${linux.runtime.dir}"> |
|---|
| 292 | <fileset dir="dist-resources/linux/deb"/> |
|---|
| 293 | <fileset file="dist/JLatexEditor_prepare/JLatexEditor.jar"/> |
|---|
| 294 | <fileset file="dist/JLatexEditor_prepare/CHANGELOG"/> |
|---|
| 295 | </copy> |
|---|
| 296 | <copy todir="${linux.runtime.dir}/lib"> |
|---|
| 297 | <fileset dir="dist/JLatexEditor_prepare/lib"/> |
|---|
| 298 | </copy> |
|---|
| 299 | <!-- <copy file="dev/images/jle-icon/5_object_128.png" tofile="${linux.runtime.dir}/images/icon_128.png"/>--> |
|---|
| 300 | <copy file="dev/images/cookie-icon/tex-cookie_128.png" tofile="${linux.runtime.dir}/images/icon_128.png"/> |
|---|
| 301 | <echo file="${linux.runtime.dir}/updateDisabled.txt"/> |
|---|
| 302 | <chmod perm="+x" file="${linux.runtime.dir}/${program.cname}.sh"/> |
|---|
| 303 | <chmod perm="+x" file="${linux.runtime.dir}/${program.cname}"/> |
|---|
| 304 | </target> |
|---|
| 305 | </project> |
|---|