From 76eed2eba0f1d7faae83b8f544f263eece3e7e5b Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 14 Jun 2023 10:17:00 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B06098=20updateLicenses=20script=20:=20che?= =?UTF-8?q?ck=20availability=20of=20the=20required=20JQ=20command=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This packaging script requires both bash and the JQ command when running on Windows. If the later isn't available, it will run without throwing an error... With this change the script will now check directly at launch for the JQ command availability, and exit in error if it isn't. --- .make/license/updateLicenses.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.make/license/updateLicenses.php b/.make/license/updateLicenses.php index 7531aa003..a4aa0be03 100644 --- a/.make/license/updateLicenses.php +++ b/.make/license/updateLicenses.php @@ -19,17 +19,24 @@ * The target license file path is in `$xmlFilePath` */ -$iTopFolder = __DIR__ . "/../../" ; -$xmlFilePath = $iTopFolder . "setup/licenses/community-licenses.xml"; +$iTopFolder = __DIR__."/../../"; +$xmlFilePath = $iTopFolder."setup/licenses/community-licenses.xml"; -function get_scope($product_node) -{ +$jqExec = shell_exec("jq -V"); // a param is mandatory otherwise the script will freeze +if ((null === $jqExec) || (false === $jqExec)) { + echo "/!\ JQ is required but cannot be launched :( \n"; + echo "Check this script PHPDoc block for instructions\n"; + die(-1); +} + + +function get_scope($product_node) { $scope = $product_node->getAttribute("scope"); - if ($scope === "") - { //put iTop first + if ($scope === "") { //put iTop first return "aaaaaaaaa"; } + return $scope; }