This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
forked from commercetools/commercetools-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
134 lines (117 loc) · 4.87 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="commercetools-php-sdk" default="build">
<!-- By default, we assume all tools to be on the $PATH -->
<property name="toolsdir" value="vendor/bin/"/>
<condition property="execPostfix" value=".bat" else="">
<os family="windows"/>
</condition>
<!-- Uncomment the following when the tools are in ${basedir}/vendor/bin -->
<!-- <property name="toolsdir" value="${basedir}/vendor/bin/"/> -->
<target name="build"
depends="prepare,lint,phpcs-ci,unit-test,apigen"
description=""/>
<target name="build-parallel"
depends="prepare,lint,tools-parallel,unit-test,apigen"
description=""/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<antcall target="phpcs-ci"/>
</parallel>
</target>
<target name="clean"
unless="clean.done"
description="Cleanup build artifacts">
<delete dir="${basedir}/build/docs"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<property name="clean.done" value="true"/>
</target>
<target name="prepare"
unless="prepare.done"
depends="clean"
description="Prepare for build">
<mkdir dir="${basedir}/build/docs"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<property name="prepare.done" value="true"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/src">
<include name="**/*.php" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${toolsdir}phpcs${execPostfix}" failonerror="true">
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=autoload.php,src/Core/Builder" />
<arg path="${basedir}/src" />
<arg path="${basedir}/tests" />
</exec>
</target>
<target name="phpcs-ci"
depends="prepare"
description="Find coding standard violations using PHP_CodeSniffer, but not in the unit tests. Intended for usage within a continuous integration environment.">
<exec executable="${toolsdir}phpcs${execPostfix}" failonerror="true">
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=autoload.php,src/Core/Builder" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="behat"
depends="prepare"
description="Run behat tests"
>
<exec executable="${toolsdir}behat${execPostfix}" failonerror="true">
<arg value="--format" />
<arg value="progress" />
<arg value="--tags" />
<arg value="~@ignore" />
</exec>
</target>
<target name="phpunit" description="Run tests with PHPUnit"
depends="unit-test, integration-test">
</target>
<target name="unit-test"
depends="prepare"
description="Run unit tests with PHPUnit">
<exec executable="${toolsdir}phpunit${execPostfix}" failonerror="true">
<arg value="--configuration"/>
<arg path="${basedir}/phpunit.xml.dist"/>
<arg value="--testsuite=unit"/>
</exec>
</target>
<target name="integration-test"
depends="prepare"
description="Run integration tests with PHPUnit">
<exec executable="${toolsdir}phpunit${execPostfix}" failonerror="true">
<arg value="--configuration"/>
<arg path="${basedir}/phpunit.xml.dist"/>
<arg value="--testsuite=integration"/>
</exec>
</target>
<target name="install-apigen">
<exec executable="${basedir}/install-apigen.sh${execPostfix}" dir="${basedir}" />
</target>
<target name="apigen"
depends="prepare, install-apigen"
description="Generate project documentation using phpDocumentor">
<exec executable="php" dir="${basedir}" failonerror="true">
<arg value="${basedir}/apigen.phar"/>
<arg value="generate"/>
<arg value="--debug"/>
<arg value="--config"/>
<arg path="${basedir}/build/apigen.neon"/>
</exec>
</target>
</project>