@@ -41,6 +41,7 @@ function usage(string $command)
4141 echo PHP_TAB . PHP_TAB . '--include-bzip2: ' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.bz2 packages ' . PHP_EOL ;
4242 echo PHP_TAB . PHP_TAB . '--exclude-zstd: ' . PHP_TAB . PHP_TAB . PHP_TAB . 'Include the generation of .tar.zst packages ' . PHP_EOL ;
4343 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 ;
4445 echo PHP_TAB . PHP_TAB . '--help: ' . PHP_TAB . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output ' . PHP_EOL ;
4546 echo PHP_EOL ;
4647}
@@ -236,9 +237,10 @@ function clean_composer(string $dir)
236237$ fullpath = $ tmp . '/ ' . $ time ;
237238
238239// 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 ' ]);
240241
241242$ remote = $ options ['remote ' ] ?? false ;
243+ $ debugBuild = isset ($ options ['debug-build ' ]);
242244$ excludeZip = isset ($ options ['exclude-zip ' ]);
243245$ excludeGzip = isset ($ options ['exclude-gzip ' ]);
244246$ excludeBzip2 = !isset ($ options ['include-bzip2 ' ]);
@@ -265,6 +267,12 @@ function clean_composer(string $dir)
265267 $ includeExtraTextfiles = true ;
266268}
267269
270+ $ composerOptions = ' ' ;
271+ if (!$ debugBuild ) {
272+ $ composerOptions .= '--no-dev ' ;
273+ }
274+
275+
268276echo "Start build for remote $ remote. \n" ;
269277echo "Delete old release folder. \n" ;
270278system ('rm -rf ' . $ tmp );
@@ -277,7 +285,7 @@ function clean_composer(string $dir)
277285system ('cp build/fido.jwt ' . $ fullpath . '/plugins/system/webauthn/fido.jwt ' );
278286// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
279287chdir ($ fullpath );
280- system ('composer install --no-dev --no- autoloader --ignore-platform-reqs ' , $ composerReturnCode );
288+ system ('composer install --no-autoloader --ignore-platform-reqs ' . $ composerOptions , $ composerReturnCode );
281289
282290if ($ composerReturnCode !== 0 ) {
283291 echo "`composer install` did not complete as expected. \n" ;
@@ -318,16 +326,22 @@ function clean_composer(string $dir)
318326}
319327
320328// Clean the checkout of extra resources
321- clean_checkout ($ fullpath );
329+ if (!$ debugBuild ) {
330+ clean_checkout ($ fullpath );
331+ }
322332
323333// Regenerate the Composer autoloader without deleted files
324- system ('composer dump-autoload --no-dev -- optimize --no-scripts ' );
334+ system ('composer dump-autoload --optimize --no-scripts ' . $ composerOptions );
325335
326336// Clean the Composer manifests now
327- clean_composer ($ fullpath );
337+ if (!$ debugBuild ) {
338+ clean_composer ($ fullpath );
339+ }
328340
329341// And cleanup the Node installation
330- system ('rm -rf node_modules ' );
342+ if (!$ debugBuild ) {
343+ system ('rm -rf node_modules ' );
344+ }
331345
332346echo "Workspace built. \n" ;
333347
@@ -449,11 +463,17 @@ function clean_composer(string $dir)
449463// For the packages, replace spaces in stability (RC) with underscores
450464$ packageStability = str_replace (' ' , '_ ' , Version::DEV_STATUS );
451465
466+ if ($ debugBuild ) {
467+ $ packageStability .= '-Debug ' ;
468+ }
469+
452470// Delete the files and folders we exclude from the packages (tests, docs, build, etc.).
453471echo "Delete folders not included in packages. \n" ;
454472
455- foreach ($ doNotPackage as $ removeFile ) {
456- system ('rm -rf ' . $ time . '/ ' . $ removeFile );
473+ if (!$ debugBuild ) {
474+ foreach ($ doNotPackage as $ removeFile ) {
475+ system ('rm -rf ' . $ time . '/ ' . $ removeFile );
476+ }
457477}
458478
459479// Count down starting with the latest release and add diff files to this array
@@ -498,7 +518,8 @@ function clean_composer(string $dir)
498518 $ dirtyHackForMediaCheck = \in_array ('administrator/components/com_media/resources ' , $ fullPath );
499519 }
500520
501- if ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder ) {
521+
522+ if (!$ debugBuild && ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder )) {
502523 continue ;
503524 }
504525
@@ -619,45 +640,47 @@ function clean_composer(string $dir)
619640}
620641
621642// 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 ' );
643+ if (!$ debugBuild ) {
644+ echo "Build full update package. \n" ;
645+ system ('rm -r administrator/logs ' );
646+ system ('rm -r installation ' );
647+ system ('rm -r images/banners ' );
648+ system ('rm -r images/headers ' );
649+ system ('rm -r images/sampledata ' );
650+ system ('rm images/joomla_black.png ' );
651+ system ('rm images/powered_by.png ' );
630652
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- }
653+ if (!$ excludeZip ) {
654+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.zip ' ;
655+ echo "Building " . $ packageName . "... " ;
656+ system ('zip -r ../packages/ ' . $ packageName . ' * > /dev/null ' );
657+ echo "done. \n" ;
658+ $ checksums [$ packageName ] = [];
659+ }
638660
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- }
661+ if (!$ excludeGzip ) {
662+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.gz ' ;
663+ echo "Building " . $ packageName . "... " ;
664+ system ('tar --create --gzip --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
665+ echo "done. \n" ;
666+ $ checksums [$ packageName ] = [];
667+ }
646668
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- }
669+ if (!$ excludeBzip2 ) {
670+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.bz2 ' ;
671+ echo "Building " . $ packageName . "... " ;
672+ system ('tar --create --bzip2 --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
673+ echo "done. \n" ;
674+ $ checksums [$ packageName ] = [];
675+ }
654676
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 ] = [];
677+ if (!$ excludeZstd ) {
678+ $ packageName = 'Joomla_ ' . $ fullVersion . '- ' . $ packageStability . '-Update_Package.tar.zst ' ;
679+ echo "Building " . $ packageName . "... " ;
680+ system ('tar "-I zstd --ultra -22" --create --file ../packages/ ' . $ packageName . ' * > /dev/null ' );
681+ echo "done. \n" ;
682+ $ checksums [$ packageName ] = [];
683+ }
661684}
662685
663686chdir ('.. ' );
0 commit comments