@@ -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,11 @@ function clean_composer(string $dir)
265267 $ includeExtraTextfiles = true ;
266268}
267269
270+ $ composerOptions = ' ' ;
271+ if (!$ debugBuild ) {
272+ $ composerOptions .= '--no-dev ' ;
273+ }
274+
268275echo "Start build for remote $ remote. \n" ;
269276echo "Delete old release folder. \n" ;
270277system ('rm -rf ' . $ tmp );
@@ -277,7 +284,7 @@ function clean_composer(string $dir)
277284system ('cp build/fido.jwt ' . $ fullpath . '/plugins/system/webauthn/fido.jwt ' );
278285// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
279286chdir ($ fullpath );
280- system ('composer install --no-dev --no- autoloader --ignore-platform-reqs ' , $ composerReturnCode );
287+ system ('composer install --no-autoloader --ignore-platform-reqs ' . $ composerOptions , $ composerReturnCode );
281288
282289if ($ composerReturnCode !== 0 ) {
283290 echo "`composer install` did not complete as expected. \n" ;
@@ -318,16 +325,22 @@ function clean_composer(string $dir)
318325}
319326
320327// Clean the checkout of extra resources
321- clean_checkout ($ fullpath );
328+ if (!$ debugBuild ) {
329+ clean_checkout ($ fullpath );
330+ }
322331
323332// 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 );
325334
326335// Clean the Composer manifests now
327- clean_composer ($ fullpath );
336+ if (!$ debugBuild ) {
337+ clean_composer ($ fullpath );
338+ }
328339
329340// And cleanup the Node installation
330- system ('rm -rf node_modules ' );
341+ if (!$ debugBuild ) {
342+ system ('rm -rf node_modules ' );
343+ }
331344
332345echo "Workspace built. \n" ;
333346
@@ -449,11 +462,17 @@ function clean_composer(string $dir)
449462// For the packages, replace spaces in stability (RC) with underscores
450463$ packageStability = str_replace (' ' , '_ ' , Version::DEV_STATUS );
451464
465+ if ($ debugBuild ) {
466+ $ packageStability .= '-Debug ' ;
467+ }
468+
452469// Delete the files and folders we exclude from the packages (tests, docs, build, etc.).
453470echo "Delete folders not included in packages. \n" ;
454471
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+ }
457476}
458477
459478// Count down starting with the latest release and add diff files to this array
@@ -498,7 +517,8 @@ function clean_composer(string $dir)
498517 $ dirtyHackForMediaCheck = \in_array ('administrator/components/com_media/resources ' , $ fullPath );
499518 }
500519
501- if ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder ) {
520+
521+ if (!$ debugBuild && ($ dirtyHackForMediaCheck || $ doNotPackageFile || $ doNotPatchFile || $ doNotPackageBaseFolder || $ doNotPatchBaseFolder )) {
502522 continue ;
503523 }
504524
@@ -619,45 +639,47 @@ function clean_composer(string $dir)
619639}
620640
621641// 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 ' );
630651
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+ }
638659
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+ }
646667
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+ }
654675
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+ }
661683}
662684
663685chdir ('.. ' );
0 commit comments