@@ -41,6 +41,7 @@ function usage(string $command)
41
41
echo PHP_TAB . PHP_TAB . '--include-bzip2: ' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.bz2 packages ' . PHP_EOL ;
42
42
echo PHP_TAB . PHP_TAB . '--exclude-zstd: ' . PHP_TAB . PHP_TAB . PHP_TAB . 'Include the generation of .tar.zst packages ' . PHP_EOL ;
43
43
echo PHP_TAB . PHP_TAB . '--disable-patch-packages: ' . PHP_TAB . 'Disable the generation of patch packages ' . PHP_EOL ;
44
+ echo PHP_TAB . PHP_TAB . '--debug-build: ' . PHP_TAB . 'Include development packages and build folder ' . PHP_EOL ;
44
45
echo PHP_TAB . PHP_TAB . '--help: ' . PHP_TAB . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output ' . PHP_EOL ;
45
46
echo PHP_EOL ;
46
47
}
@@ -236,9 +237,10 @@ function clean_composer(string $dir)
236
237
$ fullpath = $ tmp . '/ ' . $ time ;
237
238
238
239
// Parse input options
239
- $ options = getopt ('' , ['help ' , 'remote:: ' , 'exclude-zip ' , 'exclude-gzip ' , 'include-bzip2 ' , 'exclude-zstd ' , 'disable-patch-packages ' ]);
240
+ $ options = getopt ('' , ['help ' , 'remote:: ' , 'exclude-zip ' , 'exclude-gzip ' , 'include-bzip2 ' , 'exclude-zstd ' , 'debug-build ' , ' disable-patch-packages ' ]);
240
241
241
242
$ remote = $ options ['remote ' ] ?? false ;
243
+ $ debugBuild = isset ($ options ['debug-build ' ]);
242
244
$ excludeZip = isset ($ options ['exclude-zip ' ]);
243
245
$ excludeGzip = isset ($ options ['exclude-gzip ' ]);
244
246
$ excludeBzip2 = !isset ($ options ['include-bzip2 ' ]);
@@ -265,6 +267,11 @@ function clean_composer(string $dir)
265
267
$ includeExtraTextfiles = true ;
266
268
}
267
269
270
+ $ composerOptions = ' ' ;
271
+ if (!$ debugBuild ) {
272
+ $ composerOptions .= '--no-dev ' ;
273
+ }
274
+
268
275
echo "Start build for remote $ remote. \n" ;
269
276
echo "Delete old release folder. \n" ;
270
277
system ('rm -rf ' . $ tmp );
@@ -277,7 +284,7 @@ function clean_composer(string $dir)
277
284
system ('cp build/fido.jwt ' . $ fullpath . '/plugins/system/webauthn/fido.jwt ' );
278
285
// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
279
286
chdir ($ fullpath );
280
- system ('composer install --no-dev --no- autoloader --ignore-platform-reqs ' , $ composerReturnCode );
287
+ system ('composer install --no-autoloader --ignore-platform-reqs ' . $ composerOptions , $ composerReturnCode );
281
288
282
289
if ($ composerReturnCode !== 0 ) {
283
290
echo "`composer install` did not complete as expected. \n" ;
@@ -318,16 +325,22 @@ function clean_composer(string $dir)
318
325
}
319
326
320
327
// Clean the checkout of extra resources
321
- clean_checkout ($ fullpath );
328
+ if (!$ debugBuild ) {
329
+ clean_checkout ($ fullpath );
330
+ }
322
331
323
332
// Regenerate the Composer autoloader without deleted files
324
- system ('composer dump-autoload --no-dev -- optimize --no-scripts ' );
333
+ system ('composer dump-autoload --optimize --no-scripts ' . $ composerOptions );
325
334
326
335
// Clean the Composer manifests now
327
- clean_composer ($ fullpath );
336
+ if (!$ debugBuild ) {
337
+ clean_composer ($ fullpath );
338
+ }
328
339
329
340
// And cleanup the Node installation
330
- system ('rm -rf node_modules ' );
341
+ if (!$ debugBuild ) {
342
+ system ('rm -rf node_modules ' );
343
+ }
331
344
332
345
echo "Workspace built. \n" ;
333
346
@@ -449,11 +462,17 @@ function clean_composer(string $dir)
449
462
// For the packages, replace spaces in stability (RC) with underscores
450
463
$ packageStability = str_replace (' ' , '_ ' , Version::DEV_STATUS );
451
464
465
+ if ($ debugBuild ) {
466
+ $ packageStability .= '-Debug ' ;
467
+ }
468
+
452
469
// Delete the files and folders we exclude from the packages (tests, docs, build, etc.).
453
470
echo "Delete folders not included in packages. \n" ;
454
471
455
- foreach ($ doNotPackage as $ removeFile ) {
456
- system ('rm -rf ' . $ time . '/ ' . $ removeFile );
472
+ if (!$ debugBuild ) {
473
+ foreach ($ doNotPackage as $ removeFile ) {
474
+ system ('rm -rf ' . $ time . '/ ' . $ removeFile );
475
+ }
457
476
}
458
477
459
478
// Count down starting with the latest release and add diff files to this array
@@ -498,7 +517,8 @@ function clean_composer(string $dir)
498
517
$ dirtyHackForMediaCheck = \in_array ('administrator/components/com_media/resources ' , $ fullPath );
499
518
}
500
519
501
- if ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder ) {
520
+
521
+ if (!$ debugBuild && ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder )) {
502
522
continue ;
503
523
}
504
524
@@ -619,45 +639,47 @@ function clean_composer(string $dir)
619
639
}
620
640
621
641
// Create full update file without the default logs directory, installation folder, or sample images.
622
- echo "Build full update package. \n" ;
623
- system ('rm -r administrator/logs ' );
624
- system ('rm -r installation ' );
625
- system ('rm -r images/banners ' );
626
- system ('rm -r images/headers ' );
627
- system ('rm -r images/sampledata ' );
628
- system ('rm images/joomla_black.png ' );
629
- system ('rm images/powered_by.png ' );
642
+ if (!$ debugBuild ) {
643
+ echo "Build full update package. \n" ;
644
+ system ('rm -r administrator/logs ' );
645
+ system ('rm -r installation ' );
646
+ system ('rm -r images/banners ' );
647
+ system ('rm -r images/headers ' );
648
+ system ('rm -r images/sampledata ' );
649
+ system ('rm images/joomla_black.png ' );
650
+ system ('rm images/powered_by.png ' );
630
651
631
- if (!$ excludeZip ) {
632
- $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.zip ' ;
633
- echo "Building " . $ packageName . "... " ;
634
- system ('zip -r ../packages/ ' . $ packageName . ' * > /dev/null ' );
635
- echo "done. \n" ;
636
- $ checksums [$ packageName ] = [];
637
- }
652
+ if (!$ excludeZip ) {
653
+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.zip ' ;
654
+ echo "Building " . $ packageName . "... " ;
655
+ system ('zip -r ../packages/ ' . $ packageName . ' * > /dev/null ' );
656
+ echo "done. \n" ;
657
+ $ checksums [$ packageName ] = [];
658
+ }
638
659
639
- if (!$ excludeGzip ) {
640
- $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.gz ' ;
641
- echo "Building " . $ packageName . "... " ;
642
- system ('tar --create --gzip --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
643
- echo "done. \n" ;
644
- $ checksums [$ packageName ] = [];
645
- }
660
+ if (!$ excludeGzip ) {
661
+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.gz ' ;
662
+ echo "Building " . $ packageName . "... " ;
663
+ system ('tar --create --gzip --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
664
+ echo "done. \n" ;
665
+ $ checksums [$ packageName ] = [];
666
+ }
646
667
647
- if (!$ excludeBzip2 ) {
648
- $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.bz2 ' ;
649
- echo "Building " . $ packageName . "... " ;
650
- system ('tar --create --bzip2 --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
651
- echo "done. \n" ;
652
- $ checksums [$ packageName ] = [];
653
- }
668
+ if (!$ excludeBzip2 ) {
669
+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.bz2 ' ;
670
+ echo "Building " . $ packageName . "... " ;
671
+ system ('tar --create --bzip2 --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
672
+ echo "done. \n" ;
673
+ $ checksums [$ packageName ] = [];
674
+ }
654
675
655
- if (!$ excludeZstd ) {
656
- $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.zst ' ;
657
- echo "Building " . $ packageName . "... " ;
658
- system ('tar "-I zstd --ultra -22" --create --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
659
- echo "done. \n" ;
660
- $ checksums [$ packageName ] = [];
676
+ if (!$ excludeZstd ) {
677
+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.zst ' ;
678
+ echo "Building " . $ packageName . "... " ;
679
+ system ('tar "-I zstd --ultra -22" --create --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
680
+ echo "done. \n" ;
681
+ $ checksums [$ packageName ] = [];
682
+ }
661
683
}
662
684
663
685
chdir ('.. ' );
0 commit comments