-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
1786 lines (1593 loc) · 89.1 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
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<project name="shopsys_framework" default="list">
<property name="check-and-fix-annotations" value="false"/>
<property name="path.app" value="${path.root}/app"/>
<property name="path.bin" value="${path.vendor}/bin"/>
<property name="path.bin-console" value="${path.root}/bin/console"/>
<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.config" value="${path.root}/config"/>
<property name="path.env.acc" value="${path.root}/ACCEPTANCE"/>
<property name="path.eslint.executable" value="${path.node_modules.bin}/eslint"/>
<property name="path.framework" value="${project.basedir}"/>
<property name="path.framework.assets" value="${path.framework}/assets"/>
<property name="path.git.executable" value="git"/>
<property name="path.node_modules" value="${path.root}/node_modules"/>
<property name="path.node_modules.bin" value="${path.node_modules}/.bin"/>
<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.assets" value="${path.root}/assets"/>
<property name="path.templates" value="${path.root}/templates"/>
<property name="path.stylelint.executable" value="${path.node_modules.bin}/stylelint"/>
<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.tests.failed" value="${path.var}/PHING_TESTS_FAILED"/>
<property name="path.tests.functional" value="${path.tests}/App/Functional/"/>
<property name="path.tests.frontend_api.functional" value="${path.tests}/FrontendApiBundle/Functional/"/>
<property name="path.tests.frontend_api.functional.b2b" value="${path.tests}/FrontendApiBundle/FunctionalB2b/"/>
<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.yaml-standards.executable" value="${path.bin}/yaml-standards"/>
<property name="phpstan.level" value="5"/>
<property name="phpstan.memory-limit" value="2048M"/>
<property name="tests.stop-on-failed-group" value="false"/>
<property name="translations.dump.flags" value="--keep"/>
<property name="yaml-standards.indent-count" value="4"/>
<property name="yaml-standards.args" value=""/>
<if>
<os family="windows"/>
<then>
<property name="dev.null" value="NUL"/>
</then>
<else>
<property name="dev.null" value="/dev/null"/>
</else>
</if>
<target name="acceptance-elasticsearch-export" description="Exports indexes data into elasticsearch for acceptance environment.">
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="--env=acc"/>
<arg value="shopsys:elasticsearch:data-export"/>
<arg value="${elasticsearch.index}"/>
</exec>
</target>
<target name="annotations-check" description="Checks whether annotations of extended classes in the project match the actual types according to ClassExtensionRegistry. Reported problems can be fixed using 'annotations-fix' phing target">
<if>
<istrue value="${check-and-fix-annotations}"/>
<then>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
<arg value="--dry-run"/>
<arg value="--verbose"/>
</exec>
</then>
<else>
<echo>
Annotations checks are turned off by configuration, see "check-and-fix-annotations" build property.
You are still able to run "shopsys:extended-classes:annotations" Symfony command directly.
</echo>
</else>
</if>
</target>
<target name="annotations-fix" description="Fixes and adds annotations in project classes to improve static analysis and DX with extended classes">
<if>
<istrue value="${check-and-fix-annotations}"/>
<then>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
<arg value="--verbose"/>
</exec>
</then>
<else>
<echo>
Annotations fixes are turned off by configuration, see "check-and-fix-annotations" build property.
You are still able to run "shopsys:extended-classes:annotations" Symfony command directly.
</echo>
</else>
</if>
</target>
<target name="assets" description="Installs web assets from external bundles into a public web directory.">
<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/"/>
<arg value="--verbose"/>
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="elfinder:install"/>
<arg value="--docroot"/>
<arg value="web"/>
<arg value="--verbose"/>
</exec>
</target>
<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-demo" depends="production-protection,wipe,build-version-generate,composer-prod,redis-check,dirs-create,assets,npm,demo-data,error-pages-generate,warmup,clean-redis-old" description="Builds application for production with clean demo DB."/>
<target name="build-demo-ci" depends="production-protection,build-version-generate,wipe-excluding-logs,composer-dev,timezones-check,dirs-create,test-dirs-create,assets,npm,demo-data,error-pages-generate,tests-acceptance-build,clean-redis-old,checks-ci" description="Builds application for development with clean demo DB and runs CI checks."/>
<target name="build-demo-dev" depends="production-protection,build-version-generate,wipe-excluding-logs,composer-dev,timezones-check,dirs-create,test-dirs-create,assets,npm,demo-data,error-pages-generate,tests-acceptance-build,clean-redis-old,checks" description="Builds application for development with clean demo DB and runs checks on changed files."/>
<target name="build-demo-dev-quick" depends="production-protection,build-version-generate,wipe-excluding-logs,composer-dev,dirs-create,test-dirs-create,assets,npm,demo-data,clean-redis-old" description="Builds application for development with clean demo DB while skipping nonessential steps."/>
<target name="build-deploy-part-1-db-independent" depends="build-version-generate,clean,composer-prod,dirs-create,assets,npm" 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="check-migrate-uploaded-files,elasticsearch-index-migrate,redis-check,db-migrations,domains-data-create,friendly-urls-generate,domains-urls-replace,migrate-images-for-proxy,migrate-uploaded-files-force,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-dev" depends="build-version-generate,clean,composer-dev,timezones-check,dirs-create,test-dirs-create,assets,npm,db-migrations,domains-data-create,friendly-urls-generate,friendly-url-entity-mapping-check,domains-urls-replace,elasticsearch-index-recreate,elasticsearch-export,error-pages-generate,tests-acceptance-build,clean-redis-old,checks" description="Builds application for development preserving your DB and runs checks on changed files."/>
<target name="build-dev-quick" depends="build-version-generate,clean,composer-dev,dirs-create,test-dirs-create,assets,npm,db-migrations,domains-data-create,friendly-urls-generate,friendly-url-entity-mapping-check,domains-urls-replace,elasticsearch-index-migrate,clean-redis-old" description="Builds application for development preserving your DB while skipping nonessential steps."/>
<target name="build-new" depends="production-protection,wipe,build-version-generate,composer-prod,redis-check,dirs-create,assets,npm,db-rebuild,elasticsearch-index-recreate,error-pages-generate,warmup,clean-redis-old" description="Builds application for production with clean DB (with base data only)."/>
<target name="build-review-ci" depends="production-protection,wipe,build-version-generate,redis-check,dirs-create,db-demo,error-pages-generate,warmup,elasticsearch-index-recreate,elasticsearch-export,clean-redis-old" description="Builds application for review with clean demo DB."/>
<target name="build-version-generate" description="Generates parameters_version.yaml config file with a new build version number.">
<exec executable="${path.php.executable}" checkreturn="true" outputProperty="version">
<arg value="-r"/>
<arg value="echo date('YmdHis');"/>
</exec>
<copy file="${path.config}/parameters_version.yaml.dist" tofile="${path.config}/parameters_version.yaml" overwrite="true">
<filterchain>
<replacetokens begintoken="%%" endtoken="%%">
<token key="version" value="${version}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="check-migrate-uploaded-files" description="Checks if the uploaded files structure is compatible with 'migrate-uploaded-files'." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:uploaded-files:check-migrate"/>
</exec>
</target>
<target name="checks" depends="checks-internal,standards,tests" description="Runs internal checks, coding standards and runs unit, DB and smoke tests."/>
<target name="checks-ci" depends="checks-internal,test-db-demo,test-elasticsearch-index-recreate,test-elasticsearch-export,tests-functional,tests-smoke,tests-acceptance" description="Runs internal checks and runs DB, smoke and acceptance tests."/>
<target name="checks-diff" depends="checks-internal,standards-diff,tests" description="Runs internal checks, coding standards on changed files and runs unit, DB and smoke tests."/>
<target name="checks-internal" depends="db-check-schema,timezones-check,redis-check,composer-check" description="Runs all internal checks, eg. availability of services or validity of configuration." hidden="true"/>
<target name="clean" depends="clean-cache-dir" description="Cleans up directories with cache and scripts which are generated on demand."/>
<target name="clean-cache" depends="clean-cache-dir,clean-redis,clean-opcache" description="Cleans up all application cache."/>
<target name="clean-cache-dir" description="Cleans up directory with Symfony cache." hidden="true">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${path.var}/cache/">
<exclude name="/"/>
</fileset>
</delete>
</target>
<target name="clean-opcache" description="Cleans up PHP Opcache.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:clean-opcache"/>
</exec>
</target>
<target name="clean-redis" depends="redis-check" description="Cleans up redis cache">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true" output="${dev.null}">
<arg value="${path.bin-console}"/>
<arg value="shopsys:redis:clean-cache"/>
</exec>
</target>
<target name="clean-redis-old" depends="redis-check" description="Cleans up redis cache for previous build versions">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true" output="${dev.null}">
<arg value="${path.bin-console}"/>
<arg value="shopsys:redis:clean-cache-old"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="clean-redis-storefront" depends="redis-check" description="Cleans up storefront redis cache (queries and translations)">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:redis:clean-storefront-cache"/>
<arg value="--queries"/>
<arg value="--translations"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="cluster-first-deploy" hidden="true" description="Run commands for first deploy to cluster.">
<property name="production.confirm.action" value="y" override="true"/>
<phingcall target="db-wipe-tables-only"/>
<phingcall target="dirs-create"/>
<phingcall target="db-import-basic-structure"/>
<phingcall target="db-migrations"/>
<phingcall target="domains-data-create"/>
<phingcall target="frontend-api-generate-new-keys"/>
<phingcall target="elasticsearch-index-recreate"/>
<phingcall target="elasticsearch-export"/>
<phingcall target="error-pages-generate"/>
<phingcall target="warmup"/>
</target>
<target name="composer-check" description="Checks if Composer lock file is valid." hidden="true">
<exec executable="${path.composer.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="validate"/>
<arg value="--no-check-all"/>
</exec>
</target>
<target name="composer-dev" depends="production-protection,composer-check" description="Installs dependencies for development.">
<exec executable="${path.composer.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="install"/>
</exec>
</target>
<target name="composer-prod" 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="cron" description="Runs background jobs.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:cron"/>
<arg value="--verbose"/>
</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"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="cron-lock" description="This target will prevent any crons from running on this machine until it is terminated.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="deploy:cron:lock"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="cron-run-all-serially" depends="production-protection" description="This target will run all crons serially. It is not supposed to be run in the production environment but on CI servers to test that all crons run without errors.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:cron"/>
<arg value="--run-all-serially"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="cron-watch" description="Cron watch target is running until cron instance ends, then is terminated.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="deploy:cron:watch"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-check-mapping" depends="clean-cache" description="Checks if ORM mapping is valid." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:migrations:check-mapping"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-check-schema" depends="clean-cache,db-check-mapping" description="Checks if database schema is satisfying ORM and returns a list of suggestions to fix it." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:migrations:check-schema"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-create" depends="production-protection" 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"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-demo" depends="production-protection,frontend-api-generate-new-keys,db-wipe-public-schema,clean,clean-redis,db-import-basic-structure,db-migrations,domains-data-create,db-fixtures-demo,plugin-demo-data-load,friendly-urls-generate,friendly-url-entity-mapping-check,domains-urls-replace" description="Creates DB and fills it with demo data" hidden="true"/>
<target name="db-fixtures-demo" depends="production-protection" description="Loads demo data fixtures." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<env key="MESSENGER_TRANSPORT_DSN" value=""/>
<arg value="${path.bin-console}"/>
<arg value="doctrine:fixtures:load"/>
<arg value="--append"/>
<arg value="--no-interaction"/>
<arg value="--verbose"/>
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:recalculations"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-fixtures-performance" depends="production-protection" description="Loads performance data fixtures into main DB." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<env key="MESSENGER_TRANSPORT_DSN" value=""/>
<arg value="${path.bin-console}"/>
<arg value="shopsys:performance-data"/>
<arg value="--verbose"/>
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:recalculations"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-import-basic-structure" description="Imports basic database structure (without migrations)." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:schema:import-default"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-migrations" depends="clean,clean-redis" 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"/>
<arg value="-vv"/>
</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"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-migrations-count-with-maintenance" hidden="true" description="Get count of database migrations to execute and enable maintenance mode if more than zero.">
<exec executable="${path.php.executable}" checkreturn="true" outputProperty="migrationCounts">
<arg value="${path.bin-console}"/>
<arg value="shopsys:migrations:count"/>
<arg value="--simple"/>
<arg value="--verbose"/>
</exec>
<if>
<equals arg1="${migrationCounts}" arg2="0"/>
<then>
<echo message="There is no need to enable maintenance mode"/>
</then>
<else>
<phingcall target="maintenance-on"/>
</else>
</if>
</target>
<target name="db-migrations-generate" depends="clean-cache,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"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-migrations-generate-empty" description="Generates new empty migration file.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:migrations:generate"/>
<arg value="--empty"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-performance" depends="production-protection,db-wipe-public-schema,clean,clean-redis,db-import-basic-structure,db-migrations,domains-data-create,db-fixtures-demo,plugin-demo-data-load,friendly-urls-generate,friendly-url-entity-mapping-check,domains-urls-replace,db-fixtures-performance" description="Drops all data in main database and creates a new one with performance data."/>
<target name="db-rebuild" depends="production-protection,db-wipe-public-schema,db-import-basic-structure,db-migrations,domains-data-create,friendly-urls-generate,friendly-url-entity-mapping-check,domains-urls-replace" description="Drops all data in database and creates a new one with base data only."/>
<target name="db-wipe-public-schema" depends="production-protection" description="Drops and creates public database schema." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:schema:drop"/>
<arg value="--verbose"/>
</exec>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:schema:create"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="db-wipe-tables-only" depends="production-protection" description="Drops all tables in the database." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:schema:drop"/>
<arg value="--tables-only"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="demo-data" depends="production-protection,db-wipe-public-schema,db-import-basic-structure,db-migrations,domains-data-create,db-fixtures-demo,plugin-demo-data-load,friendly-urls-generate,domains-urls-replace,elasticsearch-index-recreate,elasticsearch-export" description="Wipes Postgres DB, recreates structure, fills with demo data and then exports data to Elasticsearch"/>
<target name="diff-files" description="Finds changed files (against origin/master) and saves them into properties." hidden="true">
<exec executable="${path.git.executable}" outputProperty="git.status.output" returnProperty="git.status.returnCode">
<arg value="status"/>
</exec>
<if>
<not>
<equals arg1="${git.status.returnCode}" arg2="0"/>
</not>
<then>
<echo level="error" message="Searching for changed files requires Git to be installed and the .git directory to be available."/>
<echo level="info" message="By default, the .git directory is excluded from synchronization of files using docker-sync on Windows and Mac in order to deliver better performance and stability."/>
<echo level="info" message="If that's your case, either remove '.git' from 'sync_excludes' in your 'docker-sync.yml' or use the target without the '-diff' suffix."/>
<fail message="${git.status.output}"/>
</then>
</if>
<exec executable="${path.git.executable}" outputProperty="git.merge.base">
<arg value="merge-base"/>
<arg value="origin/master"/>
<arg value="HEAD"/>
</exec>
<exec executable="${path.git.executable}" outputProperty="git.files.changed">
<arg value="diff"/>
<arg value="--name-only"/>
<arg value="--diff-filter=ACMR"/>
<arg value="${git.merge.base}"/>
<arg path="${path.app}"/>
<arg path="${path.src}"/>
<arg path="${path.tests}"/>
</exec>
<exec executable="${path.git.executable}" outputProperty="git.files.unstaged">
<arg value="ls-files"/>
<arg value="--others"/>
<arg value="--exclude-standard"/>
<arg path="${path.app}"/>
<arg path="${path.src}"/>
<arg path="${path.tests}"/>
<arg path="${path.assets}"/>
</exec>
<property name="diff.files.all" value="${git.files.changed}${line.separator}${git.files.unstaged}">
<filterchain>
<!-- ignore Codeception generated class for running acceptance tests -->
<linecontainsregexp>
<regexp pattern="^(?!tests/App/Test/Codeception/_generated/AcceptanceTesterActions.php).+$"/>
</linecontainsregexp>
</filterchain>
</property>
<property name="diff.files.js" value="${diff.files.all}">
<filterchain>
<linecontainsregexp>
<!-- linecontainsregexp splits lines using \n, so string can end with whitespace -->
<regexp pattern="\.js\s*$"/>
</linecontainsregexp>
</filterchain>
</property>
<property name="diff.files.php" value="${diff.files.all}">
<filterchain>
<linecontainsregexp>
<!-- linecontainsregexp splits lines using \n, so string can end with whitespace -->
<regexp pattern="\.php\s*$"/>
</linecontainsregexp>
</filterchain>
</property>
<property name="diff.files.twig" value="${diff.files.all}">
<filterchain>
<linecontainsregexp>
<!-- linecontainsregexp splits lines using \n, so string can end with whitespace -->
<regexp pattern="\.twig\s*$"/>
</linecontainsregexp>
</filterchain>
</property>
<property name="diff.files.all.spaces" value="${diff.files.all}">
<filterchain>
<replaceregexp>
<regexp pattern="[\r\n]+" replace=" "/>
</replaceregexp>
</filterchain>
</property>
<property name="diff.files.js.spaces" value="${diff.files.js}">
<filterchain>
<replaceregexp>
<regexp pattern="[\r\n]+" replace=" "/>
</replaceregexp>
</filterchain>
</property>
<property name="diff.files.php.spaces" value="${diff.files.php}">
<filterchain>
<replaceregexp>
<regexp pattern="[\r\n]+" replace=" "/>
</replaceregexp>
</filterchain>
</property>
<property name="diff.files.twig.spaces" value="${diff.files.twig}">
<filterchain>
<replaceregexp>
<regexp pattern="[\r\n]+" replace=" "/>
</replaceregexp>
</filterchain>
</property>
<property name="diff.files.php.commas" value="${diff.files.php}">
<filterchain>
<replaceregexp>
<regexp pattern="[\r\n]+" replace=","/>
<regexp pattern="^,|,$" replace=""/>
</replaceregexp>
</filterchain>
</property>
</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-data-create" depends="domains-db-functions-create" description="Creates domains data for newly configured domains. You should run it when you modify domains.yaml">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:domains-data:create"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="domains-db-functions-create" description="Creates new domains DB functions." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:domains-db-functions:create"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="domains-info-load" description="Load info about domains configuration into Phing properties." hidden="true">
<exec executable="${path.php.executable}" outputProperty="domains-info.ids" error="${dev.null}">
<arg value="${path.bin-console}"/>
<arg value="shopsys:domains:info"/>
<arg value="--oneline"/>
<arg value="--verbose"/>
</exec>
<exec executable="${path.php.executable}" outputProperty="domains-info.locales" error="${dev.null}">
<arg value="${path.bin-console}"/>
<arg value="shopsys:domains:info"/>
<arg value="locale"/>
<arg value="--deduplicate"/>
<arg value="--oneline"/>
<arg value="--verbose"/>
</exec>
<if>
<matches string="${domains-info.ids}" pattern="\d+\s+\d+"/>
<then>
<property name="domains-info.is-multidomain" value="true"/>
<property name="phpunit-exclude-group" value="singledomain"/>
</then>
<else>
<property name="domains-info.is-multidomain" value="false"/>
<property name="phpunit-exclude-group" value="multidomain"/>
</else>
</if>
</target>
<target name="domains-urls-replace" description="Replaces domains urls in database by urls in configuration. You should run it when you modify domains_urls.yaml">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:domains-urls:replace"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="ecs" description="Checks coding standards in all files by PHP easy coding standards." depends="entities-dump" hidden="true">
<exec executable="${path.ecs.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="check"/>
<arg value="--clear-cache"/>
</exec>
</target>
<target name="ecs-diff" description="Checks coding standards in changed files by PHP easy coding standards." depends="entities-dump" hidden="true">
<exec executable="${path.ecs.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="check"/>
</exec>
</target>
<target name="ecs-fix" description="Checks and fixes automatically fixable coding standards in all files by PHP easy coding standards." depends="entities-dump" hidden="true">
<exec executable="${path.ecs.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="check"/>
<arg value="--clear-cache"/>
<arg value="--fix"/>
</exec>
</target>
<target name="ecs-fix-diff" description="Checks and fixes automatically fixable coding standards in changed files by PHP easy coding standards." depends="entities-dump" hidden="true">
<exec executable="${path.ecs.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="check"/>
<arg value="--fix"/>
</exec>
</target>
<target name="elasticsearch-export" description="Exports indexes data into elasticsearch. Creates or migrates elasticsearch structure when necessary.">
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:elasticsearch:data-export"/>
<arg value="${elasticsearch.index}"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="elasticsearch-export-changed" description="Exports only changed indexes data into elasticsearch.">
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:elasticsearch:changed-data-export"/>
<arg value="${elasticsearch.index}"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="elasticsearch-index-create" description="Creates indexes into elasticsearch." hidden="true">
<echo level="warning" message="Phing target elasticsearch-index-create is deprecated and will be removed in next major version. Use elasticsearch-index-migrate instead"/>
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:elasticsearch:indexes-create"/>
<arg value="${elasticsearch.index}"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="elasticsearch-index-delete" depends="production-protection" description="Deletes indexes from elasticsearch." hidden="true">
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:elasticsearch:indexes-delete"/>
<arg value="${elasticsearch.index}"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="elasticsearch-index-migrate" description="Creates new indexes, reindex them from old one, deletes old indexes and add alias to the new one.">
<property name="elasticsearch.index" value=""/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:elasticsearch:indexes-migrate"/>
<arg value="${elasticsearch.index}"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="elasticsearch-index-recreate" depends="production-protection, elasticsearch-index-delete, elasticsearch-index-migrate" description="Recreates indexes into elasticsearch (deletes existing indexes and creates new one)"/>
<target name="entities-dump" description="Dumps entities paths into a file." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:entities:dump"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="environment-change" depends="production-protection" description="Change application environment and install composer dev-dependencies when development environment is selected.">
<if>
<not><isset property="change.environment"/></not>
<then>
<input propertyName="change.environment" validArgs="dev, prod, test, acc" defaultValue="prod" message="Select environment you want to change to"/>
</then>
</if>
<phingcall target="maintenance-on"/>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:environment:change"/>
<arg value="${change.environment}"/>
<arg value="--verbose"/>
</exec>
<if>
<equals arg1="${change.environment}" arg2="prod"/>
<then>
<exec executable="${path.composer.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="install"/>
<arg value="--no-dev"/>
<arg value="--no-scripts"/>
</exec>
</then>
<else>
<phingcall target="composer-check"/>
<exec executable="${path.composer.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg value="install"/>
<arg value="--no-scripts"/>
</exec>
</else>
</if>
<phingcall target="clean-cache"/>
<phingcall target="maintenance-off"/>
</target>
<target name="environment-load" description="Load application environment into Phing property." hidden="true">
<if>
<not><isset property="environment"/></not>
<then>
<exec executable="${path.php.executable}" outputProperty="environment">
<arg value="${path.app}/getEnvironment.php"/>
</exec>
<property name="environment" value="${environment}"/>
<echo>Current environment: ${environment}</echo>
</then>
</if>
</target>
<target name="error-pages-generate" depends="prod-warmup,redis-check" 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"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="eslint-check" description="Find JS coding standard violations in all files using ESLint and print human readable output." hidden="true">
<exec executable="${path.eslint.executable}" passthru="true" checkreturn="true">
<arg value="--color"/>
<arg path="${path.assets}"/>
<arg value="--config"/>
<arg path="${path.root}/.eslintrc.json"/>
<arg value="--ignore-path"/>
<arg path="${path.root}/.eslintignore"/>
</exec>
</target>
<target name="eslint-check-diff" depends="diff-files" description="Find JS coding standard violations in changed files using ESLint and print human readable output." hidden="true">
<if>
<not>
<equals arg1="${diff.files.js.spaces}" arg2="" trim="true"/>
</not>
<then>
<exec executable="${path.eslint.executable}" passthru="true" checkreturn="true">
<arg value="--color"/>
<arg line="${diff.files.js.spaces}"/>
<arg value="--config"/>
<arg path="${path.root}/.eslintrc.json"/>
<arg value="--ignore-path"/>
<arg path="${path.root}/.eslintignore"/>
</exec>
</then>
</if>
</target>
<target name="eslint-fix" description="Fix JS coding standard violations in all files using ESLint." hidden="true">
<exec executable="${path.eslint.executable}" passthru="true" checkreturn="true">
<arg value="--color"/>
<arg value="--fix"/>
<arg path="${path.assets}"/>
<arg value="--config"/>
<arg path="${path.root}/.eslintrc.json"/>
<arg value="--ignore-path"/>
<arg path="${path.root}/.eslintignore"/>
</exec>
</target>
<target name="eslint-fix-diff" depends="diff-files" description="Fix JS coding standard violations in changed files using ESLint." hidden="true">
<if>
<not>
<equals arg1="${diff.files.js.spaces}" arg2="" trim="true"/>
</not>
<then>
<exec executable="${path.eslint.executable}" passthru="true" checkreturn="true">
<arg value="--color"/>
<arg value="--fix"/>
<arg line="${diff.files.js.spaces}"/>
<arg value="--config"/>
<arg path="${path.root}/.eslintrc.json"/>
<arg value="--ignore-path"/>
<arg path="${path.root}/.eslintignore"/>
</exec>
</then>
</if>
</target>
<target name="friendly-url-entity-mapping-check" description="Checks completeness of entity mapping by route name">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:friendly-urls:check-entity-mapping"/>
</exec>
</target>
<target name="friendly-urls-generate" 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"/>
<arg value="--verbose"/>
</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.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="deploy:maintenance"/>
<arg value="disable"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="maintenance-on" description="Turns the maintenance page on.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="deploy:maintenance"/>
<arg value="enable"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="markdown-check" description="Check format of all markdown files" hidden="true">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="prettier-check"/>
<arg path="${path.root}/*.md"/>
<arg path="${path.root}/docs/**/*.md"/>
</exec>
</target>
<target name="markdown-fix" description="Reformat all markdown files" hidden="true">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="prettier-fix"/>
<arg path="${path.root}/*.md"/>
<arg path="${path.root}/docs/**/*.md"/>
</exec>
</target>
<target name="migrate-images-for-proxy" description="Remove all the folders with the generated image sizes, move images from the 'original' folders one level up." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:images:migrate"/>
</exec>
</target>
<target name="migrate-uploaded-files" description="Move all uploaded files from subdirectories to the top level directory." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:uploaded-files:migrate"/>
</exec>
</target>
<target name="migrate-uploaded-files-force" description="Force move (without check) all uploaded files from subdirectories to the top level directory." hidden="true">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:uploaded-files:migrate"/>
<arg value="--force"/>
</exec>
</target>
<target name="npm" description="Build node modules.">
<phingcall target="npm-install-dependencies"/>
<phingcall target="npm-export-translations"/>
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="copy-assets"/>
</exec>
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="build"/>
</exec>
</target>
<target name="npm-dev" description="Compile assets for development (without minification and with generated source maps).">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="dev"/>
</exec>
</target>
<target name="npm-export-translations" description="Exported used translations for javascripts." hidden="true">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="trans"/>
<arg value="--"/>
<arg value="source-dir=${path.assets}/**/*.js"/>
<arg value="source-dir=${path.framework.assets}/js/**/*.js"/>
<arg value="translations-dir=${path.root}/translations/*.po"/>
<arg value="translations-dir=${path.framework}/src/Resources/translations/*.po"/>
</exec>
</target>
<target name="npm-install-dependencies" description="Installs node modules dependencies." hidden="true">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="install"/>
</exec>
</target>
<target name="npm-prod" description="Compile assets for production.">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="build"/>
</exec>
</target>
<target name="npm-translations-dump" description="Dumped translations from javascript's files." hidden="true">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="trans:dump"/>
<arg value="--"/>
<arg value="source-dir=${path.assets}/**/*.js"/>
<arg value="export-dir=${path.var}/translations/projectBase/"/>
</exec>
</target>
<target name="npm-watch" description="Recompile assets automatically when files change.">
<exec executable="${path.npm.executable}" dir="${path.root}" logoutput="true" passthru="true" checkreturn="true">
<arg value="run"/>
<arg value="watch"/>
</exec>
</target>
<target name="phplint" description="Checks syntax of PHP files." hidden="true">
<exec executable="${path.phplint.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg path="${path.app}"/>
<arg path="${path.src}"/>
<arg path="${path.tests}"/>
</exec>
</target>
<target name="phplint-diff" depends="diff-files" description="Checks syntax of changed PHP files." hidden="true">
<if>
<not>
<equals arg1="${diff.files.php.spaces}" arg2="" trim="true"/>
</not>
<then>
<exec executable="${path.phplint.executable}" logoutput="true" passthru="true" checkreturn="true">
<arg line="${diff.files.php.spaces}"/>
</exec>
</then>
</if>
</target>
<target name="phpstan" depends="warmup,tests-acceptance-build" description="Performs static analysis of PHP files using PHPStan." hidden="true">
<exec executable="${path.phpstan.executable}" logoutput="true" passthru="true" checkreturn="true">