Merge pull request #48 in ITERATE/cyberduck from feature/fixEncoding to master
[cyberduck.git] / build-windows.xml
bloba29fb183675672c9426087dd91ee0b21b0b5355c
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.1/bin/x86"/>
37     <property name="wybuild.home" value="${programFiles}/wyBuild"/>
38     <property name="ikvm.home" value="${lib}/ikvm-8.1.5717.0"/>
39     <property name="app.icon" value="cyberduck-application.ico"/>
41     <property name="jvm.runtime.bin" value="${java.home}/bin"/>
42     <property name="cpack.bin" value="${env.ChocolateyInstall}/bin/cpack"/>
44     <property name="chocolatey.source" value="${setup}/chocolatey"/>
45     <property name="chocolatey.target" value="${build.deploy}"/>
47     <taskdef name="msbuild" classname="org.apache.ant.dotnet.build.MSBuildTask">
48         <classpath path="${lib.ext}/ant-dotnet-1.1.jar"/>
49     </taskdef>
51     <target name="version" depends="revision">
52         <taskdef resource="net/sf/antcontrib/antcontrib.properties">
53             <classpath path="${lib.ext}/ant-contrib-1.0b3.jar"/>
54         </taskdef>
55         <propertyregex property="minor"
56                        input="${cyberduck.version.minor}.0"
57                        regexp="(\d)([\w\d]*)\.(\d)(\.\d)?"
58                        select="\1.\3"/>
59         <property name="version.full"
60                   value="${cyberduck.version.major}.${minor}.${revision}"/>
61         <property name="version.short"
62                   value="${version} (${revision})"/>
63         <!-- pattern = "[revision] ([major].[minor])" -->
64         <property name="updaterversion"
65                   value="${revision} (${version})"/>
66     </target>
68     <target name="_build" depends="dll">
69         <msbuild buildfile="source/ch/cyberduck/Cyberduck.csproj">
70             <target name="Clean"/>
71             <target name="Build"/>
73             <property name="Version" value="${version.full}"/>
74             <property name="ShortVersion" value="${version.short}"/>
75             <property name="Configuration" value="${configuration}"/>
76             <property name="Platform" value="${architecture}"/>
77         </msbuild>
78         <!-- create DLL -->
79         <msbuild buildfile="source/ch/cyberduck/Cyberduck.csproj">
80             <target name="Clean"/>
81             <target name="Build"/>
83             <property name="Version" value="${version.full}"/>
84             <property name="ShortVersion" value="${version.short}"/>
85             <property name="Configuration" value="${configuration}"/>
86             <property name="Platform" value="${architecture}"/>
87             <property name="OutputType" value="Library"/>
88         </msbuild>
89     </target>
91     <target name="_cli" depends="dll">
92         <msbuild buildfile="source/ch/cyberduck/CLI-WiX-Bootstrapper.wixproj">
93             <target name="Clean"/>
94             <target name="Build"/>
96             <property name="Version" value="${version.full}"/>
97             <property name="ShortVersion" value="${version.short}"/>
98             <property name="Configuration" value="${configuration}"/>
99             <property name="Platform" value="${architecture}"/>
100         </msbuild>
101         <checksum file="${build.deploy}/duck-${version.full}.exe" algorithm="md5"/>
103         <copy todir="${chocolatey.target}">
104             <fileset dir="${chocolatey.source}">
105                 <include name="*/**"/>
106             </fileset>
107         </copy>
108         <replace dir="${chocolatey.target}" summary="true" encoding="UTF-8">
109             <include name="*.nuspec"/>
110             <include name="tools/*.ps1"/>
111             <replacefilter token="${VERSION}" value="${version}"/>
112             <replacefilter token="${REVISION}" value="${revision}"/>
113         </replace>
114         <exec executable="${cpack.bin}" dir="${chocolatey.target}" failonerror="true"/>
115     </target>
117     <target name="dll" depends="archive, version">
118         <taskdef name="ikvmc" classname="net.ikvm.ant.IkvmcTask">
119             <classpath path="${lib.ext}/ant-ikvmc.0.5.jar"/>
120         </taskdef>
121         <ikvmc target="library" out="${build}/Cyberduck.Core.dll" home="${ikvm.home}"
122                version="${version.full}" debug="false" verbose="true">
123             <fileset file="${build}/config-${version}.jar"/>
124             <fileset file="${build}/core-${version}.jar"/>
125             <fileset file="${build}/fs-${version}.jar"/>
126             <fileset file="${build}/cli-${version}.jar"/>
127             <fileset file="${build}/ui-${version}.jar"/>
128             <fileset dir="${lib}">
129                 <include name="*.jar"/>
130                 <include name="1.8.0*/Contents/Home/lib/ext/sunec.jar"/>
131                 <exclude name="asm-*.jar"/>
132                 <exclude name="cglib-*.jar"/>
133                 <exclude name="dns_sd.jar"/>
134                 <exclude name="rococoa-*.jar"/>
135             </fileset>
136             <resource name="/com/sun/jna/win32-x86/jnidispatch.dll" path="${lib}/jnidispatch.dll"/>
137         </ikvmc>
138     </target>
140     <target name="package" depends="build">
141         <copy todir="${build}">
142             <fileset dir="${home}">
143                 <include name="*.ico"/>
144             </fileset>
145         </copy>
147         <loadfile property="changes" srcFile="${www.update}/changelog.txt"/>
149         <copy file="${www.update}/version.xml" todir="${build}" overwrite="true"/>
150         <replace file="${build}/version.xml" summary="true" encoding="UTF-8">
151             <replacefilter token="${VERSION}" value="${updaterversion}"/>
152             <replacefilter token="${CHANGES}" value="${changes}"/>
153             <replacefilter token="${BUILDPATH}" value="${build}"/>
154         </replace>
156         <!-- copy wyUpdate project over to the build directory -->
157         <copy file="${www.update}/${app.update.feed}/changelog.wyp" tofile="${build}/changelog.wyp" overwrite="true"/>
159         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true" dir="${build}">
160             <arg value="${build}/changelog.wyp"/>
161             <arg value="/bwu"/>
162             <arg value="/bu"/>
163             <arg value="-add=${build}/version.xml"/>
164         </exec>
166         <!-- overwrite generated wyUpdate.exe -->
167         <copy file="${www.update}/Updater.exe" todir="${build}/update" overwrite="true"/>
169         <property name="setup.file"
170                   location="${build.deploy}/${app.name}-Installer-${version}.${revision}.exe"/>
171         <exec executable="${nsis.home}/makensis" failonerror="true">
172             <arg value="/DBASEDIR=${build}"/>
173             <arg value="/DPRODUCT_VERSION=${version}"/>
174             <arg value="/DSETUPFILE=${setup.file}"/>
175             <arg value="${setup}/nsi/cyberduck.nsi"/>
176         </exec>
177         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
178             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${setup.file}"'/>
179         </exec>
180         <checksum file="${setup.file}" algorithm="md5"/>
181     </target>
183     <target name="updater-release">
184         <!-- Updater .NET4 build -->
185         <msbuild buildfile="${wyupdate.home}/wyUpdate.NET4.csproj">
186             <target name="Clean"/>
187             <target name="Build"/>
188             <property name="Configuration" value="Release"/>
189             <property name="Platform" value="x86"/>
190         </msbuild>
192         <copy file="${wyupdate.home}/bin4/Release/wyUpdate.exe" tofile="${www.update}/Updater.exe"/>
193         <!-- sign wyUpdate.exe with our code signing certificate -->
194         <exec executable="${winsdk.home}/signtool.exe" failonerror="true">
195             <arg line='sign /r "StartCom" /tr http://timestamp.globalsign.com/scripts/timestamp.dll "${www.update}/Updater.exe"'/>
196         </exec>
198         <!-- copy wyUpdate project over to the build directory -->
199         <copy todir="${build.deploy}">
200             <fileset dir="${www.update}">
201                 <include name="updater.xml"/>
202                 <include name="updater.wyp"/>
203                 <include name="Updater.exe"/>
204             </fileset>
205         </copy>
206         <replace file="${build.deploy}/updater.xml" summary="true" encoding="UTF-8">
207             <replacefilter token="${VERSION}" value="${updater.version}"/>
208         </replace>
210         <exec executable="${wybuild.home}/wybuild.cmd.exe" failonerror="true">
211             <arg value="${build.deploy}/updater.wyp"/>
212             <arg value="/bu"/>
213             <arg value="-add=${build.deploy}/updater.xml"/>
214         </exec>
215     </target>
216 </project>