This repository was archived by the owner on Dec 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.xml
More file actions
384 lines (339 loc) · 18.4 KB
/
build.xml
File metadata and controls
384 lines (339 loc) · 18.4 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<?xml version="1.0" encoding="UTF-8"?>
<project name="Shopsys Framework" default="list">
<property file="${project.basedir}/build/build.local.properties" />
<import file="build-dev.xml" optional="true" />
<property name="path.app" value="${path.root}/app"/>
<property name="path.bin" value="${path.vendor}/bin"/>
<property name="path.build" value="${path.root}/build"/>
<property name="path.build.properties.local" value="${path.build}/build.local.properties"/>
<property name="path.build.stats" value="${path.build}/stats"/>
<property name="path.chromedriver.executable" value="chromedriver"/>
<property name="path.codeception.configuration" value="${path.build}/codeception.yml"/>
<property name="path.codeception.executable" value ="${path.bin}/codecept"/>
<property name="path.composer.executable" value="composer"/>
<property name="path.env.test" value="${path.root}/TEST"/>
<property name="path.eslint.executable" value="${path.root}/node_modules/.bin/eslint"/>
<property name="path.framework" value="${path.vendor}/shopsys/framework"/>
<property name="path.grunt.executable" value="node_modules/.bin/grunt"/>
<property name="path.npm.executable" value="npm"/>
<property name="path.pg_dump.executable" value="pg_dump"/>
<property name="path.php.executable" value="php"/>
<property name="path.ecs.executable" value="${path.bin}/ecs"/>
<property name="path.phplint.executable" value="${path.bin}/parallel-lint"/>
<property name="path.phpstan.config" value="${path.root}/phpstan.neon"/>
<property name="path.phpstan.executable" value="${path.bin}/phpstan"/>
<property name="path.phpunit.executable" value="${path.bin}/phpunit"/>
<property name="path.root" value="."/>
<property name="path.src" value="${path.root}/src"/>
<property name="path.test.database.dump" value="${path.var}/cache/test-db-dump.sql"/>
<property name="path.tests" value="${path.root}/tests"/>
<property name="path.var" value="${path.root}/var"/>
<property name="path.vendor" value="${path.root}/vendor"/>
<property name="path.web" value="${path.root}/web"/>
<property name="path.web.scripts" value="${path.web}/assets/scripts"/>
<property name="path.web.styles.admin" value="${path.web}/assets/admin/styles"/>
<property name="path.web.styles.front" value="${path.web}/assets/frontend/styles"/>
<property name="path.bin-console" value="bin/console"/>
<property name="is-multidomain" value="false" />
<if>
<os family="windows" />
<then>
<property name="dev.null" value="NUL"/>
</then>
<else>
<property name="dev.null" value="/dev/null"/>
</else>
</if>
<target name="build" depends="build-deploy-part-1-db-independent, build-deploy-part-2-db-dependent" description="Builds application for production preserving your DB."/>
<target name="build-deploy-part-1-db-independent" depends="clean,composer,npm,dirs-create,domains-urls-check,assets" description="First part of application build for production preserving your DB (can be run without maintenance page)."/>
<target name="build-deploy-part-2-db-dependent" depends="db-migrations,create-domains-data,generate-friendly-urls,replace-domains-urls,grunt,error-pages-generate,warmup" description="Second part of application build for production preserving your DB (must be run with maintenance page when containing DB migrations)."/>
<target name="build-new" depends="wipe,composer,npm,dirs-create,domains-urls-check,assets,db-rebuild,grunt,error-pages-generate,warmup,microservice-product-search-create-structure" description="Builds application for production with clean DB (with base data only)."/>
<target name="build-demo" depends="wipe,composer,npm,dirs-create,domains-urls-check,assets,db-demo,grunt,error-pages-generate,warmup,microservice-product-search-recreate-structure" description="Builds application for production with clean demo DB."/>
<target name="db-demo" depends="db-wipe-public-schema,db-import-basic-structure,db-migrations,db-fixtures-demo-singledomain,create-domains-data,db-fixtures-demo-multidomain,load-plugin-demo-data,generate-friendly-urls,replace-domains-urls" description="Creates DB and fills it with demo data"/>
<target name="db-rebuild" depends="db-wipe-public-schema,db-import-basic-structure,db-migrations,create-domains-data,generate-friendly-urls,replace-domains-urls" description="Drops all data in database and creates a new one with base data only."/>
<target name="microservice-product-search-recreate-structure" depends="microservice-product-search-delete-structure,microservice-product-search-create-structure" description="Recreates structure for searching via microservice (deletes existing structure and creates new one)" />
<target name="assets" description="Installs web assets from external bundles into a public web directory.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true" output="${dev.null}">
<arg value="${path.bin-console}" />
<arg value="assetic:dump" />
</exec>
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.root}/web/bundles/">
<exclude name="/" />
</fileset>
</delete>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="assets:install" />
<arg value="${path.root}/web/" />
</exec>
</target>
<target name="clean" description="Cleans up directories with cache and scripts which are generated on demand.">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.var}/cache/">
<exclude name="/" />
</fileset>
<fileset dir="${path.web.scripts}/">
<exclude name="/" />
</fileset>
</delete>
</target>
<target name="clean-styles" description="Cleans up directories with CSS generated by Grunt.">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.web.styles.admin}/">
<exclude name="/" />
</fileset>
<fileset dir="${path.web.styles.front}/">
<exclude name="/" />
</fileset>
</delete>
</target>
<target name="composer" description="Installs dependencies for production.">
<exec
executable="${path.composer.executable}"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="install" />
<arg value="--no-dev" />
</exec>
</target>
<target name="create-domains-data" description="Creates domains data for newly configured domains.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:domains-data:create" />
</exec>
</target>
<target name="microservice-product-search-create-structure" description="Creates structure for searching via microservice.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:microservice:product-search:create-structure" />
</exec>
</target>
<target name="microservice-product-search-delete-structure" description="Deletes structure for searching via microservice.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:microservice:product-search:delete-structure" />
</exec>
</target>
<target name="microservice-product-search-export-products" description="Exports all products for searching via microservice.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:microservice:product-search:export-products" />
</exec>
</target>
<target name="cron" description="Runs background jobs. Should be executed periodically by system Cron every 5 minutes.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:cron" />
</exec>
</target>
<target name="cron-list" description="Lists all available background jobs.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:cron" />
<arg value="--list" />
</exec>
</target>
<target name="db-check-mapping" description="Checks if ORM mapping is valid.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:migrations:check-mapping" />
</exec>
</target>
<target name="db-create" description="Creates database for application with required configuration.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:database:create" />
</exec>
</target>
<target name="db-check-schema" depends="db-check-mapping" description="Checks if database schema is satisfying ORM and returns a list of suggestions to fix it.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:migrations:check-schema" />
</exec>
</target>
<target name="db-fixtures-demo-multidomain" description="Loads multidomain demo data fixtures excluding first domain.">
<if>
<istrue value="${is-multidomain}" />
<then>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:fixtures:load" />
<arg value="--fixtures=${path.framework}/src/DataFixtures/DemoMultidomain" />
<arg value="--append" />
<arg value="--no-interaction" />
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:recalculations" />
</exec>
</then>
<else>
<echo message="Multidomain demo data creation skipped." />
</else>
</if>
</target>
<target name="db-fixtures-demo-singledomain" description="Loads demo data fixtures for the first domain.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:fixtures:load" />
<arg value="--fixtures=${path.framework}/src/DataFixtures/Demo" />
<arg value="--append" />
<arg value="--no-interaction" />
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:recalculations" />
</exec>
</target>
<target name="db-import-basic-structure" description="Imports basic database structure (without migrations).">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:schema:import-default" />
</exec>
</target>
<target name="db-migrations" description="Executes database migrations and checks schema.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:migrations:migrate" />
</exec>
</target>
<target name="db-migrations-count" description="Get count of database migrations to execute.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:migrations:count" />
</exec>
</target>
<target name="db-migrations-generate" depends="db-check-mapping" description="Generates migration file when DB schema is not satisfying ORM.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:migrations:generate" />
</exec>
</target>
<target name="db-wipe-public-schema" description="Drops and creates public database schema.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:schema:drop" />
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:schema:create" />
</exec>
</target>
<target name="dirs-create" description="Creates application directories for locks, docs, content, images, uploaded files, etc.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:create-directories" />
</exec>
</target>
<target name="domains-urls-check" description="Checks the domain urls configuration.">
<if>
<not>
<available file='${path.app}/config/domains_urls.yml' type='file' />
</not>
<then>
<fail message = "File domains_urls.yml does not exist. You should create it using domains_urls.yml.dist as a template."/>
</then>
</if>
</target>
<target name="error-pages-generate" description="Generates error pages displayed in production environment.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:error-page:generate-all" />
</exec>
</target>
<target name="generate-friendly-urls" description="Generates friendly urls for supported entities when missing.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:generate:friendly-url" />
</exec>
</target>
<target name="grunt" depends="gruntfile,clean-styles" description="Builds CSS into LESS via Grunt.">
<exec executable="${path.grunt.executable}" dir="${path.root}" passthru="true" checkreturn="true" />
</target>
<target name="gruntfile" description="Generates Gruntfile.js by domain settings.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:generate:gruntfile" />
</exec>
</target>
<target name="list" description="Hidden target to make Phing list all targets when called without an argument." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="phing" />
<arg value="-l" />
</exec>
</target>
<target name="maintenance-off" description="Turns the maintenance page off.">
<delete file="${path.root}/MAINTENANCE" />
</target>
<target name="maintenance-on" description="Turns the maintenance page on.">
<touch file="${path.root}/MAINTENANCE" />
</target>
<target name="npm" description="Installs modules required for Grunt.">
<exec
executable="${path.npm.executable}"
dir="${path.root}"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="prune"/>
</exec>
<exec
executable="${path.npm.executable}"
dir="${path.root}"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="install"/>
</exec>
</target>
<target name="replace-domains-urls" description="Replaces domains urls in database by urls in configuration.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:domains-urls:replace" />
</exec>
</target>
<target name="load-plugin-demo-data" description="Loads data fixtures of all registered plugins.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="shopsys:plugin-data-fixtures:load" />
</exec>
</target>
<target name="warmup" description="Warms up cache.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}" />
<arg value="cache:warmup" />
</exec>
</target>
<target name="wipe" depends="wipe-excluding-logs" description="Wipes out all generated and/or uploaded files.">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.var}/logs/" />
</delete>
</target>
<target name="wipe-excluding-logs" depends="clean,clean-styles" description="Wipes out all generated and/or uploaded files except for logs.">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.var}/">
<exclude name=".gitkeep" />
<exclude name="logs/**" />
<exclude name="postgres-data/**" />
<exclude name="elasticsearch-data/**" />
</fileset>
<fileset dir="${path.build.stats}/">
<exclude name="/" />
</fileset>
<fileset dir="${path.root}/docs/generated/">
<exclude name="/" />
</fileset>
<fileset dir="${path.web}/components/">
<exclude name="/" />
</fileset>
<fileset dir="${path.web}/content/">
<exclude name="/" />
</fileset>
</delete>
</target>
</project>