-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
188 lines (162 loc) · 6.83 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
<!--
name: build.xml
description: The main project build file for phing operations. This file can
be overridden with project specific configuration.
-->
<project name="vd8" default="install" phingVersion="2.4.11">
<!-- -->
<!-- Properties -->
<!-- ============= -->
<!-- Drupal -->
<property name="drupal.siteName" value="Drupal8" />
<property name="drupal.email" value="user@example.com" />
<property name="drupal.user" value="admin" />
<property name="drupal.pass" value="password" />
<property name="drupal.dir" value="${project.basedir}/app" />
<property name="drupal.profile" value="standard" />
<property name="drupal.url" value="http://d8.dev" />
<property name="last.test" value="Drupal\action\Tests\ConfigurationTest" />
<!-- Modules -->
<property name="modules.enable" value="false" />
<!-- Mysql -->
<property name="mysql.host" value="d8.dev" />
<property name="mysql.port" value="3306" />
<property name="mysql.database" value="local" />
<property name="mysql.user" value="drupal" />
<property name="mysql.pass" value="drupal" />
<property name="mysql.queryString" value="mysql://${mysql.user}:${mysql.pass}@${mysql.host}/${mysql.database}" />
<!-- Drush -->
<property name="drush.cmd" value="${project.basedir}/bin/drush -r ${drupal.dir}" />
<!-- Vagrant -->
<property name="vagrant.dir" value="/vagrant" />
<!-- Globals for exec commands. The main goal of these were for fast failingin the bot. -->
<property name="test.output" value="true" />
<property name="test.passthru" value="true" />
<!-- Provide overrides. -->
<property file="build.properties" override="true" />
<property file="last.test.properties" override="true" />
<!-- -->
<!-- Targets -->
<!-- ======= -->
<!-- Prepare the project -->
<target name="prepare"
description="Prepare for build">
<exec command="composer install --prefer-dist"
logoutput="${test.output}"
passthru="${test.passthru}" />
</target>
<!-- Reinstall the Drupal 8 site. -->
<target name="reinstall"
depends="prepare"
description="Reinstall the Drupal 8 site.">
<!-- Drop and create the database -->
<phingcall target="db:drop" />
<!-- Ensure the files directory is clean -->
<exec command="sudo rm -fR ${drupal.dir}/sites/default/files/*"
logoutput="${test.output}"
passthru="${test.passthru}" />
<!-- Ensure we have a fresh settings.php with correct permissions -->
<exec command="sudo cp ${drupal.dir}/sites/default/default.settings.php ${drupal.dir}/sites/default/settings.php"
logoutput="${test.output}"
passthru="${test.passthru}" />
<exec command="sudo chmod 777 ${drupal.dir}/sites/default/settings.php"
logoutput="${test.output}"
passthru="${test.passthru}" />
<!-- Ensure we have a fresh services.yml with correct permissions -->
<exec command="sudo cp ${drupal.dir}/sites/default/default.services.yml ${drupal.dir}/sites/default/services.yml"
logoutput="${test.output}"
passthru="${test.passthru}" />
<exec command="sudo chmod 777 ${drupal.dir}/sites/default/services.yml"
logoutput="${test.output}"
passthru="${test.passthru}" />
<!-- Install the site, contrib modules and simpletest -->
<phingcall target="install" />
<if>
<equals arg1="${modules.enable}" arg2="true" />
<then>
<phingcall target="enable:modules" />
</then>
</if>
<phingcall target="simpletest:enable" />
</target>
<!-- Install the Drupal 8 site. -->
<target name="install"
description="Install the Drupal 8 site.">
<exec command="${drush.cmd} site-install ${drupal.profile} -y --db-url=${mysql.queryString} --account-mail=${drupal.email} --account-name=${drupal.user} --account-pass=${drupal.pass} --site-name=${drupal.siteName}"
logoutput="true"
passthru="true"/>
</target>
<!-- Drop the database of the Drupal 8 site. -->
<target name="db:drop"
description="Drop the database.">
<exec command="${drush.cmd} sql-drop -y"
logoutput="true"
passthru="true"/>
</target>
<!-- Enable given modules -->
<target name="enable:modules"
description="Enable the contrib modules.">
<if>
<not><isset property="modules.list" /></not>
<then>
<input message="Enter module name seprated by space." propertyName="modules.list"
defaultValue="views views_ui" />
</then>
</if>
<exec command="${drush.cmd} en -y ${modules.list}"
logoutput="true"
passthru="true"/>
</target>
<!-- Enable Simpletest module -->
<target name="simpletest:enable"
description="Enable the Testing module.">
<exec command="${drush.cmd} en -y simpletest"
logoutput="true"
passthru="true"/>
</target>
<!-- Test a class -->
<target name="simpletest:class"
description="Test a test class using simpletest.">
<input propertyName="test.class"
defaultValue="${last.test}"
message="Enter class name with namespace." />
<exec command="cd ${vagrant.dir}/app; php ./core/scripts/run-tests.sh --php `which php` --concurrency 12 --url http://d8.dev --verbose --color --class '${test.class}'"
logoutput="true"
passthru="true"/>
<echo file="${project.basedir}/last.test.properties" message="last.test=${test.class}" />
</target>
<!-- Test a group -->
<target name="simpletest:group"
description="Test a test group using simpletest.">
<input propertyName="test.group"
defaultValue="action"
message="Enter group name." />
<exec command="cd ${vagrant.dir}/app; php ./core/scripts/run-tests.sh --php `which php` --concurrency 12 --url http://d8.dev --verbose --color '${test.group}'"
logoutput="true"
passthru="true"/>
</target>
<!-- Clean temporary tables and files created by Simpletest module. -->
<target name="simpletest:clean"
description="Enable the Testing module.">
<exec command="${drush.cmd} test-clean"
logoutput="true"
passthru="true"/>
</target>
<!-- PHP CS -->
<target name="phpcs:dir"
description="Check the coding standard of give directory.">
<input propertyName="phpcs.path"
defaultValue="core"
message="Enter the path of directory." />
<exec command="cd ${vagrant.dir}/app; ../bin/phpcs --report=full --standard='../vendor/drupal/coder/coder_sniffer/Drupal' ${phpcs.path}"
logoutput="true"
passthru="true"/>
</target>
<!-- Install the Drupal 8 site. -->
<target name="login"
description="Log into the Drupal 8 site.">
<exec command="${drush.cmd} -l ${drupal.url} uli"
logoutput="true"
passthru="true"/>
</target>
</project>