Further improve build process

This commit is contained in:
Matias Griese
2021-04-27 12:37:56 +03:00
parent 9e3733bd17
commit f3a7b3941e
3 changed files with 31 additions and 51 deletions
+27 -8
View File
@@ -17,19 +17,38 @@ date_default_timezone_set('America/Denver');
chdir(__DIR__ . '/builder');
$hasVersion = false;
$isProd = true;
foreach ($argv as $arg) {
if (strpos($arg, '-Dxml.version=') === 0) {
$hasVersion = true;
break;
if (strpos($arg, '-') === 0) {
if (strpos($arg, '-Dxml.version=') === 0) {
$hasVersion = true;
}
} elseif (strpos($arg, 'dev') !== false) {
$isProd = false;
}
}
$base = dirname(__DIR__);
if (false === $hasVersion) {
$file = fopen(dirname(__DIR__) . '/CHANGELOG.md','rb');
if (preg_match('/^# (\d\.\d+.\d+(-[a-z0-9.]+)?)\s*$/i', fgets($file), $matches) !== 1) {
echo 'First line of CHANGELOG.md has wrong Gantry version format, aborting';
return 1;
if (false === $isProd && is_file("{$base}/.git/HEAD")) {
$head = preg_replace('!^ref: (\S+)\s+$!m', '\\1', file_get_contents("{$base}/.git/HEAD"));
$version = substr(is_file("{$base}/.git/{$head}") ? file_get_contents("{$base}/.git/{$head}") : '', 0, 8);
$branch = basename($head);
if ($branch !== 'develop') {
$branch .= '-dev';
}
$version = 'dev-' . $version;
$argv[] = '-Dstr.fileversion=_' . $branch;
} else {
$file = fopen("{$base}/CHANGELOG.md",'rb');
if (preg_match('/^# (\d\.\d+.\d+(-[a-z0-9.]+)?)\s*$/i', fgets($file), $matches) !== 1) {
echo 'First line of CHANGELOG.md has wrong Gantry version format, aborting';
return 1;
}
$version = $matches[1];
}
$version = $matches[1];
$argv[] = '-Dxml.version=' . $version;
}
@@ -1,16 +1,5 @@
#!/usr/bin/env php
<?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2017 RocketTheme, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
* http://opensource.org/licenses/MIT
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Gantry Framework code that extends GPL code is considered GNU/GPLv2 and later
*/
/**
* The main .po to .mo function
Vendored
+4 -32
View File
@@ -33,40 +33,12 @@
],
"library":[
{
"source":"/src/classes",
"destination":"/libraries/gantry5/classes"
"source":"/platforms/joomla/lib_gantry5",
"destination":"/libraries/gantry5"
},
{
"source":"/src/platforms",
"destination":"/libraries/gantry5/platforms"
},
{
"source":"/platforms/joomla/lib_gantry5/language",
"destination":"/libraries/gantry5/language"
},
{
"source":"/platforms/joomla/lib_gantry5/vendor",
"destination":"/libraries/gantry5/vendor"
},
{
"source":"/platforms/joomla/lib_gantry5/composer.json",
"destination":"/libraries/gantry5/composer.json"
},
{
"source":"/platforms/joomla/lib_gantry5/composer.lock",
"destination":"/libraries/gantry5/composer.lock"
},
{
"source":"/src/bootstrap.php",
"destination":"/libraries/gantry5/bootstrap.php"
},
{
"source":"/src/Loader.php",
"destination":"/libraries/gantry5/Loader.php"
},
{
"source":"/src/RealLoader.php",
"destination":"/libraries/gantry5/RealLoader.php"
"source":"/src",
"destination":"/libraries/gantry5/src"
}
],
"plugins":[