forked from bovigo/vfsStream
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
141 lines (131 loc) · 5.57 KB
/
build.xml
File metadata and controls
141 lines (131 loc) · 5.57 KB
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
<?xml version="1.0"?>
<project name="vfsStream" default="main">
<property name="build.base.dir" value="build/build" override="true"/>
<property name="build.report.dir" value="build/reports" override="true"/>
<property name="pkg.dir" value="src/main/php/org/bovigo/vfs" />
<property name="pkg.name" value="vfsStream-${version}"/>
<property name="build.src.dir" value="${build.base.dir}/${pkg.name}"/>
<property name="phpunit.test.coverage" value="true"/>
<property name="phpunit.test.groups" value=" "/>
<property name="phpunit.test.excludeGroups" value=" "/>
<fileset id="srcfiles" dir="${project.basedir}/src/main/php">
<include name="**/*.php"/>
</fileset>
<fileset id="testfiles" dir="${project.basedir}/src/test/php">
<include name="**/*TestCase*.php"/>
<include name="**/*Test.php"/>
</fileset>
<target name="main" if="version" depends="check-style,test,create-api-doc,versioncheck,copy-files"/>
<target name="release" depends="main,package"/>
<target name="check-style" description="check coding standards">
<echo>----------------------------------</echo>
<echo>| Checking CS of source files |</echo>
<echo>----------------------------------</echo>
<exec command="phpcs --standard=stubbles ${pkg.dir}" passthru="true"/>
</target>
<target name="test" description="Run tests.">
<delete>
<fileset dir="${build.report.dir}">
<include name="**/*"/>
<!-- check-style target is running before test in test-all so we have to exclude this file -->
<exclude name="**/checkstyle.xml"/>
<exclude name="**/coverage"/>
<exclude name="**/phpunit"/>
<exclude name="**/api"/>
</fileset>
</delete>
<echo message="'phpunit.test.groups' is set to '${phpunit.test.groups}' ('' = all)"/>
<echo message="'phpunit.test.excludeGroups' is set to '${phpunit.test.excludeGroups}' ('' = none)"/>
<php expression="define('SOURCE_DIR', '${project.basedir}/src/main/php');"/>
<php expression="ini_set('include_path', SOURCE_DIR . PATH_SEPARATOR . ini_get('include_path'));"/>
<php expression="extension_loaded('xdebug');" returnProperty="xdebug"/>
<if>
<and>
<istrue value="${xdebug}"/>
<istrue value="${phpunit.test.coverage}"/>
</and>
<then>
<coverage-setup database="${build.report.dir}/coverage/coverage.db">
<fileset refid="srcfiles"/>
</coverage-setup>
<phpunit codecoverage="true"
groups="${phpunit.test.groups}"
excludeGroups="${phpunit.test.excludeGroups}">
<formatter type="plain" usefile="false"/>
<formatter type="summary" usefile="false"/>
<formatter todir="${build.report.dir}/phpunit" type="xml"/>
<batchtest>
<fileset refid="testfiles"/>
</batchtest>
</phpunit>
<coverage-report outfile="${build.report.dir}/coverage/coverage.xml">
<report todir="${build.report.dir}/coverage"/>
</coverage-report>
</then>
<else>
<phpunit codecoverage="false"
groups="${phpunit.test.groups}"
excludeGroups="${phpunit.test.excludeGroups}">
<formatter type="plain" usefile="false"/>
<formatter type="summary" usefile="false"/>
<formatter todir="${build.report.dir}/phpunit" type="xml"/>
<batchtest>
<fileset refid="testfiles"/>
</batchtest>
</phpunit>
</else>
</if>
<phpunitreport infile="${build.report.dir}/phpunit/testsuites.xml" todir="${build.report.dir}/phpunit"/>
</target>
<target name="create-api-doc" description="Creates API docs">
<phpdoc title="vfsStream"
destdir="${build.report.dir}/api"
sourcecode="yes"
output="HTML:frames:DOM/earthli"
defaultpackagename="bovigo_vfs">
<fileset dir="src/main/php/org/bovigo/vfs">
<include name="**/*.php" />
</fileset>
</phpdoc>
</target>
<target name="versioncheck" unless="version">
<php function="file_get_contents" returnProperty="version">
<param value="VERSION"/>
</php>
<php function="trim" returnProperty="version">
<param value="${version}"/>
</php>
<echo>Version to be build: ${version}</echo>
<property name="pkg.name" value="vfsStream-${version}" override="true"/>
<property name="build.src.dir" value="${build.base.dir}/${pkg.name}" override="true"/>
</target>
<target name="copy-files">
<echo>-----------------------------</echo>
<echo>| Creating directory layout |</echo>
<echo>-----------------------------</echo>
<delete dir="${build.src.dir}"/>
<copy file="LICENSE" tofile="${build.src.dir}/LICENSE"/>
<copy todir="${build.src.dir}/docs">
<fileset dir="${build.report.dir}">
<include name="**/*"/>
</fileset>
</copy>
<append destFile="${build.src.dir}/VERSION">vfsStream version ${version}</append>
<copy todir="${build.src.dir}/vfsStream">
<fileset dir="src/main/php/org/bovigo/vfs">
<include name="**/*.php"/>
</fileset>
</copy>
<copy todir="${build.src.dir}/examples">
<fileset dir="examples">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="package" description="Build the pear package" depends="versioncheck">
<!-- Creation of package.xml is in another file because changelog should not
litter the build file. -->
<phing phingfile="build/pear.xml" target="package" inheritAll="true"/>
<exec command="pear package" dir="${build.src.dir}" passthru="true"/>
</target>
</project>