-
Notifications
You must be signed in to change notification settings - Fork 42
/
build.package.xml
361 lines (323 loc) · 16.6 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?xml version="1.0" encoding="UTF-8" ?>
<project name="NextEuropa" default="help">
<!--Overrides -->
<!-- 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." />
<delete dir="${phing.project.build.dir}" includeemptydirs="true" failonerror="false" />
<echo msg="Delete profiles/multisite_drupal_standard/modules/contrib folder." />
<delete dir="profiles/multisite_drupal_standard/modules/contrib" includeemptydirs="true" failonerror="false" />
<echo msg="Delete profiles/multisite_drupal_communities/modules/contrib folder." />
<delete dir="profiles/multisite_drupal_communities/modules/contrib" includeemptydirs="true" failonerror="false" />
<echo msg="Delete profiles/multisite_drupal_standard/themes folder." />
<delete dir="profiles/multisite_drupal_standard/themes" includeemptydirs="true" failonerror="false" />
<echo msg="Delete profiles/multisite_drupal_communities/themes folder." />
<delete dir="profiles/multisite_drupal_communities/themes" includeemptydirs="true" failonerror="false" />
</target>
<!-- Make Drupal core. -->
<target name="make-drupal-core">
<!--
Drupal core is created in a separate target because Drush make only
allows to build in a pre-existing folder if the 'no-core' option is
set.
-->
<echo msg="Make Drupal core." />
<drush
command="make"
assume="yes"
bin="${drush.bin}"
pipe="yes"
verbose="${drush.verbose}"
root="${platform.build.dir}">
<param>${drupal.make}</param>
<param>${platform.build.dir}</param>
<option name="no-patch-txt"></option>
</drush>
</target>
<!-- Make the platform. -->
<target name="make-platform">
<echo msg="Make the platform." />
<drush
command="make"
assume="yes"
bin="${drush.bin}"
pipe="yes"
verbose="${drush.verbose}"
root="${platform.build.dir}">
<param>${platform.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>
<!-- Install all contributed projects inside the chosen profile. -->
<option name="contrib-destination">profiles/${platform.profile.name}</option>
</drush>
<delete>
<fileset dir="${platform.build.dir}/profiles/${platform.profile.name}/libraries/mpdf/ttfonts" >
<include name="*.*" />
</fileset>
</delete>
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${platform.build.profiles.dir}/${platform.profile.name}/libraries/mpdf" />
<arg value="--no-dev" />
</composer>
<!-- Copy the "mpdf-platform-specific-fonts/ttfonts" folder into libraries/mpdf. -->
<copy todir="${platform.build.dir}/profiles/${platform.profile.name}/libraries/mpdf/ttfonts">
<fileset dir="${platform.resources.dir}/patches/mpdf-platform-specific-fonts/ttfonts">
<include name="**"></include>
</fileset>
</copy>
<delete includeEmptyDirs="true">
<fileset dir="profiles/${platform.profile.name}/modules/contrib/xmlsitemap/xmlsitemap_user" />
</delete>
</target>
<!-- Make one of the profiles in order to build a multisite platform. -->
<target name="make-multisite-platform">
<!-- Override the location of the make file. -->
<property name="platform.make" value="${platform.resources.dir}/${platform.profile.name}.make" override="yes" />
<phingcall target="make-platform" />
</target>
<!-- Symlink the profile folders for easy development. -->
<target name="link-platform-profiles">
<!-- Delete the core profiles folder. -->
<delete dir="${platform.build.profiles.dir}" />
<!-- Symlink our profiles folder. -->
<symlink link="${platform.build.profiles.dir}" target="${platform.resources.profiles.dir}" />
</target>
<!-- Copy the profile folders for deploying on production. -->
<target name="copy-platform-profiles">
<!-- Delete the core profiles folder so it can be replaced with ours. -->
<delete dir="${platform.build.profiles.dir}" includeemptydirs="true" failonerror="true" />
<!-- Copy our profiles folder. -->
<copy todir="${platform.build.profiles.dir}">
<fileset dir="${platform.resources.profiles.dir}">
<include name="**"></include>
</fileset>
</copy>
</target>
<!-- Symlink various resources for easy development. -->
<target name="link-platform-resources">
<!-- Composer configuration. -->
<symlink link="${platform.build.composer.json}" target="${platform.resources.composer.json}" />
<symlink link="${platform.build.composer.lock}" target="${platform.resources.composer.lock}" />
<symlink link="${platform.build.favicon.ico}" target="${platform.resources.favicon.ico}" />
</target>
<!-- Copy various resources for deploying on production. -->
<target name="copy-platform-resources">
<!-- Resources to copy to the website root. -->
<copy todir="${platform.build.dir}">
<fileset dir="${platform.resources.dir}">
<!-- Composer configuration. -->
<include name="composer.*"></include>
<include name="favicon.ico"></include>
</fileset>
</copy>
</target>
<!-- Install Composer dependencies. -->
<target name="install-platform-dependencies">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${platform.build.dir}" />
<arg value="--no-dev" />
</composer>
</target>
<!-- Install Composer dependencies, including optional development dependencies. -->
<target name="install-platform-dev-dependencies">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${platform.build.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>
<!-- Setup file directory -->
<target name="setup-files-directory">
<if>
<istrue value="${platform.build.files.dir}" />
<then>
<mkdir dir="${platform.build.files.dir}" />
<mkdir dir="${platform.build.files.dir}/private_files" />
</then>
</if>
</target>
<target name="setup-drone-file-system">
<chown file="${platform.build.dir}" user="${webserver.user}" />
<chmod file="${platform.build.files.dir}" mode="0777" />
<mkdir dir="${platform.build.files.dir}/print_pdf" />
<chmod file="${platform.build.files.dir}/private_files" mode="0777" />
</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}" />
<arg value="--ansi"/>
<arg value="--no-suggest"/>
<arg value="--no-progress"/>
</composer>
</target>
<target
name="build-platform-dev"
description="Build a local development version of the platform."
depends="install-build-dependencies, delete-platform, make-drupal-core, link-platform-profiles, make-platform, link-platform-resources, install-platform-dev-dependencies, setup-behat, setup-behat-balancer, setup-phpunit, setup-php-codesniffer, update-htaccess, setup-files-directory" />
<target
name="build-platform-dist"
description="Build a version of the platform intended to distribute as a release package."
depends="install-build-dependencies, delete-platform, make-drupal-core, copy-platform-profiles, make-platform, copy-platform-resources, install-platform-dependencies, setup-files-directory" />
<target
name="build-multisite-dist"
description="Build a multisite version of the platform intended to distribute as a release package."
depends="install-build-dependencies, delete-platform, make-drupal-core, copy-platform-profiles">
<!-- First make the standard profile. -->
<property name="platform.profile.name" value="multisite_drupal_standard" override="yes" />
<phingcall target="make-multisite-platform" />
<!-- Then make the communities profile. -->
<property name="platform.profile.name" value="multisite_drupal_communities" override="yes" />
<phingcall target="make-multisite-platform" />
<!-- Call the remaining build targets. -->
<phingcall target="copy-platform-resources" />
<phingcall target="install-platform-dependencies" />
</target>
<target
name="build-europa-theme"
description="Downloads Europa theme and creates symlink.">
<phingcall target="process-europa-theme" />
<phingcall target="create-europa-theme-symlinks" />
</target>
<!-- This step in future will become a part of a build on the new Europa theme repository. -->
<target name="process-europa-theme">
<!-- Download the Europa theme archive for a given branch. -->
<exec
command="curl -L https://github.com/ec-europa/ec_europa/releases/download/${ec_europa.version}/ec_europa-${ec_europa.version}.tar.gz > profiles/common/themes/ec_europa.tar.gz"
passthru="true" />
<!-- Extract the archive -->
<mkdir dir="profiles/common/themes/ec_europa" />
<exec
dir="profiles/common/themes"
command="tar xzf ec_europa.tar.gz --strip=1 -C ec_europa"
passthru="true" />
<delete file="profiles/common/themes/ec_europa.tar.gz" quiet="true" />
<phingcall target="embed-ecl-assets" />
</target>
<target name="embed-ecl-assets">
<!-- Download the ECL release package. -->
<exec
command="curl -L https://github.com/ec-europa/europa-component-library/releases/download/${ecl.version}/framework.tar.gz > profiles/common/themes/ec_europa/framework.tar.gz"
passthru="true" />
<!-- Extract and embed the ECL artifacts into the Europa theme. -->
<exec
dir="profiles/common/themes/ec_europa"
command="tar xzf framework.tar.gz --strip=1 -C assets"
passthru="true" />
<delete file="profiles/common/themes/ec_europa/framework.tar.gz" quiet="true" />
</target>
<!-- Creates symlinks for the atomium and europa themes. -->
<target name="create-europa-theme-symlinks" >
<symlink link="profiles/${platform.profile.name}/themes">
<fileset dir="${platform.resources.profiles.common.themes.dir}">
<include name="ec_europa" />
</fileset>
</symlink>
</target>
<target
name="build-europa-dev"
description="Build a local development version of the platform based on the EC Europa theme."
depends="install-build-dependencies, delete-platform, make-drupal-core, link-platform-profiles, make-platform, link-platform-resources, install-platform-dev-dependencies, setup-behat, setup-behat-balancer, setup-phpunit, setup-php-codesniffer, update-htaccess, setup-files-directory, europa-theme-repo-clone, europa-theme-build" />
<!-- Cloning and checking out the branch of the Atomium and EC Europa theme repositories. -->
<target name="europa-theme-repo-clone">
<!-- Deleting theme directories before cloning -->
<delete dir="${platform.resources.profiles.common.themes.dir}/atomium" quiet="true"/>
<delete dir="${platform.resources.profiles.common.themes.dir}/ec_europa" quiet="true"/>
<!-- Cloning the Atomium theme repo into the common profiles directory -->
<echo msg = "Cloning the Atomium theme repository."/>
<gitclone
repository="${platform.theme.atomium.repo.url}"
targetPath="${platform.resources.profiles.common.themes.dir}/atomium"/>
<!-- Checking out the configured branch in the cloned repo -->
<gitcheckout
repository="${platform.resources.profiles.common.themes.dir}/atomium"
branchname="${platform.theme.atomium.repo.branch}"/>
<!-- cloning the EC Europa theme repo into the common profiles directory -->
<echo msg = "Cloning the EC Europa theme repository."/>
<gitclone
repository="${platform.theme.europa.repo.url}"
targetPath="${platform.resources.profiles.common.themes.dir}/ec_europa"/>
<!-- Checking out the configured branch in the cloned repo -->
<gitcheckout
repository="${platform.resources.profiles.common.themes.dir}/ec_europa"
branchname="${platform.theme.europa.repo.branch}"/>
<!-- Checking if we should overwrite atomium or ec_europa theme -->
<if>
<and>
<isset property="platform.theme.atomium.dev" />
<equals arg1="${platform.theme.atomium.dev}" arg2="true" />
</and>
<then>
<echo msg="Overwriting atomium from make file with branch ${platform.theme.atomium.repo.branch}." />
<!-- Deleteing the theme directories from the current profile -->
<delete dir="profiles/${platform.profile.name}/themes/atomium" quiet="true"/>
<!-- Symlinking the atomium theme from the "common" profile folder -->
<symlink link="profiles/${platform.profile.name}/themes/atomium" target="${platform.resources.profiles.common.themes.dir}/atomium" />
</then>
</if>
<if>
<and>
<isset property="platform.theme.europa.dev" />
<equals arg1="${platform.theme.europa.dev}" arg2="true" />
</and>
<then>
<echo msg="Overwriting ec_europa from make file with branch ${platform.theme.europa.repo.branch}." />
<!-- Deleteing the theme directories from the current profile -->
<delete dir="profiles/${platform.profile.name}/themes/ec_europa" quiet="true"/>
<!-- Symlinking the ec_europa theme from the "common" profile folder -->
<symlink link="profiles/${platform.profile.name}/themes/ec_europa" target="${platform.resources.profiles.common.themes.dir}/ec_europa" />
</then>
</if>
</target>
<!-- Generating assets -->
<target name="europa-theme-build">
<exec
command="npm install"
passthru="true"
dir="${platform.resources.profiles.common.themes.dir}/ec_europa"
/>
<exec
command="npm run build"
passthru="true"
dir="${platform.resources.profiles.common.themes.dir}/ec_europa"
/>
<!-- Deleting *.map files (currently there is a bug in the ecl-builder) -->
<delete>
<fileset dir="${platform.resources.profiles.common.themes.dir}/ec_europa/assets/css">
<include name="*.map" />
</fileset>
<fileset dir="${platform.resources.profiles.common.themes.dir}/ec_europa/wysiwyg">
<include name="*.map" />
</fileset>
</delete>
</target>
</project>