update changelog
[debian/jabref.git] / build.xml
1 <?xml version="1.0"?>
2 <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3    Filename: build.xml
4    Purpose:  Ant build file for Jabref.
5
6              Ant-Download: http://jakarta.apache.org/ant
7              Ant-Manual:   http://jakarta.apache.org/ant/manual/index.html
8
9              Jabref homepage:       http://jabref.sourceforge.net
10              Jabref@OpenHub:        https://www.openhub.net/p/jabref
11
12              Further questions:
13                help mailing list:   https://lists.sourceforge.net/lists/listinfo/jabref-users
14
15    Precondition: 1. Ant should be installed.
16                  2. JAVA_HOME environment variable contains the path to JDK1.6 or higher
17                  3. ANT_HOME environment variable contains the path to ant's home directory
18
19    Language: XML
20    Compiler: Ant
21    Authors:  Joerg K. Wegner, wegnerj@informatik.uni-tuebingen.de
22              Morten O. Alver
23
24    modified: see at git checkout and "gitk build.xml"
25
26 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
27
28 <project name="JabRef" default="jars" basedir=".">
29
30         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31         PROPERTY SETUP
32      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
33
34         <!-- some version information -->
35         <property name="jabref.version" value="2.11b3" />
36         <property name="jabref.version.full" value="2.11.3.1" /> <!-- a version number with 4 places. Required by launch4j -->
37         <property name="jabref.year" value="2015" />
38         <property name="jabref.placeholder.version" value="@version@" />
39         <property name="jabref.placeholder.year" value="@year@" />
40         <!-- used by replace task -->
41
42         <!-- Set the properties for intermediate directory -->
43         <property name="build.jar" value="JabRef-${jabref.version}.jar" />
44         <property name="build.dir" value="buildant" />
45         <property name="build.classes" value="${build.dir}/classes" />
46         <property name="build.tmp" value="${build.dir}/tmp" />
47         <property name="build.classes.osx" value="${build.dir}/classes/osx/macadapter" />
48         <property name="build.lib" value="${build.dir}/lib" />
49         <property name="build.win" value="${build.dir}/windows" />
50         <property name="build.images" value="${build.dir}/images" />
51         <property name="build.resource" value="${build.dir}/resource" />
52         <property name="build.help" value="${build.dir}/help" />
53         <property name="build.extensions" value="${build.dir}/extensions" />
54         <property name="build.extension-javadocs" value="${build.extensions}/API" />
55         <property name="build.extension-layout" value="${build.extensions}/layout" />
56         <property name="build.openoffice.meta" value="${build.resource}/openoffice" />
57
58         <!-- Set the properties for source directories -->
59         <property name="resources.dir" value="src/main/resources" />
60         <property name="plugin.dir" value="${resources.dir}/plugins/" />
61         <property name="txt.dir" value="." />
62         <property name="java.dir" value="src/main/java" />
63     <property name="gen.dir" value="src/main/gen" />
64         <property name="osx.dir" value="${resources.dir}/osx" />
65         <property name="win.installer.dir" value="${resources.dir}/windows/nsis" />
66         <property name="resource.dir" value="${resources.dir}/resource" />
67         <property name="images.dir" value="${resources.dir}/images" />
68         <property name="help.dir" value="${resources.dir}/help" />
69         <property name="extensions.dir" value="${resources.dir}/extensions" />
70         <property name="layout.dir" value="${resources.dir}/resource/layout" />
71         <property name="lib.dir" value="lib" />
72         <property name="buildlib.dir" value="buildlib" />
73
74         <property name="osxbin.dir" value="osx" />
75
76         <!-- Load user dependent properties. Has to happen before setting the properties here -->
77         <!-- For instance to redefine the NSIS-compiler write
78                 nsis.executable="d:\\prog\\dev\\NSIS\\makensis.exe"
79           -->
80         <property file="user.properties" />
81
82         <property name="nsis.executable" value="C:\Program files\NSIS\makensis.exe"/>
83         <property name="nsis.executable.linux" value="makensis"/>
84         <property name="launch4j.dir" location="/opt/launch4j" />
85
86         <!-- win.installer can only be build under Windows if the nsis.executable is found -->
87         <condition property="is.windows">
88           <and>
89             <isset property="nsis.executable" />
90             <os family="windows" />
91           </and>
92         </condition>
93
94     <!-- Done by MrDlib -->
95         <fileset id="deletableMeta-InfFiles" dir="${build.tmp}/META-INF">
96                 <exclude name="services/**/*" />
97         </fileset>
98     <!-- Done by MrDlib -->
99
100         <!-- Build classpath -->
101         <filelist id="jars" />
102         <path id="classpath">
103                 <pathelement path="${build.classes}" />
104                 <pathelement path="${build.dir}" />
105                 <filelist refid="jars" />
106         </path>
107
108         <target name="run" depends="build">
109                 <java classname="net.sf.jabref.JabRefMain" fork="true">
110                         <classpath refid="classpath" />
111                 </java>
112         </target>
113
114         <!-- Runs project -->
115         <target name="runFromJar">
116                 <java dir="${build.lib}" classname="net.sf.jabref.JabRefMain" fork="true">
117                         <classpath>
118                                 <pathelement location="${build.lib}/${build.jar}" />
119                         </classpath>
120                 </java>
121         </target>
122
123         <!-- Compiles project -->
124         <target name="compile">
125                 <mkdir dir="${build.classes}" />
126                 <javac destdir="${build.classes}" encoding="UTF8" source="1.6" target="1.6">
127                         <src path="${java.dir}" />
128             <src path="${gen.dir}" />
129                         <classpath refid="classpath" />
130                 </javac>
131         </target>
132
133         <!-- Builds the OSXAdapter -->
134         <target name="osx" depends="compile">
135                 <mkdir dir="${build.classes}" />
136                 <javac srcdir="${osx.dir}" destdir="${build.classes}" target="1.6">
137                         <!-- Hack to force visibility of com.apple.eawt in rt.jar in JDK7 & 8
138                                  https://bugs.openjdk.java.net/browse/JDK-8008714 -->
139                         <compilerarg value="-XDignore.symbol.file"/>                    
140                 </javac>
141         </target>
142         
143         <!-- Copies in the OSXAdapter class, which is compilable only on Mac
144                  Development on other platforms should also be possible by using the 
145          distributed stub of com.apple.eawt as described in 
146          http://stackoverflow.com/questions/2151174/how-can-i-develop-apple-java-extensions-on-windows -->
147         <target name="non_osx">
148                 <mkdir dir="${build.classes.osx}" />
149                 <copy file="${osxbin.dir}/MacAdapter.class" todir="${build.classes.osx}" />
150         </target>
151
152         <target name="jars" depends="build, unjarlib" description="Jars up project">
153                 <mkdir dir="${build.lib}" />
154
155                 <mkdir dir="${build.tmp}" />
156                 <jar destfile="${build.lib}/${build.jar}" >
157
158                         <fileset dir="${build.classes}" />
159                         <fileset dir="${build.tmp}" />
160                         <fileset dir="${build.dir}">
161                                 <include name="images/**" />
162                                 <include name="help/**" />
163                                 <include name="resource/**" />
164                         </fileset>
165
166                         <!-- Add Plugins -->
167                         <fileset dir="${resources.dir}">
168                                 <include name="plugins/**" />
169                         </fileset>
170                         <fileset dir="${txt.dir}">
171                                 <include name="gpl2.txt" />
172                                 <include name="gpl3.txt" />
173                                 <include name="lesser.txt" />
174                                 <include name="jgoodies.txt" />
175                                 <include name="README" />
176                         </fileset>
177                         <manifest>
178                                 <attribute name="Main-Class" value="net.sf.jabref.JabRefMain" />
179                 <attribute name="Class-Path" value="." />
180                         </manifest>
181                 </jar>
182
183         </target>
184
185         <!-- updates version information with git information.
186              should be used in development builds only
187
188              Use "ant addgitinfo jars" to generate a jar with version information in the filename
189         -->
190         <target name="addgitinfo" description="Adds git version information in ${jabref.version} and ${build.jar}">
191                 <exec executable="git" searchpath="true" outputproperty="git.version" failifexecutionfails="true" errorproperty="">
192                         <arg value="log" />
193                         <arg value="-1" />
194                         <arg value="--pretty=format:%cd - %H" />
195                         <arg value="--date=iso" />
196                 </exec>
197                 <script language="javascript"><![CDATA[
198                         var gitVersion = project.getProperty("git.version");
199                         if ((gitVersion != undefined) && (gitVersion.length() > 0)) {
200                                 // convert "2012-12-16 15:44:07 +0100 - a249a226" to "2012-12-16 15.44.07 - a249a226"
201                                 gitVersion = gitVersion.substr(0,13) + "." + gitVersion.substr(14,2) + "." + gitVersion.substr(17, 2) + gitVersion.substr(25);
202
203                                 // we have to update the properties using JavaScript as properties are normally immutable
204                                 // Properties can be updated using JavaScript and not with the <property>-Task
205                                 var jabrefVersion = project.getProperty("jabref.version");
206                                 jabrefVersion = jabrefVersion + " - " + gitVersion;
207                                 project.setProperty("jabref.version", jabrefVersion);
208                                 project.setProperty("build.jar", "JabRef-" + jabrefVersion + ".jar");
209                         }
210                 ]]></script>
211         </target>
212
213         <!-- copy all necessary files and insert version informations -->
214         <target name="build" depends="compile, buildinfos" description="Build project">
215
216                 <mkdir dir="${build.resource}" />
217
218                 <copy todir="${build.resource}">
219                         <fileset dir="${resource.dir}">
220                                 <include name="**" />
221                         </fileset>
222                 </copy>
223                 <mkdir dir="${build.images}" />
224                 <copy todir="${build.images}">
225                         <fileset dir="${images.dir}">
226                                 <include name="**" />
227                         </fileset>
228                 </copy>
229
230                 <mkdir dir="${build.help}" />
231                 <copy todir="${build.help}">
232                         <fileset dir="${help.dir}" />
233                 </copy>
234
235                 <!-- Insert version informations -->
236                 <replace dir="${build.help}">
237                     <replacefilter
238                             token="${jabref.placeholder.version}"
239                                 value="${jabref.version}" />
240                     <replacefilter
241                             token="${jabref.placeholder.year}"
242                                 value="${jabref.year}" />
243                         <include name="**/About.html" />
244                 </replace>
245                 <replace dir="${build.openoffice.meta}" token="${jabref.placeholder.version}" value="${jabref.version}">
246                         <include name="meta.xml" />
247                 </replace>
248
249         </target>
250
251         <!-- generate and save some build infos !!! necessary for dynamic build infos !!! -->
252         <!-- todo : replace it by the replace task :-),
253           src/resource/build.properties = template
254           build/resource/build.properties = real info file
255         -->
256         <target name="buildinfos">
257                 <tstamp />
258                 <!-- get date -->
259                 <buildnumber />
260                 <!-- generate new build number -> build.number -->
261                 <echo message="build number = ${build.number}" />
262                 <!-- write the file, please do not edit this lines -->
263                 <echo file="${resource.dir}/build.properties">builddate=${TODAY}
264 build=${build.number}
265 version=${jabref.version}</echo>
266         </target>
267
268         <target name="extension-javadocs" depends="build" description="Generates the javadocs for the extensions archive">
269                 <mkdir dir="${build.extension-javadocs}" />
270                 <copy todir="${build.extension-javadocs}">
271                         <fileset dir="${help.dir}" defaultexcludes="yes">
272                                 <include name="CustomExports.html" />
273                                 <include name="CustomImports.html" />
274                         </fileset>
275                 </copy>
276
277                 <javadoc sourcepath="${java.dir}" destdir="${build.extension-javadocs}" author="true" version="true" windowtitle="JabRef-Extensions API" link="http://docs.oracle.com/javase/6/docs/api/" Overview="${extensions.dir}/API/overview.html" access="protected">
278                         <!--
279                  create javadoc only selectively for classes that
280                  users extending JabRef are likely to use
281               -->
282                         <fileset dir="${java.dir}" defaultexcludes="yes">
283                                 <include name="net/sf/jabref/imports/ImportFormat.java" />
284                                 <include name="net/sf/jabref/imports/ImportFormatReader.java" />
285                                 <include name="net/sf/jabref/BibtexEntry.java" />
286                                 <include name="net/sf/jabref/BibtexEntryType.java" />
287                                 <include name="net/sf/jabref/AuthorList.java" />
288                                 <include name="net/sf/jabref/AuthorList.java" />
289                                 <include name="net/sf/jabref/export/layout/LayoutFormatter.java" />
290                         </fileset>
291
292                         <classpath refid="classpath" />
293                 </javadoc>
294         </target>
295
296         <target name="extensions" depends="extension-javadocs" description="Generates the extensions archive">
297                 <copy todir="${build.extensions}" description="copy examples">
298                         <fileset dir="${java.dir}">
299                                 <include name="net/sf/jabref/export/layout/format/CurrentDate.java" />
300                                 <include name="net/sf/jabref/export/layout/format/ToLowerCase.java" />
301                                 <include name="net/sf/jabref/export/layout/format/HTMLChars.java" />
302                                 <include name="net/sf/jabref/imports/*Importer.java" />
303                         </fileset>
304                 </copy>
305                 <mkdir dir="${build.extension-layout}" />
306                 <copy todir="${build.extension-layout}">
307                         <fileset dir="${layout.dir}" />
308                 </copy>
309                 <copy todir="${build.extensions}">
310                         <fileset dir="${extensions.dir}" />
311                         <filterset>
312                                 <filter token="version" value="${jabref.version}" />
313                         </filterset>
314                 </copy>
315                 <zip destfile="${build.dir}/jabref-extensions.zip" description="create extensions-zip file">
316                         <zipfileset dir="${build.extensions}" prefix="jabref-extensions" />
317                 </zip>
318         </target>
319
320         <target name="clean" depends="win.installer.clean" description="Clean project">
321                 <delete dir="${build.dir}" />
322         </target>
323
324         <target name="unjarlib" description="Unpacks jars from lib directory into temp directory">
325                 <mkdir dir="${build.tmp}" />
326                 <unjar dest="${build.tmp}">
327                         <filelist refid="jars" />
328                 </unjar>
329                 <!-- done by MrDlib -->
330                 <delete includeEmptyDirs="true">
331                         <fileset refid="deletableMeta-InfFiles" />
332                 </delete>
333                 <!-- done by MrDlib -->
334                 <!-- rename the microba license file -->
335                 <move file="${build.tmp}/license.txt" tofile="${build.tmp}/microba-license.txt" />
336         </target>
337
338         <target name="java16test">
339                 <condition property="java16">
340                         <equals arg1="${ant.java.version}" arg2="1.6"/>
341                 </condition>
342         </target>
343
344         <target name="macbundle" depends="java16test, jars" unless="java16" description="creates a bundle made for the Oracle Apple JVM (1.7+)">
345                 <taskdef
346                         name="bundleapp"
347                         classname="com.oracle.appbundler.AppBundlerTask"
348                         classpath="${buildlib.dir}/appbundler-1.0.jar" />
349                 <bundleapp
350                         name="JabRef"
351                         mainclassname="net.sf.jabref.JabRef"
352                         outputdirectory="${build.lib}"
353                         displayname="JabRef"
354                         identifier="jabref.JabRef"
355                         icon="${images.dir}/JabRef-Logo.icns"
356                         shortversion="${jabref.version}">
357                         <classpath file="${build.lib}/JabRef-${jabref.version}.jar" />  
358                         <!-- Memory options apparently break the bundle 
359                         <option value="-Xms128m -Xmx512m" /> -->
360                 </bundleapp>
361                 <!-- We still need to hack the Info.plist to enable high resolution for Retina displays -->
362                 <replace file="${build.lib}/JabRef.app/Contents/Info.plist" 
363                         token="&lt;key&gt;JVMOptions&lt;/key&gt;"
364                         value="&lt;key&gt;NSHighResolutionCapable&lt;/key&gt;&#10;
365         &lt;true/&gt;&#10;&lt;key&gt;JVMOptions&lt;/key&gt;"/>
366                 <!-- We also need to add native support for bib files in the Info.plist -->
367                 <replace file="${build.lib}/JabRef.app/Contents/Info.plist" 
368                 token="&lt;key&gt;JVMOptions&lt;/key&gt;"
369                 value="&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;&#10;
370         &lt;array&gt;&#10;
371                 &lt;dict&gt;&#10;
372                         &lt;key&gt;CFBundleTypeName&lt;/key&gt;&#10;
373                         &lt;string&gt;BibTeX file&lt;/string&gt;&#10;
374                         &lt;key&gt;CFBundleTypeRole&lt;/key&gt;&#10;
375                         &lt;string&gt;Editor&lt;/string&gt;&#10;
376                         &lt;key&gt;CFBundleTypeIconFile&lt;/key&gt;&#10;
377                         &lt;string&gt;JabRef-Logo.icns&lt;/string&gt;&#10;
378                         &lt;key&gt;CFBundleTypeExtensions&lt;/key&gt;&#10;
379                         &lt;array&gt;&#10;
380                                 &lt;string&gt;bib&lt;/string&gt;&#10;
381                         &lt;/array&gt;&#10;
382                 &lt;/dict&gt;&#10;
383         &lt;/array&gt;&#10;
384         &lt;key&gt;JVMOptions&lt;/key&gt;"/>
385                 <zip basedir="${build.lib}"
386                         destfile="${build.lib}/JabRef-${jabref.version}-OSX.zip"
387                         excludes="JabRef.app/Contents/MacOS/JavaAppLauncher"
388                         includes="JabRef.app/"
389                         level="9">
390                         <zipfileset dir="${build.lib}" includes="JabRef.app/Contents/MacOS/JavaAppLauncher" filemode="755" />
391                 </zip>
392         </target>
393         
394         <target name="macbundle_java16" depends="jars" description="creates a bundle made for the Legacy Apple JVM (1.6)">
395                 <jarbundler dir="${build.lib}"
396                     name="JabRef_Java6"
397                     mainclass="net.sf.jabref.JabRef"
398                     jar="${build.lib}/${build.jar}"
399                     icon="${images.dir}/JabRef-Logo.icns"
400                     version="${jabref.version}"
401                     jvmversion="1.6+"
402                     vmoptions="-Xms128m -Xmx512m"
403                     stubfile="${osxbin.dir}/JavaApplicationStub"
404                     signature="JABr">
405             <documenttype name="BibTeX file" extensions="bib" role="Editor"
406                           iconFile="${images.dir}/JabRef-Logo.icns"/>
407         </jarbundler>
408         <!-- After running jarbundler we need to hack the Info.plist file: -->
409         <replace file="${build.lib}/JabRef_Java6.app/Contents/Info.plist" token="&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;"
410             value="&lt;key&gt;NSPrincipalClass&lt;/key&gt;${line.separator}
411    &lt;string&gt;NSApplication&lt;/string&gt;${line.separator}
412    &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;"/>
413                 <zip basedir="${build.lib}"
414                         destfile="${build.lib}/JabRef-${jabref.version}-OSX-Java6.zip"
415                         excludes="JabRef_Java6.app/Contents/MacOS/JavaApplicationStub"
416                         includes="JabRef_Java6.app/"
417                         level="9">
418                         <zipfileset dir="${build.lib}" includes="JabRef_Java6.app/Contents/MacOS/JavaApplicationStub" filemode="755" />
419                 </zip>
420         </target>
421
422
423         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
424         <!-- Build Windows Installer                                                    -->
425         <!--                                                                            -->
426         <!-- Don't forget to set nsis.executable and launch4j.dir properties            -->
427         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
428
429         <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
430                 <delete failonerror="false" dir="${win.installer.dir}/dist" />
431                 <delete file="${win.installer.dir}/JabRefSetup.exe" />
432         </target>
433
434         <target name="win.installer.win.pre" description="Precondition for win.installer on Windows">
435                 <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists" />
436         </target>
437
438         <target name="win.installer.step1" description="Gather everything that will go into the installer in dist">
439                 <mkdir dir="${win.installer.dir}/dist" />
440
441                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
442
443                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
444
445                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
446
447                 <copy todir="${win.installer.dir}/dist">
448                         <fileset dir="${txt.dir}">
449                                 <include name="gpl2.txt" />
450                                 <include name="gpl3.txt" />
451                                 <include name="lesser.txt" />
452                                 <include name="README" />
453                         </fileset>
454                 </copy>
455
456                 <!-- "Create Exe-Wrapper" -->
457
458                 <!-- first of all, update version information -->
459                 <script language="javascript"><![CDATA[
460                         // create new property with a maximum length of 50 characters
461                         var txtFileVersion = project.getProperty("jabref.version");
462                         if (txtFileVersion.length()>50) {
463                                 txtFileVersion = txtFileVersion.substring(0,50);
464                         }
465                         project.setProperty("txtFileVersion", txtFileVersion);
466                 ]]></script>
467                 <delete file="jabref-launch4j.tmp" />
468                 <copy file="jabref-launch4j.xml" tofile="jabref-launch4j.tmp" />
469                 <replace file="jabref-launch4j.tmp">
470                         <replacefilter token="1.1.1" value="${jabref.version}" />
471                         <replacefilter token="3.3.3" value="${txtFileVersion}" />
472                         <replacefilter token="2.2.2.2" value="${jabref.version.full}" />
473                         <replacefilter token="./" value="${basedir}/" />
474                 </replace>
475
476         </target>
477
478         <target name="win.installer.step2.linux" description="Create Windows launcher and Windows installer on Linux">
479                 <!-- launch4j ant task does not work as ld.exe gets the wrong path passed - see https://sourceforge.net/tracker/?func=detail&aid=3598164&group_id=95944&atid=613100 -->
480                 <exec
481                         executable="${launch4j.dir}/launch4j"
482                         dir="${launch4j.dir}">
483                         <arg value="${basedir}/jabref-launch4j.tmp"/>
484                 </exec>
485
486                 <!-- Finally create Windows-Installer -->
487                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
488                         <arg line="'-DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
489                 </exec>
490         </target>
491
492         <target name="win.installer.step2.win" description="Create Windows launcher and Windows installer on Windows">
493                 <!-- launch4j ant task does not work as ld.exe gets the wrong path passed - see https://sourceforge.net/tracker/?func=detail&aid=3598164&group_id=95944&atid=613100 -->
494                 <exec
495                         executable="${launch4j.dir}/launch4jc.exe"
496                         dir="${launch4j.dir}">
497                         <arg value="${basedir}/jabref-launch4j.tmp"/>
498                 </exec>
499
500                 <exec dir="." executable="${nsis.executable}" failonerror="true">
501                         <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
502                 </exec>
503         </target>
504
505         <target name="win.installer.step3">
506                 <move file="${win.installer.dir}/JabRefSetup.exe" tofile="${build.lib}/JabRef-${jabref.version}-setup.exe" />
507                 <delete dir="${win.installer.dir}/dist" />
508         </target>
509
510         <target name="win.installer" description="Copy files in place to be used by the installer" depends="win.installer.win.pre, jars, win.installer.step1, win.installer.step2.win, win.installer.step3">
511         </target>
512
513         <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars, win.installer.step1, win.installer.step2.linux, win.installer.step3">
514                 <delete dir="${win.installer.dir}/dist" />
515
516         </target>
517
518         <!--+++++++++++++++++++++++++++++++++++++++++++++++++
519            Auxiliary targets
520           +++++++++++++++++++++++++++++++++++++++++++++++++-->
521
522         <taskdef name="jarbundler" classpath="${buildlib.dir}/jarbundler-2.2.0.jar" classname="net.sourceforge.jarbundler.JarBundler" />
523
524         <macrodef name="compresssrc">
525         <attribute name="git-core-autocrlf" />
526         <attribute name="temp-dir" />
527         <attribute name="base-dir" />
528
529         <sequential>
530             <!-- clone current repo into tmp dir. Reason: we want to have a clean src.zip, but do not want to execute "git clean -xdf" to allow developers having some temporary files (and user.properties) -->
531             <mkdir dir="@{temp-dir}"/>
532             <echo message="@{temp-dir}" />
533             <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull">
534                 <arg value="clone" />
535                 <arg value="@{base-dir}" />
536                 <arg value="@{temp-dir}" />
537             </exec>
538
539             <!-- ensure correct line endings -->
540             <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="@{temp-dir}">
541                 <arg value="config" />
542                 <arg value="core.autocrlf" />
543                 <arg value="@{git-core-autocrlf}" />
544             </exec>
545             <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="@{temp-dir}">
546                 <arg value="rm" />
547                 <arg value="--cached" />
548                 <arg value="-r" />
549                 <arg value="." />
550             </exec>
551             <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="@{temp-dir}">
552                 <arg value="reset" />
553                 <arg value="--hard" />
554             </exec>
555         </sequential>
556         </macrodef>
557
558         <target name="zipsrc">
559                 <tempfile property="temp.dir" destDir="${java.io.tmpdir}" prefix="jabrefsrc" />
560                 <compresssrc git-core-autocrlf="true" temp-dir="${temp.dir}/jabref-${jabref.version}" base-dir="${basedir}" />
561                 <zip destfile="${build.lib}/JabRef-${jabref.version}-src.zip" basedir="${temp.dir}" level="9" />
562                 <delete dir="${temp.dir}" failonerror="no"/>
563         </target>
564
565         <target name="bzip2src">
566                 <tempfile property="temp.dir" destDir="${java.io.tmpdir}" prefix="jabrefsrc" />
567         <compresssrc git-core-autocrlf="false" temp-dir="${temp.dir}/jabref-${jabref.version}" base-dir="${basedir}" />
568                 <tar destfile="${build.lib}/JabRef-${jabref.version}-src.tar.bz2" basedir="${temp.dir}" excludes=".git/" compression="bzip2" />
569                 <delete dir="${temp.dir}" failonerror="no"/>
570         </target>
571
572         <target name="devsnapshot" depends="clean, addgitinfo, non_osx, win.installer, macbundle_java16, macbundle" description="creates development snapshot binaries" />
573
574         <target name="release" depends="clean, non_osx, win.installer, macbundle_java16, macbundle, bzip2src, zipsrc" description="Do a release on Windows. Creates all distribution files in ${build.lib}"/>
575         <target name="release.linux" depends="clean, non_osx, win.installer.linux, macbundle_java16, macbundle, bzip2src, zipsrc" description="Do a release on Linux. Creates all distribution files in ${build.lib}" />
576 </project>