Repository navigation
Expand file tree
/
Copy pathbuild.xml
More file actions
152 lines (136 loc) · 6.4 KB
/
Copy pathbuild.xml
File metadata and controls
152 lines (136 loc) · 6.4 KB
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
<project name="Create IP Address API" default="run" basedir=".">
<description>Create IP address jar</description>
<property name="rootOffset" value="."/>
<property name="rootdistdir" location="${rootOffset}/dist"/>
<property name="javadocdir" value="javadoc"/>
<property name="rootjavadocdir" location="${rootOffset}/${javadocdir}"/>
<property name="functional_doclet_dir" location="${rootOffset}/../../Functional-Doclet-for-Javadoc/Functional Doclet for Javadoc" />
<property name="version" value="1.01"/>
<property name="jarExtension" value=".jar"/>
<property name="src_location" value="${rootOffset}/src" />
<property name="bin_location" value="${rootOffset}/bin" />
<property name="rootPackage" value="inet.ipaddr"/>
<property name="rootPackagePath" value="inet/ipaddr"/>
<target name="check root dist dir">
<available property="rootdistdir.exists" file="${rootdistdir}" />
</target>
<target name="generate time stamps" >
<tstamp> <!-- creates the variables DSTAMP, TSTAMP, TODAY -->
<format property="timestamp.full" pattern="yyyyMMdd-HHmmss"/>
</tstamp>
<echo message="build date: ${DSTAMP}, build time: ${TSTAMP}"/>
<property name="timestamp" value="${timestamp.full}"/>
</target>
<target name="create dist name" depends="generate time stamps" >
<property name="jarname" value="IPAddress${jarExtension}" />
<property name="archivename" value="IPAddress_v${version}_${timestamp}${jarExtension}" />
<property name="runScriptName" value="ip_address_test" />
<property name="runScriptPath" value="${rootdistdir}/${runScriptName}" />
</target>
<target name="create run script" depends="create dist name">
<concat destfile="${runScriptPath}.sh">#!/bin/sh
# Do not edit this file, it is generated by build.xml
java -cp ${jarname} ${rootPackage}.test.TestRunner fast performance
</concat>
<fixcrlf file="${runScriptPath}.sh" eol="lf"/>
<echo message="created ${runScriptPath}.sh"/>
</target>
<target name="compile">
<property name="java_level" value="1.6"/>
<javac srcdir="${src_location}" destdir="${bin_location}" debug="on"
source="${java_level}" target="${java_level}" failonerror="false" >
<include name="${rootPackagePath}/**/*.java"/>
</javac>
</target>
<target name="create javadoc">
<echo>${functional_doclet_dir}</echo>
<delete includeemptydirs="true" verbose="true">
<fileset dir="${rootjavadocdir}" includes="**/*"/>
</delete>
<!-- these packages used internally - ${rootPackage}.format.validate -->
<javadoc sourcepath="${src_location}" destdir="${rootjavadocdir}"
packagenames="${rootPackage},${rootPackage}.format,${rootPackage}.format.util,${rootPackage}.format.util.sql,${rootPackage}.ipv6,${rootPackage}.ipv4"
stylesheetfile="${functional_doclet_dir}/stylesheet_custom.css"
verbose="true"
author="true"
public="true"
use="true">
<doclet name="tools.doclets.formats.html.FunctionalDoclet"
path="${functional_doclet_dir}/dist/FunctionalDoclet.jar">
<param name="-tag" value="custom.core:a:Core" />
</doclet>
</javadoc>
</target>
<target name="create class jar" depends="compile, create dist name">
<property name="jarloc" location="${rootdistdir}/${jarname}" />
<jar destfile="${jarloc}" filesonly="true">
<manifest>
<attribute name="Version" value="${version}"/>
<attribute name="Timestamp" value="${timestamp}"/>
</manifest>
<fileset id="ipaddress.jar.properties" dir="${src_location}">
<include name="${rootPackagePath}/**/*.properties" />
</fileset>
<fileset id="ipaddress.jar.contents" dir="${bin_location}">
<include name="${rootPackagePath}/*.class" />
<include name="${rootPackagePath}/format/**/*.class" />
<include name="${rootPackagePath}/ipv4/*.class" />
<include name="${rootPackagePath}/ipv6/*.class" />
</fileset>
</jar>
<echo message ="Class files included: ${toString:ipaddress.jar.contents}" />
</target>
<target name="create dist jar" depends="compile, create dist name, create javadoc">
<property name="archiveloc" location="${rootdistdir}/${archivename}" />
<jar destfile="${archiveloc}" filesonly="true">
<manifest>
<attribute name="Version" value="${version}"/>
<attribute name="Timestamp" value="${timestamp}"/>
</manifest>
<fileset id="ipaddress.src" dir="${src_location}">
<include name="${rootPackagePath}/**/*.java" />
<include name="${rootPackagePath}/**/*.xml" />
<include name="${rootPackagePath}/**/*.properties" />
</fileset>
<fileset id="ipaddress.contents" dir="${bin_location}">
<include name="${rootPackagePath}/**/*.class" />
</fileset>
<fileset id="ipaddress.javadoc" dir="${rootOffset}">
<include name="${javadocdir}/**/*.*" />
</fileset>
<fileset id="ipaddress.docs" dir="${rootOffset}">
<include name="docs.odt" />
<include name="build.xml" />
</fileset>
</jar>
<echo message ="Source files included: ${toString:ipaddress.src}" />
</target>
<target name="deploy" depends="create class jar, create run script">
<scp file="${runScriptPath}.sh" todir="${machine_user}@${machine}:${machine_dir}" password="${machine_pw}" trust="yes" />
<scp file="${jarloc}" todir="${machine_user}@${machine}:${machine_dir}" password="${machine_pw}" trust="yes" />
<sshexec host="${machine}" username="${machine_user}" password="${machine_pw}" trust="yes"
command="chmod 777 ${machine_dir}/*.sh; cd ${machine_dir}; ./${runScriptName}.sh"/>
</target>
<target name="clean binaries">
<echo message="deleting compiled files" />
<delete verbose="false" includeemptydirs="true">
<fileset dir="${bin_location}">
<include name="**/*.class" />
</fileset>
</delete>
</target>
<!-- =====================================================
Top level
===================================================== -->
<target name="run" description="run" depends="deploy">
<echo message="created web archive ${jarloc} executed on ${gmachine}"/>
</target>
<!-- =====================================================
Clean
===================================================== -->
<target name="clean previous deployments" depends="check root dist dir" if="rootdistdir.exists" description="remove previous distributions" >
<delete verbose="true" includeemptydirs="true">
<fileset dir="${rootdistdir}" />
</delete>
</target>
</project>