-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
206 lines (187 loc) · 9.14 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="pegasus" default="dist">
<property file="build.local.properties"/>
<property file="build.properties"/>
<!-- These can be overridden from the command line when building -->
<property name="pegasus.version" value="0.4"/>
<property name="pegasus.branch" value="master"/>
<property name="pegasus.revision" value="non-release"/>
<property environment="env"/>
<property name="debug" value="true"/>
<!-- pegasus library properties -->
<property name="pegasus.src" value="driver/src"/>
<property name="pegasus.swc" value="dist/pegasus-${pegasus.version}.swc"/>
<property name="pegasus.doc" value="dist/pegasus-${pegasus.version}-api.zip"/>
<!-- pgconsole demo app properties -->
<property name="pgconsole.src" value="pgconsole/src"/>
<property name="pgconsole.lib" value="pgconsole/lib"/>
<property name="pgconsole.app" value="pgconsole/src/PGConsole.mxml"/>
<property name="pgconsole.app-descriptor" value="PGConsole-app.xml"/>
<property name="pgconsole.build" value="build/pgconsole"/>
<property name="pgconsole.swf" value="PGConsole-${pegasus.version}.swf"/>
<property name="pgconsole.air" value="dist/pgconsole-${pegasus.version}.air"/>
<target name="clean" description="Removes artifacts from previous build">
<delete failonerror="false" includeEmptyDirs="true">
<fileset dir="build"/>
<fileset dir="dist"/>
</delete>
</target>
<target name="init" description="Perform build setup">
<mkdir dir="build"/>
<mkdir dir="dist"/>
</target>
<target name="flex-setup">
<!--
The immutability of properties makes pulling this in from either
property file or environment a little awkward
-->
<condition property="FLEX_HOME" value="${flex.home}">
<isset property="flex.home"/>
</condition>
<condition property="FLEX_HOME" value="${env.FLEX_HOME}">
<isset property="env.FLEX_HOME"/>
</condition>
<fail message="flex.home must be specified in property file or FLEX_HOME environment variable must be set to build pegasus">
<condition>
<not>
<isset property="FLEX_HOME"/>
</not>
</condition>
</fail>
<taskdef resource="flexTasks.tasks">
<classpath>
<fileset dir="${FLEX_HOME}/ant/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</taskdef>
<!-- N.B.: no task for adt; we just call the java task with the jar directly -->
<property name="flex.adt.jar" value="${FLEX_HOME}/lib/adt.jar"/>
</target>
<target name="swc" depends="flex-setup">
<!--
We need to fork here because the compc/mxmlc tasks are just <java> task wrappers,
and flex 3 and ant 1.7 depend on different versions of the apache Xerces library.
-->
<compc debug="${debug}" output="${pegasus.swc}" fork="true" maxmemory="512m">
<arg value="-headless-server=true"/>
<!--
Okay, it seems we need *both* source-path and include-sources. The documentation
is vague. I think this is what is colloquially known as a "clusterfuck" of an API
-->
<source-path>driver/src</source-path>
<include-sources dir="driver/src" append="true">
<include name="**/*.as"/>
</include-sources>
<library-path dir="driver/lib" append="true">
<include name="**/*.swc"/>
</library-path>
</compc>
</target>
<target name="doc" depends="flex-setup" description="Create API docs">
<echo>Generating asdoc documentation...</echo>
<tstamp>
<format property="docgen.copyright.year" pattern="yyyy"/>
</tstamp>
<!--
N.B.: We don't just use the asdoc ant task because through some
fantastically creative API design, ant property replacement (one
of the few handy features in ant) is almost entirely unsupported
in that task. To get this to run properly with java directly, we
need to set the working directory, which means we need to pass a
fully qualified path everywhere.
-->
<java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg line="-output=${basedir}/build/asdoc"/>
<arg line="-doc-sources=${basedir}/driver/src"/>
<arg line="-library-path=${basedir}/driver/lib"/>
<arg line="-window-title='Pegasus ${pegasus.version}'"/>
<arg line="-main-title='Pegasus ${pegasus.version}'"/>
<arg line="-footer='Copyright 2010-${docgen.copyright.year}'"/>
<!-- package overviews... damn you to hell, asdoc -->
<arg value="-package=org.postgresql,Classes defining errors and constants core to the driver."/>
<arg value="-package=org.postgresql.db,The "user interface" to the driver. Most applications will interact with the library largely through classes in this package."/>
<arg value="-package=org.postgresql.db.impl,Implementation details of the org.postgresql.db API."/>
<arg value="-package=org.postgresql.db.event,Classes for events related to the API presented by the <code>org.postgresql.db</code> package."/>
<arg value="-package=org.postgresql.codec,Classes related to encoding and decoding data types."/>
<arg value="-package=org.postgresql.codec.encode,Classes defining all built-in encoders."/>
<arg value="-package=org.postgresql.codec.decode,Classes defining all built-in decoders."/>
<arg value="-package=org.postgresql.event,Classes defining core protocol events."/>
<arg value="-package=org.postgresql.febe,Classes related to the low-level PostgreSQL front-end/back-end protocol. These classes are the "plumbing" of the driver."/>
<arg value="-package=org.postgresql.febe.message,Classes defining the messages of the low-level front-end/back-end protocol."/>
<arg value="-package=org.postgresql.log,Driver logging framework for debugging information. Based on Flex logging framework design."/>
<arg value="-package=org.postgresql.util,Miscellaneous utility classes."/>
<arg value="-package=org.postgresql.io,I/O utility classes."/>
</java>
<copy todir="${basedir}/dist/asdoc">
<fileset dir="${basedir}/build/asdoc"/>
</copy>
<zip destfile="${basedir}/${pegasus.doc}">
<fileset dir="${basedir}/dist/asdoc"/>
</zip>
</target>
<target name="pegasus" depends="swc,doc" description="Build all pegasus artifacts"/>
<target name="pgconsole" depends="flex-setup,swc" description="Build pgconsole demo application">
<mxmlc file="${pgconsole.app}" output="${pgconsole.build}/${pgconsole.swf}" configname="air"
debug="${debug}" fork="true" maxmemory="512m">
<arg value="-headless-server=true"/>
<source-path>pgconsole/src</source-path>
<include-libraries dir="${pgconsole.lib}" append="true">
<include name="**/*.swc"/>
</include-libraries>
<include-libraries file="${pegasus.swc}" append="true"/>
</mxmlc>
<copy todir="${pgconsole.build}" file="${pgconsole.src}/${pgconsole.app-descriptor}">
<filterset>
<filter token="VERSION" value="${pegasus.version}"/>
</filterset>
</copy>
</target>
<target name="check-cert">
<condition property="pgconsole.cert.exists">
<available file="${pgconsole.cert.keystore}"/>
</condition>
</target>
<target name="gen-cert" depends="check-cert,flex-setup" unless="pgconsole.cert.exists"
description="Generate certificate for pgconsole demo application">
<!-- pgconsole packaged AIR app properties -->
<echo>Generating certificate ${pgconsole.cert.name} in file ${pgconsole.cert.keystore}</echo>
<fail unless="pgconsole.cert.password">Certificate password property (pgconsole.cert.password)
must be set to generate certificate</fail>
<java jar="${flex.adt.jar}" fork="true" failonerror="true">
<arg value="-certificate"/>
<arg value="-cn"/>
<arg value="${pgconsole.cert.name}"/>
<arg value="-ou"/>
<arg value="${pgconsole.cert.org-unit}"/>
<arg value="-o"/>
<arg value="${pgconsole.cert.org-name}"/>
<arg value="-c"/>
<arg value="${pgconsole.cert.country}"/>
<arg value="${pgconsole.cert.key-type}"/>
<arg value="${pgconsole.cert.keystore}"/>
<arg value="${pgconsole.cert.password}"/>
</java>
</target>
<target name="pgconsole-package" depends="pgconsole,gen-cert,flex-setup"
description="Packages the pgconsole SWF file into an AIR installation package">
<echo>Packaging pgconsole demo application</echo>
<fail unless="pgconsole.cert.password">Certificate password property (pgconsole.cert.password)
must be set to build AIR installation package</fail>
<java jar="${flex.adt.jar}" fork="true" failonerror="true" maxmemory="512m">
<arg value="-package"/>
<arg value="-storetype"/>
<arg value="${pgconsole.cert.storetype}"/>
<arg value="-keystore"/>
<arg value="${pgconsole.cert.keystore}"/>
<arg value="-storepass"/>
<arg value="${pgconsole.cert.password}"/>
<arg value="${pgconsole.air}"/>
<arg value="${pgconsole.build}/${pgconsole.app-descriptor}"/>
<arg value="-C"/>
<arg value="${pgconsole.build}"/>
<arg value="${pgconsole.swf}"/>
</java>
</target>
<target name="dist" depends="pegasus,pgconsole-package"/>
</project>