git-svn-id: https://svn.cyberduck.io/trunk@16122 9e2dff1d-8f06-0410-b5b1-4d70b6340adc
[cyberduck.git] / build-windows.xml
blob2083f2dd7e8bfacfbfe2940a1fc706ce58627a36
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         <loadfile property="changes" srcFile="${www.update}/changelog.txt"/>
112         <copy file="${www.update}/version.xml" todir="${build}" overwrite="true"/>
113         <replace file="${build}/version.xml" summary="true" encoding="UTF-8">
114             <replacefilter token="${VERSION}" value="${updaterversion}"/>
115             <replacefilter token="${CHANGES}" value="${changes}"/>
116             <replacefilter token="${BUILDPATH}" value="${build}"/>
117         </replace>
119         <!-- copy wyUpdate project over to the build directory -->
120         <copy file="${www.update}/${app.update.feed}/changelog.wyp" tofile="${build}/changelog.wyp" overwrite="true"/>
122         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true" dir="${build}">
123             <arg value="${build}/changelog.wyp"/>
124             <arg value="/bwu"/>
125             <arg value="/bu"/>
126             <arg value="-add=${build}/version.xml"/>
127         </exec>
129         <!-- overwrite generated wyUpdate.exe -->
130         <copy file="${www.update}/Updater.exe" todir="${build}/update" overwrite="true"/>
132         <property name="setup.file"
133                   location="${build.deploy}/${app.name}-Installer-${version}.${revision}.exe"/>
134         <exec executable="${nsis.home}/makensis" failonerror="true">
135             <arg value="/DBASEDIR=${build}"/>
136             <arg value="/DPRODUCT_VERSION=${version.short}"/>
137             <arg value="/DSETUPFILE=${setup.file}"/>
138             <arg value="${setup}/cyberduck.nsi"/>
139         </exec>
140         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
141             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${setup.file}"'/>
142         </exec>
143         <checksum file="${setup.file}" algorithm="md5"/>
144     </target>
146     <target name="updater-release">
147         <!-- Updater .NET4 build -->
148         <msbuild buildfile="${wyupdate.home}/wyUpdate.NET4.csproj">
149             <target name="Clean"/>
150             <target name="Build"/>
151             <property name="Configuration" value="Release"/>
152             <property name="Platform" value="x86"/>
153         </msbuild>
155         <copy file="${wyupdate.home}/bin4/Release/wyUpdate.exe" tofile="${www.update}/Updater.exe"/>
156         <!-- sign wyUpdate.exe with our code signing certificate -->
157         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
158             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${www.update}/Updater.exe"'/>
159         </exec>
161         <!-- copy wyUpdate project over to the build directory -->
162         <copy todir="${build.deploy}">
163             <fileset dir="${www.update}">
164                 <include name="updater.xml"/>
165                 <include name="updater.wyp"/>
166                 <include name="Updater.exe"/>
167             </fileset>
168         </copy>
169         <replace file="${build.deploy}/updater.xml" summary="true" encoding="UTF-8">
170             <replacefilter token="${VERSION}" value="${updater.version}"/>
171         </replace>
173         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true">
174             <arg value="${build.deploy}/updater.wyp"/>
175             <arg value="/bu"/>
176             <arg value="-add=${build.deploy}/updater.xml"/>
177         </exec>
178     </target>
179 </project>