summaryrefslogtreecommitdiff
path: root/buildscripts/phing/pear/build.xml
blob: 128dcd03364443f2ce83ae63b24ed24f3223e598 (plain)
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
<?xml version="1.0"?>
<!--
	This build file packages the phing files, builds a package.xml (version 2) for installation
	using PEAR and creates the TAR and TGZ files.
-->
<project name="phing" basedir="." default="main">

	<property name="phing.home" value=".."/>
	<property name="build.base.dir" value="build"/>
	<property name="pkgname" value="phing-${version}"/>
	<property name="build.src.dir" value="${build.base.dir}/${pkgname}"/>

	<!-- some default properties -->
	<property name="notes">This is the latest release of Phing.</property>
	<property name="state" value="stable"/>

	<taskdef
    name="pear-package"
    classname="BuildPhingPEARPackageTask" classpath="."/>

	<fileset dir="${phing.home}/classes/phing" id="classes">
		<include name="**"/>
	</fileset>

	<fileset dir="${phing.home}/docs" id="docs">
		<include name="example/**"/>
		<include name="phing_guide/book/**"/>
	</fileset>

	<fileset dir="${phing.home}" id="etc">
		<include name="etc/**"/>
		<exclude name="etc/VERSION.TXT"/>
	</fileset>

	<fileset dir="${phing.home}" id="scripts">
		<include name="bin/pear-*"/>
		<include name="bin/phing.php"/>
	</fileset>

	<fileset dir="${phing.home}" id="misc">
		<include name="CHANGELOG"/>
		<include name="CREDITS"/>
		<include name="README"/>
		<include name="TODO"/>
		<exclude name="INSTALL*"/>
	</fileset>

	<!--
		==============================================
		Main entry point
		==============================================
	-->
	<target name="main" if="version" depends="versioncheck,copy-files,create-package-xml,tar"/>

	<!--
	 ===================================================================
	 Target: checks if language was given, otherwise fail
	 ===================================================================
	-->
	<target name="versioncheck" unless="version">
		<echo message="====================================================="/>
		<echo message="Version not specified. You must enter a version. In"/>
		<echo message="the future you can add this to build.properties or"/>
		<echo message="enter it on the command line: "/>
		<echo message=" "/>
		<echo message="-Dversion=2.0.0b1"/>
		<echo message="====================================================="/>
		<input propertyname="version" promptChar=":">Phing version for package</input>

		<property name="pkgname" value="phing-${version}" override="true"/>
		<property name="build.src.dir" value="${build.base.dir}/${pkgname}" override="true"/>

	</target>

	<!--
		==============================================
		Copy the desired files into the build/ dir
		making sure to put them in the directory
		structure that will be needed for PEAR install
		==============================================
	-->
	<target name="copy-files">

		<echo>-----------------------------</echo>
		<echo>| Creating directory layout |</echo>
		<echo>-----------------------------</echo>

		<delete dir="${build.base.dir}"/>

		<copy todir="${build.src.dir}">
			<fileset refid="classes"/>
			<fileset refid="docs"/>
			<fileset refid="etc"/>
			<fileset refid="scripts"/>
			<fileset refid="misc"/>
		</copy>

		<append destFile="${build.src.dir}/etc/VERSION.TXT">Phing version ${version}</append>

		<chmod file="${build.src.dir}/bin/pear-phing" mode="755"/>

	</target>

	<!--
		==============================================
		Create a PEAR package.xml which will guide the
		installation.
		==============================================
	-->
	<target name="create-package-xml" depends="versioncheck" if="version">

		<echo>-----------------------------</echo>
		<echo>| Creating PEAR package.xml |</echo>
		<echo>-----------------------------</echo>
		<echo></echo>
		<echo>... (This step may take some time) ...</echo>

		<delete	file="${tarfile}"/>
		<pear-package dir="${build.src.dir}" destFile="${build.base.dir}/package.xml" version="${version}" state="${state}" notes="${notes}">

			<fileset refid="classes"/>
			<fileset refid="docs"/>
			<fileset refid="etc"/>
			<fileset refid="misc"/>
			<fileset refid="scripts"/>

			<fileset dir="${build.src.dir}">
				<include name="etc/VERSION.TXT"/>
			</fileset>

		</pear-package>

	</target>

	<!--
		==============================================
		Create a tar.gz of the files, which will be
		installed by pear package manager.
		==============================================
	-->
	<target name="tar">
		<echo>-----------------------------</echo>
		<echo>| Creating TAR packages     |</echo>
		<echo>-----------------------------</echo>

		<property name="tgzfile" value="${build.base.dir}/${pkgname}.tgz"/>
		<delete	file="${tgzfile}"/>
		<tar compression="gzip" destFile="${tgzfile}" basedir="${build.base.dir}" />

		<property name="tarfile" value="${build.base.dir}/${pkgname}.tar"/>
		<delete	file="${tarfile}"/>
		<tar compression="none" destFile="${tarfile}" basedir="${build.base.dir}" />

	</target>

</project>