-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
142 lines (129 loc) · 5.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Xhshop" default="help">
<fileset id="php-sources" dir=".">
<include name="classes/**/*.php"/>
<include name="admin.php"/>
<include name="index.php"/>
</fileset>
<fileset id="unit-tests" dir="tests/unit">
<include name="*Test.php"/>
</fileset>
<target name="help" description="lists available targets">
<exec command="phing -l" outputProperty="help"/>
<echo>${help}</echo>
</target>
<target name="setup" description="sets up the demo shop">
<copy todir="../../content/">
<fileset dir="demo/content">
<include name="**/*.php"/>
</fileset>
</copy>
<mkdir dir="../../content/xhshop/tmp_orders" mode="0777"/>
<copy todir="../../userfiles">
<fileset dir="demo/userfiles">
<include name="**/*.jpg"/>
</fileset>
</copy>
</target>
<target name="sniff" description="checks adherence to coding standards">
<exec executable="phpcs" passthru="true" checkreturn="true">
<arg value="--standard=PSR2"/>
<arg line="--runtime-set ignore_warnings_on_exit true"/>
<arg file="classes"/>
<arg file="admin.php"/>
<arg file="index.php"/>
<arg file="tests/unit"/>
</exec>
</target>
<target name="phan" description="run static analysis">
<exec executable="phan" passthru="true" checkreturn="true">
<arg value="--color"/>
</exec>
</target>
<target name="mess" description="detects code flaws">
<phpmd rulesets="codesize,unusedcode">
<fileset refid="php-sources"/>
</phpmd>
</target>
<target name="unit-tests" description="runs all unit tests">
<exec executable="phpunit" passthru="true" checkreturn="true">
<arg line="--bootstrap tests/unit/bootstrap.php tests/unit"/>
</exec>
</target>
<target name="coverage" description="generates coverage report">
<exec command="phpunit --configuration coverage.xml" logoutput="true"/>
</target>
<target name="build" description="builds distributable ZIP archive">
<fail unless="version" message="version is not defined!"/>
<exec command="git archive -o export.tar HEAD" checkreturn="true"/>
<untar file="export.tar" todir="export"/>
<delete file="export.tar"/>
<move todir="dist/plugins/xhshop">
<fileset dir="export">
<include name="version.nfo"/>
<include name="classes/Controller.php"/>
<include name="config/config.php"/>
</fileset>
<filterchain>
<replacetokens>
<token key="PUBLISHED" value=""/>
<token key="VERSION" value="${version}"/>
</replacetokens>
</filterchain>
</move>
<jsMin targetDir="dist/plugins/xhshop/js" suffix="" failOnError="false">
<fileset dir="export/js">
<include name="*.min.js"/>
</fileset>
</jsMin>
<!-- for some unknown reason copying catalog.php doesn't work here, so we take two steps -->
<move todir="dist">
<fileset dir="export/demo">
<exclude name="**/catalog.php"/>
</fileset>
</move>
<move file="export/demo/content/xhshop/catalog.php" todir="dist/content/xhshop/"/>
<mkdir dir="dist/content/xhshop/tmp_orders"/>
<move todir="dist/plugins/xhshop">
<fileset dir="export">
<exclude name=".phan"/>
<exclude name="build.xml"/>
<exclude name="composer.*"/>
<exclude name="coverage.xml"/>
<exclude name="demo/**"/>
<exclude name="pax_global_header"/>
<exclude name="phpcompatinfo.*"/>
<exclude name="setup.bat"/>
<exclude name="tests/**"/>
</fileset>
</move>
<delete dir="export"/>
<copy file="dist/plugins/xhshop/config/config.php" tofile="dist/plugins/xhshop/config/defaultconfig.php"/>
<copy file="dist/plugins/xhshop/languages/en.php" tofile="dist/plugins/xhshop/languages/default.php"/>
<zip destfile="XHShop-${version}.zip" basedir="dist"/>
<delete dir="dist"/>
</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="XHShop-${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="dist/plugins/xhshop">
<include name="config/config.php"/>
<include name="languages/??.php"/>
<include name="css/stylesheet.css"/>
</fileset>
</delete>
<zip destfile="XHShop-${version}-PATCH.zip" basedir="dist"
includeemptydirs="false"/>
<delete dir="patchee" quiet="true"/>
<delete dir="current" quiet="true"/>
<delete dir="dist" quiet="true"/>
</target>
</project>