forked from kochedykov/jlibmodbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
239 lines (220 loc) · 8.37 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 "Invertor" Factory", JSC
[http://www.sbp-invertor.ru]
This file is part of JLibModbus.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Authors: Vladislav Y. Kochedykov, software engineer.
email: vladislav.kochedykov@gmail.com
-->
<project name="JLibModbus" basedir="." default="jar">
<property name="java.version" value="1.6"/>
<property name="build.name" value="jlibmodbus"/>
<property name="build.info" value="${basedir}${file.separator}project.properties"/>
<property name="build.src" value="${basedir}${file.separator}src"/>
<property name="build.packages" value="com.intelligt.modbus.jlibmodbus.*"/>
<property name="build.lib" value="${basedir}${file.separator}lib"/>
<property name="build.dir" value="${basedir}${file.separator}build"/>
<property name="build.classes" value="${build.dir}${file.separator}classes"/>
<property name="build.javadoc" value="${build.dir}${file.separator}javadoc"/>
<property file="build.properties"/>
<property file="build.version"/>
<property file="build.deprecation"/>
<property file="build.copyright"/>
<property file="build.number"/>
<property name="dist.dir" value="${basedir}${file.separator}dist"/>
<tstamp>
<format property="build.time" pattern="MM.dd.yyyy HH:mm" timezone="Asia/Yekaterinburg"/>
</tstamp>
<property name="version" value="${build.version}.${build.number}"/>
<property name="build.jar" value="${build.dir}/${build.name}-${version}.jar"/>
<path id="build.classpath">
<fileset dir="${build.lib}">
<include name="*.jar"/>
</fileset>
</path>
<condition property="build.sysinfo" value="Microsoft Windows">
<os family="windows" />
</condition>
<target name="sysinfo" unless="build.sysinfo">
<property name="exec.uname" value="uname" />
<exec executable="${exec.uname}" outputproperty="build.sysinfo"><arg value="-a"/></exec>
</target>
<target name="init" depends="sysinfo">
<property name="exec.whoami" value="whoami"/>
<exec executable="${exec.whoami}" outputproperty="build.user"/>
</target>
<target name="buildinfo" depends="init">
<delete file="${build.info}"/>
<propertyfile file="${build.info}"
comment="DO NOT EDIT - this file is automatically generated.">
<entry key="buildtime" value="${build.time}"/>
<entry key="builder" value="${build.user}"/>
<entry key="version" value="${version}"/>
<entry key="system" value="${build.sysinfo}"/>
</propertyfile>
</target>
<target name="prepare-build" depends="clean-build,buildinfo">
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" description="compiles the source files" depends="clean-classes,prepare-build">
<echo level="info"
message="
Project name: ${ant.project.name} ${line.separator}
Build time: ${build.time} ${line.separator}
User: ${build.user} ${line.separator}
System: ${build.sysinfo} ${line.separator}
"
/>
<echo file="${build.src}${file.separator}com${file.separator}intelligt${file.separator}modbus${file.separator}jlibmodbus${file.separator}Version.java"
append="false">package com.intelligt.modbus.jlibmodbus;
/*
* Copyright (C) 2016 "Invertor" Factory", JSC
* [http://www.sbp-invertor.ru]
*
* This file is part of JLibModbus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Authors: Vladislav Y. Kochedykov, software engineer.
* email: vladislav.kochedykov@gmail.com
*/
/**
* A class to keep the current version in.
* It's an auto generated class, which used by
* Modbus.getVersion().
*
* @since 1.2.3
*/
class Version {
private static final String version = "${version}";
/**
* returns the current version of the JLibModbus library
*
* @return a string representing the version
*/
public static String getVersion() {
return version;
}
}
</echo>
<mkdir dir="${build.classes}"/>
<javac includeantruntime="false"
encoding="UTF-8"
srcdir="${build.src}"
destdir="${build.classes}"
debug="${build.debug}"
optimize="${build.optimize}"
deprecation="${build.deprecation}">
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="jar" depends="clean-jar,compile">
<jar destfile="${build.jar}" basedir="${build.classes}"/>
</target>
<target name="javadoc" description="generates the javadoc documentation." depends="clean-javadoc,prepare-build">
<mkdir dir="${build.javadoc}"/>
<javadoc packagenames="${build.packages}"
encoding="UTF-8"
sourcepath="${build.src}"
classpath="${build.classpath}"
destdir="${build.javadoc}"
author="true"
version="true"
windowtitle="${ant.project.name}"
doctitle="${ant.project.name} API documentation"
header="<a href='http://jlibmodbus.sourceforge.net' target='_top'>jlibmodbus at sourceforge.net</a>"
bottom="${build.copyright}"
/>
</target>
<target name="prepare-dist">
<mkdir dir="${dist.dir}"/>
</target>
<target name="dist-jar" depends="prepare-dist,jar">
<copy file="${build.jar}" todir="${dist.dir}"/>
</target>
<target name="dist-source" depends="prepare-dist" description="Builds a tar-gzip binary distribution file.">
<property name="dist.src" value="${dist.dir}${file.separator}${build.name}-${version}-src" />
<property name="dist.src.tar" value="${dist.src}.tar" />
<property name="dist.src.tar.gz" value="${dist.src.tar}.gz" />
<property name="dist.src.zip" value="${dist.src}.zip" />
<property name="dist.src.includes"
value="
src${file.separator}**
lib${file.separator}**
examples${file.separator}**
build.copyright
build.properties
build.version
build.number
build.xml
LICENSE
README"/>
<tar
tarfile="${dist.src.tar}"
basedir="${basedir}"
includes="${dist.src.includes}" />
<gzip zipfile="${dist.src.tar.gz}" src="${dist.src.tar}"/>
<zip zipfile="${dist.src.zip}"
basedir="${basedir}"
includes="${dist.src.includes}"
excludes=""/>
<delete file="${dist.src.tar}"/>
</target>
<target name="dist-javadoc" depends="prepare-dist,javadoc" description="Builds a tar-gzip binary distribution file.">
<property name="dist.javadoc" value="${dist.dir}${file.separator}${build.name}-${version}-javadoc" />
<property name="dist.javadoc.tar" value="${dist.javadoc}.tar" />
<property name="dist.javadoc.tar.gz" value="${dist.javadoc.tar}.gz" />
<property name="dist.javadoc.zip" value="${dist.javadoc}.zip" />
<property name="dist.javadoc.includes"
value="javadoc${file.separator}**" />
<tar
tarfile="${dist.javadoc.tar}"
basedir="${build.dir}"
includes="${dist.javadoc.includes}" />
<gzip zipfile="${dist.javadoc.tar.gz}" src="${dist.javadoc.tar}"/>
<zip zipfile="${dist.javadoc.zip}"
basedir="${build.dir}"
includes="${dist.javadoc.includes}"
excludes=""/>
<delete file="${dist.javadoc.tar}"/>
</target>
<target name="dist" depends="clean-dist,dist-source,dist-javadoc,dist-jar">
<buildnumber file="build.number"/>
</target>
<!-- Clean targets -->
<target name="clean-classes">
<delete dir="${build.classes}"/>
</target>
<target name="clean-javadoc">
<delete dir="${build.javadoc}"/>
</target>
<target name="clean-jar">
<delete file="${build.jar}"/>
</target>
<target name="clean-build">
<delete dir="${build.dir}"/>
</target>
<target name="clean-dist">
<delete dir="${dist.dir}"/>
</target>
<target name="clean" depends="clean-build,clean-dist"/>
</project>