forked from mugoweb/ezfind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
153 lines (125 loc) · 5.97 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
<?xml version="1.0"?>
<project name="eZfind" default="all">
<description>eZFind extension build file</description>
<mkdir dir="build"/>
<!-- ================== -->
<!-- dynamic properties -->
<!-- ================== -->
<!-- current year -->
<tstamp>
<format property="date.current.year" pattern="yyyy"/>
</tstamp>
<!-- ========================= -->
<!-- end of dynamic properties -->
<!-- ========================= -->
<!-- ================= -->
<!-- static properties -->
<!-- ================= -->
<property name="ezfind.build.dir" location="build"/>
<property file="./ant/ezfind.properties"/>
<!-- ======================== -->
<!-- end of static properties -->
<!-- ======================== -->
<!-- ============================= -->
<!-- high level ( public ) targets -->
<!-- ============================= -->
<!-- Shows the list of properties used for building this extension -->
<!-- Anytime the ezfind.properties file is update, this target must -->
<!-- be updated as well -->
<target name="infos">
<echo message="EZFIND BUILD INFORMATIONS"/>
<echo message="-------------------------"/>
<echo message="ezfind.version.major : ${ezfind.version.major}"/>
<echo message="ezfind.version.minor : ${ezfind.version.minor}"/>
<echo message="ezfind.version.release : ${ezfind.version.release}"/>
<echo message="ezfind.version.alias : ${ezfind.version.alias}"/>
<echo message="ezfind.svn.trunk.url : ${ezfind.svn.trunk.url}"/>
<echo message="ezfind.build.dir : ${ezfind.build.dir}"/>
</target>
<!-- Displays a warning before building the extension -->
<!-- Also waits for 5 seconds before starting the real build -->
<!-- This makes it possible to interrupt the script before -->
<!-- any real task is done -->
<target name="warning" depends="infos">
<echo message="Please check informations defined above are correct"/>
<echo message="If not feel free to update the ant/ezfind.properties file"/>
<echo message="This script will wait for 5 seconds before it starts"/>
<sleep seconds="5"/>
</target>
<!-- Prepares the build -->
<!-- Runs an svn export of the extension's repository -->
<target name="init" depends="warning">
<exec executable="svn" failonerror="true">
<arg value="export"/>
<arg value="${ezfind.svn.trunk.url}"/>
<arg value="${ezfind.build.dir}/ezfind"/>
</exec>
</target>
<!-- Builds the extension once the SVN repository is exported -->
<!-- Prune miscaellanous useless files -->
<target name="build" depends="init">
<antcall target="update-ezinfo-php"/>
<antcall target="update-license-headers"/>
<delete dir="${ezfind.build.dir}/ezfind/ant"/>
<delete file="${ezfind.build.dir}/ezfind/build.xml"/>
</target>
<!-- Creates a tarball of the newly built extension -->
<target name="dist">
<mkdir dir="dist"/>
<tar destfile="dist/ezfind-${ezfind.version.alias}.${ezfind.version.release}.tar.gz"
compression="gzip"
longfile="gnu"
basedir="${ezfind.build.dir}"/>
</target>
<!-- Meta target, calls build and dist -->
<target name="all" depends="build,dist"/>
<!-- Cleans the generated tarball by dist-->
<target name="distclean">
<delete dir="dist"/>
</target>
<!-- Purge everything in the build directory -->
<!-- Also remove the build directory -->
<target name="cleanall" depends="distclean">
<delete dir="${ezfind.build.dir}"/>
</target>
<!-- ==================================== -->
<!-- end of high level ( public ) targets -->
<!-- ==================================== -->
<!-- ====================================================== -->
<!-- low level ( private ) targets, for internal usage ONLY -->
<!-- ====================================================== -->
<!-- Updates the license headers with correct version numbers -->
<!-- Updates the // SOFTWARE RELEASE line -->
<!-- Updates the // COPYRIGHT NOTICE line -->
<target name="update-license-headers">
<echo message="Updating license headers"/>
<!-- SOFTWARE RELEASE -->
<replaceregexp byline="true">
<regexp pattern="// SOFTWARE RELEASE: (.*)"/>
<substitution expression="// SOFTWARE RELEASE: ${ezfind.version.alias}-${ezfind.version.release}"/>
<fileset dir="${ezfind.build.dir}">
<include name="**/*.php"/>
</fileset>
</replaceregexp>
<!-- COPYRIGHT NOTICE -->
<replaceregexp byline="true">
<regexp pattern="// COPYRIGHT NOTICE: Copyright \(C\) 1999-[\d]{4} eZ Systems AS"/>
<substitution expression="// COPYRIGHT NOTICE: Copyright (C) 1999-${date.current.year} eZ Systems AS"/>
<fileset dir="${ezfind.build.dir}">
<include name="**/*.php"/>
</fileset>
</replaceregexp>
</target>
<!-- Updates ezinfo.php with correct version numbers -->
<target name="update-ezinfo-php">
<echo message="Updating ezinfo.php"/>
<replaceregexp byline="true" flags="i">
<regexp pattern="^([\s]+\047version\047[\s]+=>[\s]+\047)(.*)(\047,)$"/>
<substitution expression='\1${ezfind.version.alias}-${ezfind.version.release}\3'/>
<fileset dir="${ezfind.build.dir}" includes="**/*ezinfo.php"/>
</replaceregexp>
</target>
<!-- ============================================================= -->
<!-- end of low level ( private ) targets, for internal usage ONLY -->
<!-- ============================================================= -->
</project>