forked from pfrenssen/continuous-training-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
137 lines (117 loc) · 5.66 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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="${drupal.profile.name}" default="help">
<property file="build.properties"/>
<target name="help" description="Phing target list">
<exec executable="${phing.bin}"
passthru="true">
<arg value="-l"/>
</exec>
</target>
<target name="init">
<taskdef name="drush" classname="Drush\Task" />
</target>
<!-- Build distro.make. -->
<target name="generate-distro.make" depends="init">
<echo msg="Generating distro.make from build.properties" />
<delete file="distro.make" />
<touch file="distro.make" />
<append destFile="${project.basedir}/distro.make" text="${drush.distro.template}" />
</target>
<!-- Execute drush make file and download profile. -->
<target name="drush-distro" depends="init,generate-distro.make">
<delete dir="${phing.project.build.dir}" includeemptydirs="true" failonerror="false" />
<drush command="make" assume="yes" pipe="true" bin="${drush.bin}">
<param>${drupal.distro.make.file}</param>
<param>${phing.project.build.dir}</param>
</drush>
</target>
<!-- Link custom modules. -->
<target name="link-modules" depends="init,generate-distro.make,drush-distro">
<symlink link="${drupal.modules.dir}/custom" target="../../../../modules/custom" />
</target>
<!-- Copy custom modules. -->
<target name="copy-modules" depends="init,generate-distro.make,drush-distro">
<copy todir="${drupal.modules.dir}">
<fileset dir="modules" />
</copy>
</target>
<target name="link-docroot" description="Link site document root to Apache document root">
<symlink link="${server.docroot}" target="${project.code.dir}" overwrite="true" />
</target>
<!-- Link test files into the build root. -->
<target name="link-tests" depends="init,generate-distro.make,drush-distro">
<if>
<not>
<available file="${project.basedir}/tests/behat.yml" type="file" />
</not>
<then>
<echo message="Creating behat.yml config file" />
<loadfile property="behat.yml" file="${project.basedir}/tests/behat.yml.dist">
<filterchain>
<replacetokens>
<token key="project.code.dir" value="${project.code.dir}" />
<token key="drupal.site.dir" value="${drupal.site.dir}" />
<token key="behat.base_url" value="${behat.base_url}" />
</replacetokens>
</filterchain>
</loadfile>
<echo message="${behat.yml}" file="${project.basedir}/tests/behat.yml" />
</then>
</if>
<symlink link="${phing.project.build.dir}/behat.yml" target="../tests/behat.yml" />
<symlink link="${phing.project.build.dir}/features" target="../tests/features" />
</target>
<!-- Make files directory. -->
<target name="files-directory" depends="init">
<mkdir dir="${drupal.files.dir}" />
<chmod file="${drupal.files.dir}" mode="0775" failonerror="true" />
</target>
<!-- Manipulate settings.php file. -->
<target name="create-settings.php" depends="init">
<echo msg="Copying default.settings.php file to settings.php..." />
<copy file="${drupal.settings.dir}/default.settings.php" tofile="${drupal.settings.dir}/settings.php" />
<chmod file="${drupal.settings.dir}/settings.php" mode="0775" failonerror="true" />
</target>
<!-- Install dependencies. -->
<target name="install-dependencies" description="Install dependencies." depends="init">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${project.code.dir}" />
</composer>
</target>
<!-- Install drupal. -->
<target name="install-drupal" description="Run the install." depends="init">
<drush command="site-install" assume="yes" root="${project.basedir}/${phing.project.build.dir}" bin="${drush.bin}">
<option name="db-url" value="${drupal.db.url}"/>
<option name="site-name" value="${phing.project.name}"/>
<param>${drupal.profile.name}</param>
<param>--quiet</param>
</drush>
</target>
<!-- Enable modules. -->
<target name="enable-drupal-modules" description="Enable Drupal modules." depends="install-drupal">
<drush command="pm-enable" assume="yes" root="${project.basedir}/${phing.project.build.dir}" bin="${drush.bin}">
<param>calculator</param>
<param>--quiet</param>
</drush>
</target>
<!-- Run behat tests. -->
<target name="behat-tests" description="Run behat tests." depends="init">
<exec command="${behat.bin}"
logoutput="true"
checkreturn="true"
dir="${project.code.dir}"
passthru="true" />
</target>
<target name="build-dev"
description="Build a local Drupal site in order to dev"
depends="init, generate-distro.make, drush-distro, link-modules, link-tests, files-directory, create-settings.php" />
<target name="build-dist"
description="Build the Drupal site in order to install it"
depends="init, generate-distro.make, drush-distro, copy-modules, files-directory, create-settings.php" />
<target name="install"
description="Install the Drupal site"
depends="install-drupal, enable-drupal-modules" />
<target name="test"
description="Run tests."
depends="behat-tests" />
</project>