1 <?xml version="1.0" encoding="UTF-8"?>
3 * Simple Ant (http://jakarta.apache.org/ant) build script for Cyberduck
8 * Copyright (c) 2005-2012 David Kocher. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.F
21 * Bug fixes, suggestions and comments should be sent to:
22 * dkocher@cyberduck.io
24 <project name="Cyberduck" default="build" basedir=".">
26 <property file="build.properties"/>
27 <property file="tools.properties"/>
29 <property environment="env"/>
31 <property name="app.name" value="${ant.project.name}"/>
33 <property name="debug" value="on"/>
34 <property name="home" location="."/>
35 <property name="unittests" value="${home}/test"/>
36 <property name="build" value="${home}/build"/>
37 <property name="build.compile.target" value="1.7"/>
38 <property name="configuration" value="release"/>
39 <property name="build.deploy" location="${build}/${configuration}"/>
40 <property name="build.bundles" value="${build.deploy}/bundles"/>
41 <property name="build.classes" value="${build}/classes"/>
42 <property name="build.unittests" value="${build}/test-classes"/>
43 <property name="build.unittests.reports" value="${build}/report"/>
44 <property name="config" value="${home}/config"/>
45 <property name="img" value="${home}/img"/>
46 <property name="lib" value="${home}/lib"/>
47 <property name="lib.ext" value="${lib}/ext"/>
48 <property name="source" value="${home}/source"/>
49 <property name="resources" value="${home}/resources"/>
50 <property name="doc" value="${home}/doc"/>
51 <property name="www" value="${home}/www"/>
52 <property name="www.update" value="${www}/update"/>
53 <property name="www.help" value="${www}/help"/>
54 <property name="setup" value="${home}/setup"/>
55 <property name="copyright" value="Copyright (c) 2001-2015 David Kocher"/>
56 <property name="version" value="${cyberduck.version.major}.${cyberduck.version.minor}"/>
58 <property name="sonar.host" value="sonar.cyberduck.io"/>
60 <condition property="platform" value="mac">
63 <condition property="platform" value="windows">
64 <os family="windows"/>
66 <condition property="platform" value="linux">
70 <import description="Platform specific targets" file="build-${platform}.xml"/>
72 <path id="test.classpath">
73 <path refid="build.classpath"/>
74 <pathelement location="${build.unittests}"/>
75 <pathelement location="${build}"/>
76 <fileset dir="${build}">
77 <include name="*.jar"/>
79 <fileset dir="${lib.ext}">
80 <include name="*.jar"/>
84 <path id="build.classpath">
85 <!-- Include all libraries -->
86 <fileset dir="${lib}">
87 <include name="*.jar"/>
93 <echo message=" ---------------------------------------------------------------"/>
94 <echo message=" Java Version: ${ant.java.version}"/>
95 <echo message=" Project Home: ${home}"/>
96 <echo message=" Project Build: ${build}"/>
97 <echo message=" Project Source: ${source}"/>
98 <echo message=" ---------------------------------------------------------------"/>
100 <echo message="Building ${app.name}..."/>
102 <mkdir dir="${build}"/>
103 <mkdir dir="${build.deploy}"/>
104 <mkdir dir="${build.classes}"/>
105 <mkdir dir="${build.unittests}"/>
106 <mkdir dir="${build.unittests.reports}"/>
107 <mkdir dir="${build.unittests.reports}/html"/>
110 <target name="build" description="Build GUI application"
111 depends="archive, _build"/>
113 <target name="cli" description="Build CLI application"
114 depends="archive, _cli"/>
116 <target name="timestamp">
118 <format property="touch.time"
119 pattern="dd/MM/yyyy hh:mm aa"
125 <target name="revision">
126 <echo message="Calculating revision..."/>
127 <exec dir="${home}" executable="svnversion" outputproperty="svn.revision" failonerror="true">
131 <taskdef resource="net/sf/antcontrib/antcontrib.properties">
132 <classpath path="${lib.ext}/ant-contrib-1.0b3.jar"/>
134 <!-- Remove any non-digits (e.g. a trailing M) from the current revision -->
135 <propertyregex property="revision"
136 input="${svn.revision}"
139 <echo message="svn.revision=${svn.revision}"/>
140 <property name="revision" value="${revision}"/>
141 <echo message="revision=${revision}"/>
142 <buildnumber file="build.number"/>
143 <echo message="Build number ${build.number}"/>
146 <target name="compile" depends="init" description="Compile the source tree">
148 includeantruntime="false"
152 target="${build.compile.target}"
153 source="${build.compile.target}"
157 destdir="${build.classes}">
158 <exclude name="com/sun/javafx/**"/>
159 <classpath refid="build.classpath"/>
163 <target name="archive" depends="compile, manifest" description="Create archives">
164 <jar jarfile="${build}/config.jar"
166 manifest="${build}/MANIFEST.MF">
167 <fileset dir="${lib}">
168 <include name="mime.types"/>
169 <include name="log4j-*.xml"/>
172 <jar jarfile="${build}/core.jar"
174 manifest="${build}/MANIFEST.MF">
175 <fileset dir="${build.classes}">
176 <include name="ch/cyberduck/core/**/*.class"/>
179 <jar jarfile="${build}/ui.jar"
181 manifest="${build}/MANIFEST.MF">
182 <fileset dir="${build.classes}/">
183 <include name="ch/cyberduck/ui/**/*.class"/>
184 <exclude name="ch/cyberduck/ui/cocoa/**/*.class"/>
187 <jar jarfile="${build}/cocoa.jar"
189 manifest="${build}/MANIFEST.MF">
190 <fileset dir="${build.classes}/">
191 <include name="ch/cyberduck/ui/cocoa/**/*.class"/>
195 <taskdef resource="net/sf/antcontrib/antcontrib.properties">
196 <classpath path="${lib.ext}/ant-contrib-1.0b3.jar"/>
198 <var name="manifest.lib.classpath" unset="true"/>
199 <manifestclasspath property="manifest.lib.classpath"
200 jarfile="${lib}/cli.jar">
201 <!-- Convert paths relative to target jarfile -->
202 <classpath refid="build.classpath"/>
204 <var name="manifest.build.classpath" unset="true"/>
205 <manifestclasspath property="manifest.build.classpath"
206 jarfile="${build}/cli.jar">
207 <!-- Convert paths relative to target jarfile -->
209 <fileset dir="${build}" includes="*.jar"/>
212 <jar jarfile="${build}/cli.jar"
214 <fileset dir="${build.classes}">
215 <include name="ch/cyberduck/cli/*.class"/>
218 <attribute name="Specification-Title" value="${app.name}"/>
219 <attribute name="Specification-Version" value="${version}"/>
220 <attribute name="Specification-Vendor" value="${copyright}"/>
221 <attribute name="Implementation-Version" value="${svn.revision}"/>
222 <attribute name="Main-Class" value="ch.cyberduck.cli.Terminal"/>
223 <attribute name="Class-Path" value="${manifest.lib.classpath} ${manifest.build.classpath}"/>
228 <target name="doc" depends="init" description="Generate Javadoc">
229 <mkdir dir="${doc}"/>
230 <javadoc packagenames="ch.cyberduck.*,com.*,org.*"
231 sourcepath="${source}"
236 windowtitle="${app.name} API"
237 doctitle="${app.name}"
238 bottom="${copyright}">
239 <classpath refid="build.classpath"/>
243 <target name="clean" description="Delete compiled classes, jar files, jni libraries and application bundle">
244 <delete dir="${build}"/>
247 <target name="manifest" depends="revision" description="Create manifest file">
248 <manifest file="${build}/MANIFEST.MF">
249 <attribute name="Specification-Title" value="${app.name}"/>
250 <attribute name="Specification-Version" value="${version}"/>
251 <attribute name="Specification-Vendor" value="${copyright}"/>
252 <attribute name="Implementation-Version" value="${svn.revision}"/>
256 <target name="test-compile" depends="build">
257 <javac debug="${debug}"
258 includeantruntime="false"
260 target="${build.compile.target}"
261 source="${build.compile.target}"
263 srcdir="${unittests}"
264 destdir="${build.unittests}"
265 includes="**/*.java">
266 <classpath refid="test.classpath"/>
270 <target name="test" depends="test-compile" description="Runs all tests">
271 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
272 <classpath path="${lib.ext}/junit-4.11.jar"/>
273 <classpath path="${lib.ext}/hamcrest-core-1.3.jar"/>
275 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
276 <classpath path="${lib.ext}/jacocoant.jar"/>
278 <copy todir="${build}">
279 <fileset dir="${lib}">
280 <!-- Include libjnidispatch.dylib -->
281 <include name="*.dylib"/>
284 <echo message="Running tests with ${jvm.runtime.bin}/java"/>
285 <jacoco:coverage destfile="${build}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant">
286 <junit jvm="${jvm.runtime.bin}/java" fork="yes" forkmode="once"
287 printsummary="on" filtertrace="on"
288 haltonfailure="no" failureproperty="test.failed"
291 <classpath refid="test.classpath"/>
292 <formatter type="plain" usefile="false"/>
293 <formatter type="xml" extension=".xml" usefile="true"/>
294 <batchtest todir="${build.unittests.reports}">
295 <fileset dir="${build.unittests}">
296 <include name="**/*Test.class"/>
299 <sysproperty key="java.library.path" value="${build}"/>
300 <sysproperty key="jna.library.path" value="${build}"/>
301 <sysproperty key="s3.key" value="${s3.key}"/>
302 <sysproperty key="s3.secret" value="${s3.secret}"/>
303 <sysproperty key="rackspace.key" value="${rackspace.key}"/>
304 <sysproperty key="rackspace.secret" value="${rackspace.secret}"/>
305 <sysproperty key="hpcloud.key" value="${hpcloud.key}"/>
306 <sysproperty key="hpcloud.secret" value="${hpcloud.secret}"/>
307 <sysproperty key="hpcloud.user" value="${hpcloud.user}"/>
308 <sysproperty key="hpcloud.password" value="${hpcloud.password}"/>
309 <sysproperty key="webdav.user" value="${webdav.user}"/>
310 <sysproperty key="webdav.password" value="${webdav.password}"/>
311 <sysproperty key="ftp.user" value="${ftp.user}"/>
312 <sysproperty key="ftp.password" value="${ftp.password}"/>
313 <sysproperty key="sftp.user" value="${sftp.user}"/>
314 <sysproperty key="sftp.password" value="${sftp.password}"/>
315 <sysproperty key="sftp.key" value="${sftp.key}"/>
316 <sysproperty key="sftp.key.openssh.rsa" value="${sftp.key.openssh.rsa}"/>
317 <sysproperty key="sftp.key.openssh.ecdsa" value="${sftp.key.openssh.ecdsa}"/>
318 <sysproperty key="sftp.key.putty" value="${sftp.key.putty}"/>
319 <sysproperty key="google.projectid" value="${google.projectid}"/>
320 <sysproperty key="google.accesstoken" value="${google.accesstoken}"/>
321 <sysproperty key="google.refreshtoken" value="${google.refreshtoken}"/>
322 <sysproperty key="azure.account" value="${azure.account}"/>
323 <sysproperty key="azure.key" value="${azure.key}"/>
324 <sysproperty key="oraclecloud.key" value="${oraclecloud.key}"/>
325 <sysproperty key="oraclecloud.secret" value="${oraclecloud.secret}"/>
326 <sysproperty key="evault.s3.key" value="${evault.s3.key}"/>
327 <sysproperty key="evault.s3.secret" value="${evault.s3.secret}"/>
328 <sysproperty key="evault.openstack.key" value="${evault.openstack.key}"/>
329 <sysproperty key="evault.openstack.secret" value="${evault.openstack.secret}"/>
332 <junitreport todir="${build.unittests.reports}/html">
333 <fileset dir="${build.unittests.reports}">
334 <include name="TEST-*.xml"/>
336 <report format="frames" todir="${build.unittests.reports}/html"/>
338 <!--<fail message="Test failure detected" if="test.failed"/>-->
341 <target name="sonar" depends="test" description="Run Sonar">
342 <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
343 <classpath path="${lib.ext}/sonar-ant-task-2.1.jar"/>
345 <property name="sonar.projectName" value="${app.name}"/>
346 <property name="sonar.projectKey" value="ch.cyberduck:cyberduck-${platform}"/>
347 <property name="sonar.projectVersion" value="${svn.revision}"/>
348 <property name="sonar.sources" value="${source}"/>
349 <property name="sonar.tests" value="${unittests}"/>
350 <property name="sonar.binaries" value="${build.classes}"/>
351 <property name="sonar.junit.reportsPath" value="${build.unittests.reports}"/>
352 <pathconvert property="sonar.libraries" refid="build.classpath" pathsep=","/>
353 <property name="sonar.host.url" value="https://${sonar.host}"/>
354 <property name="sonar.jdbc.url"
355 value="jdbc:mysql://${sonar.host}:3306/sonar?useUnicode=true&characterEncoding=utf8"/>
356 <property name="sonar.jdbc.username" value="sonar"/>
357 <property name="sonar.jdbc.password" value="sonar"/>
358 <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver"/>
359 <property name="sonar.dynamicAnalysis" value="reuseReports"/>
360 <property name="sonar.core.codeCoveragePlugin" value="jacoco"/>
361 <property name="sonar.jacoco.reportPath" value="${build}/jacoco.exec"/>
362 <property name="sonar.jacoco.antTargets" value="test"/>
363 <property name="sonar.links.homepage" value="http://cyberduck.io"/>
364 <property name="sonar.links.ci" value="https://ci.cyberduck.io"/>
365 <property name="sonar.links.issue" value="https://trac.cyberduck.io"/>
366 <property name="sonar.scm.url" value="scm:svn:http://svn.cyberduck.io/trunk"/>
367 <property name="sonar.links.scm" value="https://svn.cyberduck.io"/>
368 <property name="sonar.links.scm_dev" value="https://svn.cyberduck.io"/>
369 <sonar:sonar xmlns:sonar="antlib:org.sonar.ant"/>