-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbuild.package.xml
219 lines (199 loc) · 10.2 KB
/
build.package.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?xml version="1.0" encoding="UTF-8" ?>
<project name="My subsite" default="help">
<!-- Delete the previous build. -->
<target name="delete-platform">
<!--
During the Drupal installation process the settings folder is write
protected. Ensure it is writeable so it can be removed.
-->
<if>
<available file="${platform.build.settings.dir}" type="dir" />
<then>
<chmod mode="0777" failonerror="false" verbose="false" quiet="true">
<fileset dir="${platform.build.settings.dir}" />
</chmod>
</then>
</if>
<echo msg="Delete previous build." />
<!-- Use the faster native command on UNIX systems. -->
<if>
<os family="unix" />
<then>
<echo msg='rm -rf "${platform.build.dir}"' />
<exec
command='rm -rf "${platform.build.dir}"'
dir="${project.basedir}"
passthru="true" />
</then>
<else>
<delete dir="${platform.build.dir}" includeemptydirs="true" failonerror="false" />
</else>
</if>
</target>
<!-- Make the subsite. -->
<target name="make-subsite" depends="unpack-platform">
<echo msg="Make the subsite." />
<drush
command="make"
assume="yes"
bin="${drush.bin}"
pipe="yes"
verbose="${drush.verbose}"
root="${platform.build.dir}">
<param>${subsite.make}</param>
<param>${platform.build.dir}</param>
<!-- Increasing the concurrency improves the build time by a factor of 3. -->
<option name="concurrency">10</option>
<option name="no-patch-txt"></option>
<!-- This option will allow us to build inside an existing folder. -->
<option name="no-core"></option>
</drush>
</target>
<!-- Symlink the source folders for easy development. -->
<target name="link-subsite-resources">
<!-- Symlink our custom modules. -->
<symlink link="${platform.build.subsite.modules.custom.dir}" target="${subsite.resources.modules.dir}" />
<!-- Symlink our custom features. -->
<symlink link="${platform.build.subsite.modules.features.dir}" target="${subsite.resources.features.dir}" />
<!-- Symlink our custom themes. Delete the empty folder which is created during Drush make. -->
<delete dir="${platform.build.subsite.themes.dir}" includeemptydirs="true" failonerror="false" />
<symlink link="${platform.build.subsite.themes.dir}" target="${subsite.resources.themes.dir}" />
<!-- Symlink our custom PSR-4 code. -->
<symlink link="${platform.build.subsite.source.dir}" target="${subsite.resources.source.dir}" />
<!-- Symlink composer configuration. -->
<symlink link="${platform.build.subsite.composer.json}" target="${subsite.resources.composer.json}" />
<symlink link="${platform.build.subsite.composer.lock}" target="${subsite.resources.composer.lock}" />
</target>
<!-- Install Composer dependencies for the build system. -->
<target name="install-build-dependencies">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${project.basedir}" />
</composer>
</target>
<!-- Install Composer dependencies for the subsite. -->
<target name="install-subsite-dependencies">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${platform.build.subsite.dir}" />
</composer>
</target>
<!-- Link site document root to Webserver document root. -->
<target
name="link-docroot"
description="Create a symlink from the build folder to the webserver document root.">
<symlink link="${server.docroot}" target="${platform.build.dir}" overwrite="true" />
</target>
<!-- Update .htaccess. -->
<target name="update-htaccess">
<if>
<istrue value="${drupal.htaccess.append.text}" />
<then>
<append destfile="${drupal.htaccess.path}" text="${drupal.htaccess.append.text}" />
</then>
</if>
</target>
<!-- Download the platform. -->
<target name="download-platform">
<!--
The platform is very large so downloading it can take a long time.
Only download it when it hasn't yet been downloaded.
-->
<if>
<not>
<available file="${platform.package.tarball}" type="file" />
</not>
<then>
<!-- Create the destination directory if it doesn't exist. -->
<mkdir dir="${platform.package.destination}" />
<echo msg="Starting to download the platform. Depending on your connection this can take between 5-30 minutes. Go get some coffee." />
<echo msg="This file will only be downloaded once and will be cached in ${platform.package.tarball}." />
<echo msg="You can delete this cached file whenever you want to download a new version of the platform." />
<continuousphp-config token="${platform.package.token}" />
<continuousphp-package
provider="${platform.package.provider}"
repository="${platform.package.repository}"
reference="${platform.package.reference}"
destination="${platform.package.destination}"
property="platform.package.property"
/>
<echo msg="Downloaded platform package reference ${platform.package.property}" />
</then>
<else>
<echo msg="Skipping platform download, it is already downloaded at ${platform.package.tarball}. Delete this file if you want to download the latest version." />
</else>
</if>
</target>
<!-- Unpack the platform. -->
<target name="unpack-platform" depends="download-platform, delete-platform">
<!-- Use the faster native commands on UNIX systems. -->
<if>
<os family="unix" />
<then>
<!--
The tarball contains the entire build folder including all
resources that were used to create the build. Extract it in a
temporary location and then move the correct subfolder that
contains the actual build.
A feature request is pending at ContinuousPHP to have only the build
folder available for download.
Todo: Remove this workaround when ContinuousPHP adds support for
downloading only the actual build folder.
-->
<echo msg='rm -rf "${platform.package.destination}/extract"' />
<exec
command='rm -rf "${platform.package.destination}/extract"'
dir="${project.basedir}"
passthru="true" />
<echo msg='mkdir "${platform.package.destination}/extract"' />
<exec
command='mkdir "${platform.package.destination}/extract"'
dir="${project.basedir}"
passthru="true" />
<echo msg='tar xzf "${platform.package.tarball}" -C "${platform.package.destination}/extract"' />
<exec
command='tar xzf "${platform.package.tarball}" -C "${platform.package.destination}/extract"'
dir="${project.basedir}"
passthru="true" />
<echo msg='mv "${platform.package.destination}/extract/build" "${platform.build.dir}"' />
<exec
command='mv "${platform.package.destination}/extract/build" "${platform.build.dir}"'
dir="${project.basedir}"
passthru="true" />
<echo msg='rm -rf "${platform.package.destination}/extract"' />
<exec
command='rm -rf "${platform.package.destination}/extract"'
dir="${project.basedir}"
passthru="true" />
</then>
<else>
<!--
The tarball contains the entire build folder including all
resources that were used to create the build. Extract it in a
temporary location and then move the correct subfolder that
contains the actual build.
A feature request is pending at ContinuousPHP to have only the build
folder available for download.
Todo: Remove this workaround when ContinuousPHP adds support for
downloading only the actual build folder.
-->
<delete dir="${platform.package.destination}/extract" includeemptydirs="true" failonerror="false" quiet="true" />
<untar file="${platform.package.tarball}" todir="${platform.package.destination}/extract" />
<move includeemptydirs="true" todir="${platform.build.dir}">
<fileset dir="${platform.package.destination}/extract/build"/>
</move>
<delete dir="${platform.package.destination}/extract" includeemptydirs="true" failonerror="false" />
</else>
</if>
</target>
<!-- Copy subsite resources into the build folder. -->
<target name="copy-subsite-resources">
<echo msg="TODO: COPY SUBSITE RESOURCES." />
</target>
<target
name="build-dev"
description="Build a local development version of the subsite."
depends="install-build-dependencies, delete-platform, download-platform, unpack-platform, make-subsite, link-subsite-resources, install-subsite-dependencies, setup-behat, update-htaccess, setup-php-codesniffer" />
<target
name="build-dist"
description="Build a version of the subsite intended to distribute as a release package."
depends="install-build-dependencies, delete-platform, download-platform, unpack-platform, make-subsite, copy-subsite-resources" />
</project>