forked from cmsimple-xh/cmsimple-xh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
218 lines (195 loc) · 9.93 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
210
211
212
213
214
215
216
217
218
<?xml version="1.0" encoding="UTF-8"?>
<project name="CMSimple_XH" default="help">
<property name="build" value="01"/>
<fileset id="tutorials" dir="tutorials">
<include name="XH/*.pkg"/>
<include name="XH/*.cls"/>
</fileset>
<target name="help" description="lists available targets">
<exec command="phing -l" outputProperty="help"/>
<echo>${help}</echo>
</target>
<target name="sniff" description="checks adherence to PSR-2">
<exec executable="phpcs" passthru="true" checkreturn="true">
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
<arg value="--ignore=languages,*config.php"/>
<arg line="--runtime-set ignore_warnings_on_exit true"/>
<arg file="cmsimple"/>
<arg file="plugins/filebrowser"/>
<arg file="plugins/meta_tags"/>
<arg file="plugins/page_params"/>
<arg file="tests/unit"/>
</exec>
</target>
<target name="mess" description="detects code flaws">
<exec executable="phpmd" passthru="true" checkreturn="true">
<arg value="cmsimple,plugins/filebrowser,plugins/meta_tags,plugins/page_params,tests/unit"/>
<arg value="text"/>
<arg value="unusedcode"/>
</exec>
</target>
<target name="phan" description="run Phan static analysis">
<exec command="phan" passthru="true" logoutput="true" checkreturn="true"/>
</target>
<target name="unit-tests" description="runs all unit tests">
<exec executable="phpunit" passthru="true" checkreturn="true"/>
</target>
<target name="validation-tests" description="runs all validation tests">
<fail unless="env.CMSIMPLEDIR" message="CMSIMPLEDIR undefined!"/>
<exec command="phpunit --bootstrap tests/bootstrap.php tests/validation" passthru="true" checkreturn="true"/>
</target>
<target name="attack-tests" description="runs all attack tests">
<fail unless="env.CMSIMPLEDIR" message="CMSIMPLEDIR undefined!"/>
<exec command="phpunit --bootstrap tests/bootstrap.php tests/attack" passthru="true" checkreturn="true"/>
</target>
<target name="all-tests" depends="unit-tests,validation-tests,attack-tests"
description="runs all tests"/>
<target name="coverage" description="generates coverage report">
<exec command="phpdbg -qrr vendor/phpunit/phpunit/phpunit --configuration phpunit.xml"
passthru="true" logoutput="true"/>
</target>
<target name="php-doc">
<mkdir dir="doc/php"/>
<exec command="doxygen Doxyfile" passthru="true" checkreturn="true"/>
</target>
<target name="js-doc">
<exec command="jsdoc --destination doc/js assets/js/admin.min.js"
passthru="true" checkreturn="true"/>
</target>
<target name="doc" depends="php-doc,js-doc" description="generates the developer documentation"/>
<target name="build" description="builds a distributable ZIP archive">
<fail unless="version" message="version is not defined!"/>
<exec command="git archive -o export.zip HEAD" checkreturn="true"/>
<unzip file="export.zip" todir="export"/>
<delete file="export.zip"/>
<tstamp>
<format property="TODAY" pattern="%Y-%m-%d"/>
</tstamp>
<move todir="dist">
<fileset dir="export">
<include name="README*.txt"/>
<include name="reqcheck.php"/>
</fileset>
<filterchain>
<replacetokens>
<token key="CMSIMPLE_XH_VERSION" value="CMSimple_XH ${version}"/>
<token key="CMSIMPLE_XH_BUILD" value="${DSTAMP}${build}"/>
<token key="CMSIMPLE_XH_DATE" value="${TODAY}"/>
</replacetokens>
</filterchain>
</move>
<jsMin targetDir="dist/cmsimplexh" suffix="" failOnError="false">
<fileset dir="export">
<include name="assets/js/admin.min.js"/>
<include name="plugins/filebrowser/js/filebrowser.min.js"/>
<include name="plugins/meta_tags/metatags.min.js"/>
<include name="plugins/page_params/pageparams.min.js"/>
</fileset>
</jsMin>
<move todir="dist/cmsimplexh">
<fileset dir="export">
<include name="cmsimple/cms.php"/>
<include name="cmsimple/functions.php"/>
<include name="cmsimple/classes/Search.php"/>
<include name="plugins/filebrowser/admin.php"/>
</fileset>
<filterchain>
<replacetokens>
<token key="CMSIMPLE_XH_VERSION" value="CMSimple_XH ${version}"/>
<token key="CMSIMPLE_XH_BUILD" value="${DSTAMP}${build}"/>
<token key="CMSIMPLE_XH_DATE" value="${TODAY}"/>
</replacetokens>
</filterchain>
</move>
<move todir="dist/cmsimplexh" includeemptydirs="true">
<fileset dir="export">
<exclude name=".github/**"/>
<exclude name=".phan/**"/>
<exclude name="build.xml"/>
<exclude name="composer.json"/>
<exclude name="composer.lock"/>
<exclude name="coverage.xml"/>
<exclude name="Doxyfile"/>
<exclude name="doxygen_input_filter.php"/>
<exclude name="important-notices.md"/>
<exclude name="phpunit.xml"/>
<exclude name="README.md"/>
<exclude name="2lang/.2lang"/>
<exclude name="tests/**"/>
<exclude name="tutorials/**"/>
<exclude name="userfiles/images/test*.jpg"/>
<exclude name="version.nfo"/>
</fileset>
</move>
<touch file="dist/cmsimplexh/2lang/.2lang"/>
<delete dir="export"/>
<copy file="dist/cmsimplexh/cmsimple/config.php" tofile="dist/cmsimplexh/cmsimple/defaultconfig.php" preservelastmodified="true"/>
<copy file="dist/cmsimplexh/cmsimple/languages/en.php" tofile="dist/cmsimplexh/cmsimple/languages/default.php" preservelastmodified="true"/>
<copy file="dist/cmsimplexh/plugins/filebrowser/config/config.php" tofile="dist/cmsimplexh/plugins/filebrowser/config/defaultconfig.php" preservelastmodified="true"/>
<copy file="dist/cmsimplexh/plugins/filebrowser/languages/en.php" tofile="dist/cmsimplexh/plugins/filebrowser/languages/default.php" preservelastmodified="true"/>
<copy file="dist/cmsimplexh/plugins/meta_tags/languages/en.php" tofile="dist/cmsimplexh/plugins/meta_tags/languages/default.php" preservelastmodified="true"/>
<copy file="dist/cmsimplexh/plugins/page_params/languages/en.php" tofile="dist/cmsimplexh/plugins/page_params/languages/default.php" preservelastmodified="true"/>
<move file="dist/cmsimplexh/userfiles/downloads/_XHdebug.txt" tofile="dist/cmsimplexh/userfiles/downloads/XHdebug.txt"/>
<touch file="dist/cmsimplexh/cmsimple/.sessionname"/>
<echo file="dist/cmsimplexh/reqcheck.php">This file serves no purpose, and can be deleted.${line.separator}</echo>
<echo file="dist/cmsimplexh/cmsimple/log.txt">Lists system messages (warnings, infos, errors).${line.separator}</echo>
<echo file="dist/cmsimplexh/cmsimple/debug-log.txt">Lists PHP errors, if activated in the configuration.${line.separator}</echo>
<zip destfile="CMSimple_XH-${version}.zip" basedir="dist"/>
<delete dir="dist" quiet="true"/>
</target>
<target name="build-patch" description="builds a distributable update package">
<fail unless="patchee" message="patchee is not defined!"/>
<fail unless="version" message="version is not defined!"/>
<unzip file="CMSimple_XH-${version}.zip" todir="current"/>
<unzip file="${patchee}" todir="patchee"/>
<copy todir="dist">
<fileset dir="current">
<different targetdir="patchee" ignoreFileTimes="true"/>
</fileset>
</copy>
<delete>
<fileset dir="patchee">
<present present="both" targetdir="current"/>
</fileset>
</delete>
<touch file="deleted_files.txt"/>
<foreach param="filename" target="list-deleted-file">
<fileset dir="patchee/cmsimplexh">
<type type="file"/>
</fileset>
</foreach>
<move file="deleted_files.txt" todir="dist">
<filterchain>
<replaceregexp>
<regexp pattern="\\" replace="/"/>
</replaceregexp>
</filterchain>
</move>
<delete>
<fileset dir="dist/cmsimplexh">
<include name="important-notices.md"/>
<include name="cmsimple/log.txt"/>
<include name="cmsimple/.sessionname"/>
<include name="content/content.htm"/>
<include name="2lang/content/content.htm"/>
<include name="cmsimple/config.php"/>
<include name="plugins/*/config/config.php"/>
<include name="cmsimple/languages/??.php"/>
<include name="plugins/*/languages/??.php"/>
<include name="plugins/*/css/stylesheet.css"/>
</fileset>
</delete>
<delete includeemptydirs="true">
<fileset dir="dist/cmsimplexh/templates" includes="**"/>
</delete>
<echo file="dist/cmsimplexh/reqcheck.php">This file serves no purpose, and can be deleted.</echo>
<zip destfile="CMSimple_XH-${version}-patch.zip" basedir="dist" includeemptydirs="false"/>
<delete dir="patchee" quiet="true"/>
<delete dir="current" quiet="true"/>
<delete dir="dist" quiet="true"/>
</target>
<target name="list-deleted-file">
<echo msg="${filename}${line.separator}" file="deleted_files.txt" append="true"/>
</target>
</project>