forked from pdepend/pdepend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
209 lines (177 loc) · 8.02 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="PHP Depend" basedir=".">
<!--
Include local project properties.
-->
<property file="build.properties" />
<!--
Import common build targets
-->
<import file="${basedir}/setup/src/main/xml/base.xml" />
<!--
Updates the internal used case version number.
-->
<target name="pdepend:update-version">
<exec executable="${commons.executable.php}" failonerror="true">
<arg value="${basedir}/scripts/update-version.php" />
</exec>
</target>
<!--
We use the phar archive after hook to validate that a newly created
phar archive works as expected.
Parameters:
${-phar:filename} Name of the created phar file.
-->
<target name="-pdepend:phar:after~hooked" extensionOf="-phar:after~hook">
<antcall target="-package-execute">
<param name="-package.includepath" value="${commons:tmpdir}"/>
<param name="-package.executable" value="${-phar:filename}" />
</antcall>
</target>
<!--
We use the pear archive after hook to validate that a clean PHP_Depend
PEAR installation works as expected.
-->
<target name="-pdepend:package:pear:after~hooked" extensionOf="-package:pear:after~hook">
<antcall target="-package-execute">
<param name="-package.includepath" value="${common-pear-root-dir}"/>
<param name="-package.executable" value="${common-pear-bin-dir}/pdepend" />
</antcall>
</target>
<!--
Will execute the code contained in one of the package files.
Parameters
${-package.includepath} The used include path.
${-package.executable} The projects executable
-->
<target name="-package-execute">
<echo message="Executing:" level="verbose" />
<echo message=" ${-package.executable} --summary-xml... PDepend/Source" level="verbose" />
<exec dir="${commons.srcdir.php}"
executable="${commons.executable.php}"
failonerror="true">
<arg value="-d" />
<arg value="include_path=${-package.includepath}" />
<arg value="${-package.executable}" />
<arg value="--summary-xml=${commons:tmpdir}/summary.xml" />
<arg value="--jdepend-xml=${commons:tmpdir}/jdepend.xml" />
<arg value="--jdepend-chart=${commons:tmpdir}/jdepend.svg" />
<arg value="--overview-pyramid=${commons:tmpdir}/pyramid.svg" />
<arg value="--coderank-mode=inheritance,property,method" />
<arg value="PDepend/Source" />
</exec>
</target>
<target name="do-copy-files-for-xyz-archive">
<move todir="${output.dir}/src/main/php">
<fileset dir="${output.dir}/" includes="PDepend/**/*.*" />
</move>
<copy todir="${output.dir}/src/main/resources">
<fileset dir="${commons.srcdir.resource}" includes="**/*.*" />
</copy>
</target>
<!--
UTILIZED EXTENSION POINTS
-->
<!--
This extension of the initialize phase triggers an update of the
internally used case identifier.
-->
<target name="-pdepend:initialize:main~hooked"
depends="pdepend:update-version"
extensionOf="-initialize:main~hook" />
<target name="-pdepend:news:initialize:main~hooked"
extensionOf="-initialize:main~hook"
if="release">
<property name="release.news.dir" location="${basedir}/src/site/rst/news/" />
<property name="release.news.xml" location="${release.news.dir}/.blog.xml" />
<property name="release.news.rst" location="${release.news.dir}/pdepend-${project.version}-released.rst" />
<property name="release.news.resource.dir" location="${basedir}/src/site/resources/news" />
<property name="release.news.resource.rst" location="${release.news.resource.dir}/release.rst.in" />
<property name="release.news.resource.xsl" location="${release.news.resource.dir}/stylesheet.xsl" />
<tempfile property="release.news.xml.out" deleteonexit="true" />
<fail message="Cannot overwrite existing blog post '${release.news.rst}'.">
<condition>
<available file="${release.news.rst}" />
</condition>
</fail>
<xslt basedir="${release.news.dir}"
destdir="${release.news.dir}"
style="${release.news.resource.xsl}"
in="${release.news.xml}"
out="${release.news.xml.tmp}"
includes="${release.news.xml}">
<param name="project.version" expression="${project.version}" />
</xslt>
<copy file="${release.news.resource.rst}" tofile="${release.news.rst}">
<filterset>
<filter token="PROJECT_VERSION" value="${project.version}" />
</filterset>
</copy>
<move file="${release.news.xml.tmp}" tofile="${release.news.xml}" />
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="add" />
<arg line="${release.news.rst}" />
<arg line="${release.news.xml}" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="commit" />
<arg line="-m" />
<arg line="'Blog post about release ${project.version} added.'" />
</exec>
</target>
<target name="-pdepend:deploy:after~hooked" extensionOf="-deploy:after~hook" if="release">
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="pull" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="push" />
<arg line="--all" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="tag" />
<arg line="${project.version}" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="push" />
<arg line="--tags" />
</exec>
<property name="project.web.release.dir" value="${project.web.root}/static.${project.uri}/php/${project.version}" />
<exec dir="${commons:builddir}" executable="ssh" failonerror="true">
<arg line="${remote.shell.credentials}" />
<arg line="mkdir '${project.web.release.dir}'" />
</exec>
<exec dir="${commons:builddir}" executable="scp" failonerror="true">
<arg line="dist/${project.name}-${project.version}.phar" />
<arg line="${remote.shell.credentials}:${project.web.release.dir}/${project.name}.phar" />
</exec>
<exec dir="${commons:builddir}" executable="scp" failonerror="true">
<arg line="dist/${project.name}-${project.version}.bz2.phar" />
<arg line="${remote.shell.credentials}:${project.web.release.dir}/${project.name}.bz2.phar" />
</exec>
<exec dir="${commons:builddir}" executable="ssh" failonerror="true">
<arg line="${remote.shell.credentials}" />
<arg line="cd '${project.web.release.dir}/..' ; rm latest ; ln -s '${project.version}' latest" />
</exec>
<exec executable="ant" dir="${basedir}" failonerror="true">
<arg line="site:deploy" />
</exec>
</target>
<target name="-phar:before~hooked" extensionOf="-phar:before~hook">
<exec executable="php" failonerror="true">
<arg line="composer.phar" />
<arg line="update" />
<arg line="--prefer-dist" />
<arg line="--prefer-lowest" />
<arg line="--prefer-stable" />
</exec>
</target>
<target name="-phar:after~hooked" extensionOf="-phar:after~hook">
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="stash" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="stash" />
<arg line="drop" />
</exec>
</target>
</project>