Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ steps:
- git rev-parse origin/$MINORVERSION-dev > transfer/$MINORVERSION.txt
- php build/build.php --remote=origin/$MINORVERSION-dev --exclude-gzip --disable-patch-packages
- mv build/tmp/packages/* transfer/
- php build/build.php --remote=origin/$MINORVERSION-dev --exclude-zip --exclude-gzip --exclude-bzip2 --debug-build
- mv build/tmp/packages/* transfer/

- name: upload
image: joomlaprojects/docker-images:packager
Expand Down Expand Up @@ -430,6 +432,6 @@ trigger:

---
kind: signature
hmac: 92bc9a500addecbc0d8ea987a668bee4abeae8bbab444e7105ce134ba3ffe96b
hmac: 10ae86041b814459e0a4618a7fa2356480177af7966412cc050e9902e9384cbe

...
110 changes: 66 additions & 44 deletions build/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function usage(string $command)
echo PHP_TAB . PHP_TAB . '--include-bzip2:' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.bz2 packages' . PHP_EOL;
echo PHP_TAB . PHP_TAB . '--exclude-zstd:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Include the generation of .tar.zst packages' . PHP_EOL;
echo PHP_TAB . PHP_TAB . '--disable-patch-packages:' . PHP_TAB . 'Disable the generation of patch packages' . PHP_EOL;
echo PHP_TAB . PHP_TAB . '--debug-build:' . PHP_TAB . 'Include development packages and build folder' . PHP_EOL;
echo PHP_TAB . PHP_TAB . '--help:' . PHP_TAB . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output' . PHP_EOL;
echo PHP_EOL;
}
Expand Down Expand Up @@ -236,9 +237,10 @@ function clean_composer(string $dir)
$fullpath = $tmp . '/' . $time;

// Parse input options
$options = getopt('', ['help', 'remote::', 'exclude-zip', 'exclude-gzip', 'include-bzip2', 'exclude-zstd', 'disable-patch-packages']);
$options = getopt('', ['help', 'remote::', 'exclude-zip', 'exclude-gzip', 'include-bzip2', 'exclude-zstd', 'debug-build', 'disable-patch-packages']);

$remote = $options['remote'] ?? false;
$debugBuild = isset($options['debug-build']);
$excludeZip = isset($options['exclude-zip']);
$excludeGzip = isset($options['exclude-gzip']);
$excludeBzip2 = !isset($options['include-bzip2']);
Expand All @@ -265,6 +267,11 @@ function clean_composer(string $dir)
$includeExtraTextfiles = true;
}

$composerOptions = ' ';
if (!$debugBuild) {
$composerOptions .= '--no-dev';
}

echo "Start build for remote $remote.\n";
echo "Delete old release folder.\n";
system('rm -rf ' . $tmp);
Expand All @@ -277,7 +284,7 @@ function clean_composer(string $dir)
system('cp build/fido.jwt ' . $fullpath . '/plugins/system/webauthn/fido.jwt');
// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
chdir($fullpath);
system('composer install --no-dev --no-autoloader --ignore-platform-reqs', $composerReturnCode);
system('composer install --no-autoloader --ignore-platform-reqs' . $composerOptions, $composerReturnCode);

if ($composerReturnCode !== 0) {
echo "`composer install` did not complete as expected.\n";
Expand Down Expand Up @@ -318,16 +325,22 @@ function clean_composer(string $dir)
}

// Clean the checkout of extra resources
clean_checkout($fullpath);
if (!$debugBuild) {
clean_checkout($fullpath);
}

// Regenerate the Composer autoloader without deleted files
system('composer dump-autoload --no-dev --optimize --no-scripts');
system('composer dump-autoload --optimize --no-scripts' . $composerOptions);

// Clean the Composer manifests now
clean_composer($fullpath);
if (!$debugBuild) {
clean_composer($fullpath);
}

// And cleanup the Node installation
system('rm -rf node_modules');
if (!$debugBuild) {
system('rm -rf node_modules');
}

echo "Workspace built.\n";

Expand Down Expand Up @@ -449,11 +462,17 @@ function clean_composer(string $dir)
// For the packages, replace spaces in stability (RC) with underscores
$packageStability = str_replace(' ', '_', Version::DEV_STATUS);

if ($debugBuild) {
$packageStability .= '-Debug';
}

// Delete the files and folders we exclude from the packages (tests, docs, build, etc.).
echo "Delete folders not included in packages.\n";

foreach ($doNotPackage as $removeFile) {
system('rm -rf ' . $time . '/' . $removeFile);
if (!$debugBuild) {
foreach ($doNotPackage as $removeFile) {
system('rm -rf ' . $time . '/' . $removeFile);
}
}

// Count down starting with the latest release and add diff files to this array
Expand Down Expand Up @@ -498,7 +517,8 @@ function clean_composer(string $dir)
$dirtyHackForMediaCheck = \in_array('administrator/components/com_media/resources', $fullPath);
}

if ($dirtyHackForMediaCheck || $doNotPackageFile || $doNotPatchFile || $doNotPackageBaseFolder || $doNotPatchBaseFolder) {

if (!$debugBuild && ($dirtyHackForMediaCheck || $doNotPackageFile || $doNotPatchFile || $doNotPackageBaseFolder || $doNotPatchBaseFolder)) {
continue;
}

Expand Down Expand Up @@ -619,45 +639,47 @@ function clean_composer(string $dir)
}

// Create full update file without the default logs directory, installation folder, or sample images.
echo "Build full update package.\n";
system('rm -r administrator/logs');
system('rm -r installation');
system('rm -r images/banners');
system('rm -r images/headers');
system('rm -r images/sampledata');
system('rm images/joomla_black.png');
system('rm images/powered_by.png');
if (!$debugBuild) {
echo "Build full update package.\n";
system('rm -r administrator/logs');
system('rm -r installation');
system('rm -r images/banners');
system('rm -r images/headers');
system('rm -r images/sampledata');
system('rm images/joomla_black.png');
system('rm images/powered_by.png');

if (!$excludeZip) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip';
echo "Building " . $packageName . "... ";
system('zip -r ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}
if (!$excludeZip) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip';
echo "Building " . $packageName . "... ";
system('zip -r ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}

if (!$excludeGzip) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.gz';
echo "Building " . $packageName . "... ";
system('tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}
if (!$excludeGzip) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.gz';
echo "Building " . $packageName . "... ";
system('tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}

if (!$excludeBzip2) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2';
echo "Building " . $packageName . "... ";
system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}
if (!$excludeBzip2) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2';
echo "Building " . $packageName . "... ";
system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}

if (!$excludeZstd) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.zst';
echo "Building " . $packageName . "... ";
system('tar "-I zstd --ultra -22" --create --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
if (!$excludeZstd) {
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.zst';
echo "Building " . $packageName . "... ";
system('tar "-I zstd --ultra -22" --create --file ../packages/' . $packageName . ' * > /dev/null');
echo "done.\n";
$checksums[$packageName] = [];
}
}

chdir('..');
Expand Down