Skip to content

Commit 6a823c2

Browse files
authored
[5.3] Add debug mode to build script and create nightly debug builds (#44576)
* Add support for building development packages * Rename dev-build to debug-build, remove update package * Add drone nightly build, Add Debug to file name
1 parent 9800738 commit 6a823c2

File tree

2 files changed

+70
-45
lines changed

2 files changed

+70
-45
lines changed

.drone.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ steps:
384384
- git rev-parse origin/$MINORVERSION-dev > transfer/$MINORVERSION.txt
385385
- php build/build.php --remote=origin/$MINORVERSION-dev --exclude-gzip --disable-patch-packages
386386
- mv build/tmp/packages/* transfer/
387+
- php build/build.php --remote=origin/$MINORVERSION-dev --exclude-zip --exclude-bzip2 --debug-build
388+
- mv build/tmp/packages/* transfer/
387389

388390
- name: upload
389391
image: joomlaprojects/docker-images:packager
@@ -431,6 +433,6 @@ trigger:
431433

432434
---
433435
kind: signature
434-
hmac: 8587cef2227502ec33fa0434dadf0a3178d6fa7cbbfbe4e962b3c8784c3a2c6f
436+
hmac: 8cfd796801cb7d0484c3b022f17dc6663109432397f6997650aeb0976c36a788
435437

436438
...

build/build.php

Lines changed: 67 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
268276
echo "Start build for remote $remote.\n";
269277
echo "Delete old release folder.\n";
270278
system('rm -rf ' . $tmp);
@@ -277,7 +285,7 @@ function clean_composer(string $dir)
277285
system('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
279287
chdir($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

282290
if ($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

332346
echo "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.).
453471
echo "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

663686
chdir('..');

0 commit comments

Comments
 (0)