forked from deftlabs/oemware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
244 lines (185 loc) · 10.3 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
240
241
242
243
244
<?xml version="1.0"?>
<!--
Copyright 2011, Deft Labs.
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.
-->
<project name="oemware" default="usage" basedir="./" xmlns:aspectj="antlib:org.aspectj" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- ******************************************************************* -->
<!-- Set the base attributes. -->
<!-- ******************************************************************* -->
<property name="dir.build" value="build"/>
<property name="dir.build.java" value="${dir.build}/java/classes"/>
<property name="dir.build.release" value="${dir.build}/oemware"/>
<property name="dir.src" value="src"/>
<property name="dir.src.java" value="src/main"/>
<property name="dir.src.java.unit" value="src/unit"/>
<property name="dir.lib" value="lib"/>
<property name="dir.conf" value="conf"/>
<property file="build.properties" prefix="build.conf"/>
<property environment="env"/>
<path id="classpath.all">
<fileset dir="${dir.lib}"><include name="*.jar"/></fileset>
</path>
<path id="classpath.cp"><pathelement location="${dir.build.java}"/></path>
<!-- ******************************************************************* -->
<!-- Set the Maven attributes. -->
<!-- ******************************************************************* -->
<property name="groupId" value="com.deftlabs"/>
<property name="artifactId" value="oemware"/>
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots"/>
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots"/>
<property name="maven-staging-repository-id" value="sonatype-nexus-staging"/>
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/"/>
<!-- ******************************************************************* -->
<!-- Remove the build directory. -->
<!-- ******************************************************************* -->
<target name="clean">
<delete dir="${dir.build}"/>
<delete file="conf/maven-oemware.xml.asc"/>
</target>
<!-- ******************************************************************* -->
<!-- Compile the java classes. -->
<!-- ******************************************************************* -->
<target name="compile">
<mkdir dir="${dir.build.java}"/>
<javac destdir="${dir.build.java}"
target="${build.conf.javac.source}"
debug="true" encoding="UTF-8"
classpathref="classpath.cp"
source="${build.conf.javac.source}"
includeantruntime="false"
debuglevel="lines,vars,source">
<src path="${dir.src.java}"/>
<src path="${dir.src.java.unit}"/>
<compilerarg value="-Xlint:all,-fallthrough"/>
<classpath refid="classpath.all"/>
</javac>
</target>
<!-- ******************************************************************* -->
<!-- Create the jar file. -->
<!-- ******************************************************************* -->
<target name="jar" depends="clean, unit, compile">
<mkdir dir="${dir.build}/dist"/>
<jar destfile="${dir.build}/dist/oemware.jar" basedir="${dir.build.java}" manifest="src/main/META-INF/MANIFEST.MF"></jar>
<copy file="conf/maven-oemware.xml" tofile="${dir.build}/maven-oemware.xml" filtering="true">
<filterset><filter token="VERSION" value="${build.conf.lib.version}"/></filterset>
</copy>
</target>
<!-- ******************************************************************* -->
<!-- Create the additional jars. -->
<!-- ******************************************************************* -->
<target name="jar.all" depends="jar, javadocs">
<jar jarfile="${dir.build}/dist/oemware-sources-${build.conf.lib.version}.jar"><fileset dir="src/main"/></jar>
<jar jarfile="${dir.build}/dist/oemware-javadoc-${build.conf.lib.version}.jar"><fileset dir="${dir.build}/javadocs"/></jar>
<copy file="${dir.build}/dist/oemware.jar" tofile="${dir.build}/dist/oemware-${build.conf.lib.version}.jar"/>
</target>
<!-- ******************************************************************* -->
<!-- Run the isolated unit tests. -->
<!-- ******************************************************************* -->
<target name="unit" depends="compile">
<junit fork="yes" haltonfailure="true">
<jvmarg value="-Duser.timezone=GMT"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath refid="classpath.all"/>
<classpath>
<pathelement path="${dir.build.java}"/>
<pathelement path="${dir.conf}"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest todir=".">
<fileset dir="${dir.build.java}">
<include name="**/*UnitTests.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ******************************************************************* -->
<!-- Generate the Javadocs. -->
<!-- ******************************************************************* -->
<target name="javadocs" depends="compile" description="Generate Javadocs">
<delete dir="${dir.build}/javadocs/"/>
<javadoc
packagenames="com.deftlabs.core, com.deftlabs.core.util, com.deftlabs.core.net"
sourcepath="src/main/"
defaultexcludes="yes"
destdir="${dir.build}/javadocs"
author="true"
version="true"
source="1.5"
use="true"
access="protected">
<link href="http://download.oracle.com/javase/1.5.0/docs/api/" />
<classpath refid="classpath.all"/>
</javadoc>
</target>
<!-- ******************************************************************* -->
<!-- Deploy to Maven repository. -->
<!-- ******************************************************************* -->
<target name="maven.snapshot" depends="jar.all" description="Deploy a snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file"/>
<arg value="-Durl=${maven-snapshots-repository-url}"/>
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-oemware.xml"/>
<arg value="-Dfile=${dir.build}/dist/oemware-${build.conf.lib.version}.jar"/>
</artifact:mvn>
</target>
<!-- ******************************************************************* -->
<!-- Stage in the Maven repository. -->
<!-- ******************************************************************* -->
<target name="maven.stage" depends="jar.all" description="Deploy release version to Maven staging repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-oemare.xml"/>
<arg value="-Dfile=${dir.build}/dist/oemware-${build.conf.lib.version}.jar"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-oemware.xml"/>
<arg value="-Dfile=${dir.build}/dist/oemware-sources-${build.conf.lib.version}.jar"/>
<arg value="-Dclassifier=sources"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg"/>
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-oemware.xml"/>
<arg value="-Dfile=${dir.build}/dist/oemware-javadoc-${build.conf.lib.version}.jar"/>
<arg value="-Dclassifier=javadoc"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg"/>
</artifact:mvn>
</target>
<!-- ******************************************************************* -->
<!-- Describe the build file usage. -->
<!-- ******************************************************************* -->
<target name="usage">
<echo>
----------------------------------------
- Compile the Java files ......................... compile
- Create the jar file ............................ jar
- Create ALL of the build jar files .............. jar.all
- Clean the source tree .......................... clean
- Run the unit tests ............................. unit
- Generate the Javadocs .......................... javadocs
----------------------------------------
</echo>
</target>
<!-- ******************************************************************* -->
</project>