This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
132 lines (124 loc) · 5.35 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="WpMvcBase" default="dist">
<!-- ============================================ -->
<!-- Target: clean -->
<!-- ============================================ -->
<target name="clean" description="Clean build evnironemnt" >
<delete dir="build" />
<delete dir="/tmp/wordpress" />
<delete dir="/tmp/wordpress-tests" />
</target>
<!-- ============================================ -->
<!-- Target: prepare -->
<!-- ============================================ -->
<target name="prepare" depends="clean" description="Install testing dependencies">
<property environment="env" />
<echo msg="Making directory ./build..." />
<mkdir dir="./build" />
<mkdir dir="./build/logs" />
<mkdir dir="./build/cov" />
<mkdir dir="./build/reports" />
<echo msg="Getting build dependencies..." />
<httpget url="http://cs.sensiolabs.org/get/php-cs-fixer.phar" dir="./" />
<exec command="php php-cs-fixer.phar fix ./ --fixers=-indentation --verbose" dir="." passthru="true" />
<exec command="curl -s http://getcomposer.org/installer | php" dir="." passthru="true" checkreturn="true" />
<composer command="install">
<arg value="--dev" />
<arg value="--no-interaction" />
<arg value="--prefer-source" />
</composer>
<!-- <gitclone repository="git@github.com:WordPress-Coding-Standards/WordPress-Coding-Standards.git $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress> -->
<echo msg="Retrieving WordPress core…" />
<gitclone repository="git@github.com:WordPress/WordPress.git" targetPath="/tmp/wordpress" gitPath="/usr/local/git/bin/git" />
<svncheckout repositoryurl="http://unit-tests.svn.wordpress.org/trunk/" todir="/tmp/wordpress-tests" trustServerCert="true" />
<copy file="/tmp/wordpress-tests/wp-tests-config-sample.php" tofile="/tmp/wordpress-tests/wp-tests-config.php" overwrite="true" />
<reflexive file="/tmp/wordpress-tests/wp-tests-config.php">
<filterchain>
<replaceregexp>
<regexp pattern="dirname\( __FILE__ \) . '/wordpress/'" replace="'/tmp/wordpress/'" />
<regexp pattern="yourdbnamehere" replace="wp_test" />
<regexp pattern="yourusernamehere" replace="${env.MYSQL_USER}" />
<regexp pattern="yourpasswordhere" replace="${env.MYSQL_PASSWORD}" />
</replaceregexp>
</filterchain>
</reflexive>
<exec command="mysql 'CREATE DATABASE wp_test;' -u${env.MYSQL_USER} -p${env.MYSQL_PASSWORD}" dir="." />
</target>
<!-- ============================================ -->
<!-- Target: quality -->
<!-- ============================================ -->
<target name="quality" depends="prepare" description="Quality Assurance">
<mkdir dir="build/reports/pmd" />
<phpmd rulesets="cleancode,codesize,naming,design,unusedcode">
<fileset dir="./">
<include name="controllers/*.php" />
<include name="helpers/*.php" />
<include name="models/*.php" />
<include name="views/*.php" />
</fileset>
<formatter type="html" outfile="build/reports/pmd.html"/>
</phpmd>
<phpcpd>
<fileset dir="./" id="filestocpd">
<include name="controllers/*.php" />
<include name="helpers/*.php" />
<include name="models/*.php" />
<include name="views/*.php" />
</fileset>
<formatter type="pmd" outfile="build/logs/phpcpd.xml"/>
</phpcpd>
<!--
<phpcodesniffer
standard="PEAR"
format="summary"
showSniffs="true"
showWarnings="true">
<fileset dir=".">
<include name="controllers/*.php" />
<include name="helpers/*.php" />
<include name="models/*.php" />
<include name="views/*.php" />
</fileset>
</phpcodesniffer>
-->
</target>
<!-- ============================================ -->
<!-- Target: phpunit -->
<!-- ============================================ -->
<target name="phpunit" depends="quality" description="Run tests with PHPUnit">
<mkdir dir="build/reports/coverage" />
<exec command="phpunit -v" dir="./" passthru="true" />
</target>
<!-- ============================================ -->
<!-- (DEFAULT) Target: dist -->
<!-- ============================================ -->
<target name="dist" depends="phpunit">
<echo msg="Creating archive..." />
<tar destfile="build/wpmvcbase.tar.gz" compression="gzip">
<fileset dir="./build">
<include name="*" />
</fileset>
</tar>
<mkdir dir="build/apigen" />
<mkdir dir="build/apigen/api" />
<mkdir dir="build/apigen/internal" />
<gitclone repository="git@github.com:dlozupone/wp-mvc-base-docs.git" targetPath="build/apigen/api" gitPath="${env.GIT_PATH}/git" bare="true" />
<apigen
source="."
destination="build/apigen/api"
exclude="*/tests/*,*/vendor/*,*/build/*"
title="WPMVC Base API Documentation"
deprecated="true"
todo="false"/>
<gitpush repository="build/apigen/api" refspec="master:master" />
<apigen
source="."
destination="build/apigen/internal"
exclude="*/tests/*,*/vendor/*,*/build/*"
title="WPMVC Base API Documentation"
internal="true"
deprecated="true"
todo="true"/>
<echo msg="Files copied and compressed in build directory OK!" />
</target>
</project>