-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.xml
192 lines (169 loc) · 6.59 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0"?>
<project name="Auto Screenshot">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- Properties: -->
<!-- <property file="local.properties"/> -->
<loadproperties srcfile="local.properties" encoding="UTF-8">
<filterchain>
<escapeunicode />
</filterchain>
</loadproperties>
<condition property="os_family" value="Windows">
<os family="windows" />
</condition>
<condition property="os_family" value="Linux">
<os family="unix" />
</condition>
<condition property="is_windows">
<os family="windows"/>
</condition>
<condition property="is_linux">
<os family="unix"/>
</condition>
<!--<property name="build_dir" location="build"/>-->
<property name="build_dir" location="build/files"/>
<property name="releases_dir" location="releases"/>
<property name="zip_dir" location="build/zip"/>
<property name="test_dir" location="Test"/>
<property name="temp_dir" location="build/temp"/>
<!-- #ProgramVersion=$(grep -Po '\<StringTable.+ ProductVersion="\K[0-9\.]+' AutoScreenshot.lpi) -->
<exec executable="git" outputproperty="version">
<arg value="describe"/>
<arg value="--dirty"/>
<!-- <arg value=" - - long"/> -->
</exec>
<condition property="executable" value="AutoScreenshot.exe">
<os family="windows" />
</condition>
<condition property="executable" value="AutoScreenshot">
<os family="unix" />
</condition>
<condition property="build_mode" value="Release (32bit)">
<os family="windows" />
</condition>
<condition property="build_mode" value="Release">
<os family="unix" />
</condition>
<condition property="lazbuild_path" value="${lazarus_dir}/lazbuild.exe">
<os family="windows" />
</condition>
<condition property="lazbuild_path" value="lazbuild">
<os family="unix" />
</condition>
<property name="libeay32_dll.sha1" value="be25d0575530aab50b0bb96571ea52124bdaaf77"/>
<property name="ssleay32_dll.sha1" value="61f6e4c18415a86e152d4f6453b513111866b505"/>
<property name="ssl_dlls.download_url" value="https://github.com/IndySockets/OpenSSL-Binaries/raw/master/Archive/openssl-1.0.2j-i386-win32.zip"/>
<!-- Targets: -->
<target name="clean">
<delete dir="${build_dir}"/>
<delete dir="lib"/>
<delete file="${executable}"/>
<delete dir="${temp_dir}"/>
</target>
<target name="init" depends="clean">
<!-- <echoproperties/> -->
<echo>Program version: ${version}</echo>
<mkdir dir="${build_dir}"/>
<mkdir dir="${releases_dir}"/>
<mkdir dir="${zip_dir}"/>
<mkdir dir="${temp_dir}"/>
</target>
<target name="build" depends="init" description="Compile executable">
<echo>Compile executable</echo>
<exec executable="${lazbuild_path}">
<arg value="--build-mode=${build_mode}"/>
<!--<arg value="- - verbose"/>-->
<arg value="AutoScreenshot.lpi"/>
</exec>
</target>
<target name="build_tests">
<echo>Compile tests</echo>
<exec executable="${lazbuild_path}" dir="${test_dir}">
<arg value="AutoScreenshotTest.lpi"/>
</exec>
</target>
<target name="tests" depends="build_tests" description="Run all unit tests">
<echo>Run tests</echo>
<condition property="test_executable_filename" value="AutoScreenshotTest.exe">
<os family="windows" />
</condition>
<condition property="test_executable_filename" value="AutoScreenshotTest">
<os family="unix" />
</condition>
<!-- <exec executable="${test_executable_filename}" dir="${test_dir}" failonerror="true"> -->
<exec executable="${test_dir}/${test_executable_filename}" failonerror="true">
<arg value="--all"/>
<arg value="--format=plain"/>
</exec>
</target>
<target name="zip" depends="download_ssl_dlls, build, tests" description="Pack all to ZIP archive">
<copy file="${executable}" todir="${build_dir}" preservelastmodified="true"/>
<if>
<equals arg1="${os_family}" arg2="Windows" />
<then>
<copy file="libeay32.dll" todir="${build_dir}" preservelastmodified="true"/>
<copy file="ssleay32.dll" todir="${build_dir}" preservelastmodified="true"/>
<copy file="sqlite3.dll" todir="${build_dir}" preservelastmodified="true"/>
</then>
</if>
<mkdir dir="${build_dir}/lang"/>
<copy todir="${build_dir}/lang" preservelastmodified="true">
<fileset dir="lang" includes="*.ini"/>
</copy>
<copy todir="${build_dir}/sounds" preservelastmodified="true">
<fileset dir="sounds" includes="*.wav"/>
</copy>
<copy todir="${temp_dir}/AutoScreenshot_${version}" preservelastmodified="true">
<fileset dir="${build_dir}" includes="**"/>
</copy>
<zip basedir="${temp_dir}" destfile="${zip_dir}/AutoScreenshot_${version}_${os_family}_portable.zip" level="9"/>
</target>
<target name="installer" depends="download_ssl_dlls, build, tests" description="Make installer file (Windows only)" if="is_windows">
<!--<if>
<os family="windows"/>
<then>-->
<exec executable="${inno_setup_dir}/ISCC.exe" failonerror="true">
<!--<env key="LazarusDir" value="${lazarus_dir}"/>-->
<arg value="/DRevision=${version}"/>
<arg value="setup.iss"/>
</exec>
<!--</then>
<else>
<fail>Target not supported on this OS</fail>
</else>
</if>-->
</target>
<target name="download_ssl_dlls" depends="check_ssl_dlls_checksum, init" unless="${ssl_dlls.checksum_is_ok}" if="is_windows">
<echo>Start download OpenSSL binaries archive</echo>
<tempfile property="zip_temp_file" prefix="openssl_" suffix=".zip" destdir="${temp_dir}" deleteonexit="true"/>
<echo>zip_temp_file: ${zip_temp_file}</echo>
<get src="${ssl_dlls.download_url}" dest="${zip_temp_file}" verbose="on"/>
<unzip src="${zip_temp_file}" dest="" overwrite="true">
<patternset>
<include name="libeay32.dll"/>
<include name="ssleay32.dll"/>
</patternset>
</unzip>
<!-- Todo: Check dll sums after download -->
</target>
<target name="check_ssl_dlls_available">
<condition property="ssl_dlls.is_available">
<and>
<available file="libeay32.dll"/>
<available file="ssleay32.dll"/>
</and>
</condition>
<echo>SSL dlls exists: ${ssl_dlls.is_available}</echo>
</target>
<target name="check_ssl_dlls_checksum" depends="check_ssl_dlls_available" if="ssl_dlls.is_available">
<checksum file="libeay32.dll" algorithm="SHA-1" property="${libeay32_dll.sha1}" verifyProperty="libeay32_dll.checksum_is_ok"/>
<checksum file="ssleay32.dll" algorithm="SHA-1" property="${ssleay32_dll.sha1}" verifyProperty="ssleay32_dll.checksum_is_ok"/>
<condition property="ssl_dlls.checksum_is_ok">
<and>
<equals arg1="${libeay32_dll.checksum_is_ok}" arg2="true" />
<equals arg1="${ssleay32_dll.checksum_is_ok}" arg2="true" />
</and>
</condition>
<echo>SSL dll checksums are valid: ${ssl_dlls.checksum_is_ok}</echo>
</target>
</project>