From 5c6c170ffc242744e5a8fed4e2cb5d8fbfbf67e2 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 18 Dec 2024 14:57:52 +0100 Subject: [PATCH] Moved ignore platform requirements from build script to composer file. * introduced option to keep lock file (to satify IDE's during development) --- composer.json | 7 +++++++ tools/build/build_php_deps.sh | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b82bb55..56ab701 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,13 @@ "dealerdirect/phpcodesniffer-composer-installer": true, "php-http/discovery": true, "tbachert/spi": true + }, + "platform": { + "ext-mysqli": "8.1", + "ext-curl": "8.1", + "ext-pdo": "8.1", + "ext-opentelemetry": "0", + "ext-otel_instrumentation": "0" } }, "scripts": { diff --git a/tools/build/build_php_deps.sh b/tools/build/build_php_deps.sh index 6189f78..8352961 100755 --- a/tools/build/build_php_deps.sh +++ b/tools/build/build_php_deps.sh @@ -1,6 +1,7 @@ #!/bin/bash SKIP_NOTICE=false +KEEP_COMPOSER=false show_help() { echo "Usage: $0 --php_versions " @@ -8,6 +9,7 @@ show_help() { echo "Arguments:" echo " --php_versions Required. List of PHP versions separated by spaces (e.g., '81 82 83 84')." echo " --skip_notice Optional. Skip notice file generator." + echo " --keep_composer Optional. Keep composer.lock file." echo echo "Example:" echo " $0 --php_versions '81 82 83 84' --skip_notice" @@ -24,6 +26,9 @@ parse_args() { --skip_notice) SKIP_NOTICE=true ;; + --keep_composer) + KEEP_COMPOSER=true + ;; --help) show_help exit 0 @@ -73,10 +78,14 @@ do apt-get update && apt-get install -y unzip git \ && git config --global --add safe.directory /sources \ && curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin \ - && composer --ignore-platform-req=ext-opentelemetry --ignore-platform-req=ext-otel_instrumentation --ignore-platform-req=php --no-dev install \ + && composer --ignore-platform-req=php --no-dev install \ ${GEN_NOTICE} \ && chmod 666 /sources/composer.lock" - rm -f composer.lock + if [ "$KEEP_COMPOSER" = true ]; then + echo "Keeping composer.lock file" + else + rm -f composer.lock + fi done