Fix build.
[cyberduck.git] / build-windows.xml
blobfe3dadbe627951fcc2871461a20f45ca2674beac
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  *      $Revision$
4  *      $Date$
5  *
6  *  Copyright (c) 2005-2012 David Kocher. All rights reserved.
7  *  http://cyberduck.io/
8  *
9  *      This program is free software; you can redistribute it and/or modify
10  *      it under the terms of the GNU General Public License as published by
11  *      the Free Software Foundation; either version 2 of the License, or
12  *      (at your option) any later version.
13  *
14  *      This program is distributed in the hope that it will be useful,
15  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *      GNU General Public License for more details.
18  *
19  *      Bug fixes, suggestions and comments should be sent to:
20  *      dkocher@cyberduck.io
21  -->
22 <project name="Cyberduck for Windows" basedir=".">
24     <import file="build.xml"/>
26     <!-- try to detect the process architecture (32/64bit) -->
27     <condition property="programFiles" value="${env.ProgramFiles(x86)}">
28         <available file="${env.ProgramFiles(x86)}"/>
29     </condition>
30     <condition property="programFiles" value="${env.ProgramFiles}">
31         <available file="${env.ProgramFiles}"/>
32     </condition>
34     <property name="architecture" value="x86"/>
35     <property name="nsis.home" value="${programFiles}/NSIS"/>
36     <property name="winsdk.home" value="${programFiles}/Windows Kits/8.0/bin/x86"/>
37     <property name="wybuild.home" value="${programFiles}/wyBuild"/>
38     <property name="app.icon" value="cyberduck-application.ico"/>
40     <property name="jvm.runtime.bin" value="${java.home}/bin"/>
42     <taskdef name="msbuild" classname="org.apache.ant.dotnet.build.MSBuildTask">
43         <classpath path="${lib.ext}/ant-dotnet-1.1.jar"/>
44     </taskdef>
46     <target name="version" depends="revision">
47         <taskdef resource="net/sf/antcontrib/antcontrib.properties">
48             <classpath path="${lib.ext}/ant-contrib-1.0b3.jar"/>
49         </taskdef>
50         <propertyregex property="minor"
51                        input="${cyberduck.version.minor}.0"
52                        regexp="(\d)([\w\d]*)\.(\d)(\.\d)?"
53                        select="\1.\3"/>
54         <property name="version.full"
55                   value="${cyberduck.version.major}.${minor}.${revision}"/>
56         <property name="version.short"
57                   value="${version} (${revision})"/>
58         <!-- pattern = "[revision] ([major].[minor])" -->
59         <property name="updaterversion"
60                   value="${revision} (${version})"/>
61     </target>
63     <target name="_build" depends="dll">
64         <msbuild buildfile="source/ch/cyberduck/Cyberduck.csproj">
65             <target name="Clean"/>
66             <target name="Build"/>
68             <property name="Version" value="${version.full}"/>
69             <property name="ShortVersion" value="${version.short}"/>
70             <property name="Configuration" value="${configuration}"/>
71             <property name="Platform" value="${architecture}"/>
72         </msbuild>
73     </target>
75     <target name="_cli" depends="dll">
76         <msbuild buildfile="source/ch/cyberduck/CLI-WiX-Bootstrapper.wixproj">
77             <target name="Clean"/>
78             <target name="Build"/>
80             <property name="Version" value="${version.full}"/>
81             <property name="ShortVersion" value="${version.short}"/>
82             <property name="Configuration" value="${configuration}"/>
83             <property name="Platform" value="${architecture}"/>
84         </msbuild>
85         <checksum file="${build.deploy}/duck-${version.full}.exe" algorithm="md5"/>
86     </target>
88     <target name="dll" depends="archive, version">
89         <taskdef name="ikvmc" classname="net.ikvm.ant.IkvmcTask">
90             <classpath path="${lib.ext}/ant-ikvmc.0.5.jar"/>
91         </taskdef>
92         <ikvmc target="library" out="${build}/core.dll" home="${ikvm.home}"
93                version="${version.full}" debug="false" verbose="true">
94             <fileset file="${build}/config.jar"/>
95             <fileset file="${build}/core.jar"/>
96             <fileset file="${build}/cli.jar"/>
97             <fileset file="${build}/ui.jar"/>
98             <fileset dir="${lib}">
99                 <include name="*.jar"/>
100                 <exclude name="asm-*.jar"/>
101                 <exclude name="cglib-*.jar"/>
102                 <exclude name="dns_sd.jar"/>
103                 <exclude name="rococoa-*.jar"/>
104             </fileset>
105             <resource name="/com/sun/jna/win32-x86/jnidispatch.dll" path="${lib}/jnidispatch.dll"/>
106         </ikvmc>
107     </target>
109     <target name="package" depends="build">
110         <copy todir="${build}">
111             <fileset dir="${home}">
112                 <include name="*.ico"/>
113             </fileset>
114         </copy>
116         <loadfile property="changes" srcFile="${www.update}/changelog.txt"/>
118         <copy file="${www.update}/version.xml" todir="${build}" overwrite="true"/>
119         <replace file="${build}/version.xml" summary="true" encoding="UTF-8">
120             <replacefilter token="${VERSION}" value="${updaterversion}"/>
121             <replacefilter token="${CHANGES}" value="${changes}"/>
122             <replacefilter token="${BUILDPATH}" value="${build}"/>
123         </replace>
125         <!-- copy wyUpdate project over to the build directory -->
126         <copy file="${www.update}/${app.update.feed}/changelog.wyp" tofile="${build}/changelog.wyp" overwrite="true"/>
128         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true" dir="${build}">
129             <arg value="${build}/changelog.wyp"/>
130             <arg value="/bwu"/>
131             <arg value="/bu"/>
132             <arg value="-add=${build}/version.xml"/>
133         </exec>
135         <!-- overwrite generated wyUpdate.exe -->
136         <copy file="${www.update}/Updater.exe" todir="${build}/update" overwrite="true"/>
138         <property name="setup.file"
139                   location="${build.deploy}/${app.name}-Installer-${version}.${revision}.exe"/>
140         <exec executable="${nsis.home}/makensis" failonerror="true">
141             <arg value="/DBASEDIR=${build}"/>
142             <arg value="/DPRODUCT_VERSION=${version.short}"/>
143             <arg value="/DSETUPFILE=${setup.file}"/>
144             <arg value="${setup}/nsi/cyberduck.nsi"/>
145         </exec>
146         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
147             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${setup.file}"'/>
148         </exec>
149         <checksum file="${setup.file}" algorithm="md5"/>
150     </target>
152     <target name="updater-release">
153         <!-- Updater .NET4 build -->
154         <msbuild buildfile="${wyupdate.home}/wyUpdate.NET4.csproj">
155             <target name="Clean"/>
156             <target name="Build"/>
157             <property name="Configuration" value="Release"/>
158             <property name="Platform" value="x86"/>
159         </msbuild>
161         <copy file="${wyupdate.home}/bin4/Release/wyUpdate.exe" tofile="${www.update}/Updater.exe"/>
162         <!-- sign wyUpdate.exe with our code signing certificate -->
163         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
164             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${www.update}/Updater.exe"'/>
165         </exec>
167         <!-- copy wyUpdate project over to the build directory -->
168         <copy todir="${build.deploy}">
169             <fileset dir="${www.update}">
170                 <include name="updater.xml"/>
171                 <include name="updater.wyp"/>
172                 <include name="Updater.exe"/>
173             </fileset>
174         </copy>
175         <replace file="${build.deploy}/updater.xml" summary="true" encoding="UTF-8">
176             <replacefilter token="${VERSION}" value="${updater.version}"/>
177         </replace>
179         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true">
180             <arg value="${build.deploy}/updater.wyp"/>
181             <arg value="/bu"/>
182             <arg value="-add=${build.deploy}/updater.xml"/>
183         </exec>
184     </target>
185 </project>