Skip to content
Draft
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
31 changes: 16 additions & 15 deletions tools/api_refs/api_refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ REDOCLY_TEMPLATE="$(pwd)/tools/api_refs/redocly.hbs"; # Absolute path to Redocly
OPENAPI_FIX="$(pwd)/tools/api_refs/openapi.php"; # A script editing and fixing few things on the dumped schema (should be temporary and fixes reported to source)

PHP_BINARY="php -d error_reporting=`php -r 'echo E_ALL & ~E_DEPRECATED;'`"; # Avoid depreciation messages from phpDocumentor/Reflection/issues/529 when using PHP 8.2 or higher
COMPOSER_BINARY='composer';
TMP_DXP_DIR=/tmp/ibexa-dxp-phpdoc; # Absolute path of the temporary directory in which Ibexa DXP will be installed and the PHP API Reference built
FORCE_DXP_INSTALL=1; # If 1, empty the temporary directory, install DXP from scratch, build, remove temporary directory; if 0, potentially reuse the DXP already installed in temporary directory, keep temporary directory for future uses.
BASE_DXP_BRANCH="${BASE_DXP_BRANCH:-}"; # Branch from and for which the Reference is built when using a dev branch as version; can be overridden by the BASE_DXP_BRANCH env var
Expand Down Expand Up @@ -63,40 +64,40 @@ cd $TMP_DXP_DIR; # /!\ Change working directory (reason why all paths must be ab
if [ 0 -eq $DXP_ALREADY_EXISTS ]; then
echo "Creating ibexa/$DXP_EDITION-skeleton:$DXP_VERSION project in ${TMP_DXP_DIR}…";
if [[ "$DXP_VERSION" == *".x-dev" ]]; then
composer create-project ibexa/website-skeleton:$DXP_VERSION . --no-interaction --ignore-platform-reqs --no-scripts --stability=dev;
$COMPOSER_BINARY create-project ibexa/website-skeleton:$DXP_VERSION . --no-interaction --ignore-platform-reqs --no-scripts --stability=dev;
if [ -n "$AUTH_JSON" ]; then
cp $AUTH_JSON ./;
fi;
composer config repositories.ibexa composer https://updates.ibexa.co;
composer config extra.symfony.endpoint "https://api.github.com/repos/ibexa/recipes-dev/contents/index.json?ref=flex/main";
composer require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts;
$COMPOSER_BINARY config repositories.ibexa composer https://updates.ibexa.co;
$COMPOSER_BINARY config extra.symfony.endpoint "https://api.github.com/repos/ibexa/recipes-dev/contents/index.json?ref=flex/main";
$COMPOSER_BINARY require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts;
elif [[ "$DXP_VERSION" == *"-rc"* ]]; then
composer create-project ibexa/website-skeleton:$DXP_VERSION . --no-interaction --ignore-platform-reqs --no-scripts --stability=rc;
$COMPOSER_BINARY create-project ibexa/website-skeleton:$DXP_VERSION . --no-interaction --ignore-platform-reqs --no-scripts --stability=rc;
if [ -n "$AUTH_JSON" ]; then
cp $AUTH_JSON ./;
fi;
composer config repositories.ibexa composer https://updates.ibexa.co;
composer require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts;
$COMPOSER_BINARY config repositories.ibexa composer https://updates.ibexa.co;
$COMPOSER_BINARY require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts;
else
composer create-project ibexa/$DXP_EDITION-skeleton:$DXP_VERSION . --no-interaction --no-install --ignore-platform-reqs --no-scripts;
$COMPOSER_BINARY create-project ibexa/$DXP_EDITION-skeleton:$DXP_VERSION . --no-interaction --no-install --ignore-platform-reqs --no-scripts;
if [ -n "$AUTH_JSON" ]; then
cp $AUTH_JSON ./;
fi;
fi;
composer install --no-interaction --ignore-platform-reqs --no-scripts;
$COMPOSER_BINARY install --no-interaction --ignore-platform-reqs --no-scripts;
fi;

if [[ "$DXP_VERSION" == *".*"* ]]; then
export COMPOSER_ROOT_VERSION=0.0.0;
DXP_VERSION=$(composer -n show ibexa/$DXP_EDITION | grep -E "^version" | cut -d 'v' -f 3);
DXP_VERSION=$($COMPOSER_BINARY -n show ibexa/$DXP_EDITION | grep -E "^version" | cut -d 'v' -f 3);
echo "Obtained version: $DXP_VERSION";
fi;

export COMPOSER_ROOT_VERSION=$DXP_VERSION;

if [ 0 -eq $DXP_ALREADY_EXISTS ]; then
for additional_package in "${DXP_ADD_ONS[@]}"; do
composer require --no-interaction --ignore-platform-reqs --no-scripts --with-all-dependencies ibexa/$additional_package:$DXP_VERSION;
$COMPOSER_BINARY require --no-interaction --ignore-platform-reqs --no-scripts --with-all-dependencies ibexa/$additional_package:$DXP_VERSION;
done;
fi;

Expand All @@ -118,7 +119,7 @@ if [ 0 -eq $DXP_ALREADY_EXISTS ]; then
package=$(echo $line | cut -d '"' -f 2);
if [[ ! "${DXP_EDITIONS[*]}" =~ "${package/ibexa\//}" ]]; then
PACKAGE_MAP="$PACKAGE_MAP\n'$package': '$edition',"
NAMESPACES=$(composer show "$package" --available --format=json | \
NAMESPACES=$($COMPOSER_BINARY show "$package" --available --format=json | \
jq -r --arg PACKAGE "$package" '"'\''\(.autoload | ."psr-4" | try to_entries[] catch empty | .key[:-1] | sub("\\\\";"\\\\\\";"g"))'\'': '\''\($PACKAGE)'\'',"')
NAMESPACE_MAP="$NAMESPACE_MAP\n$NAMESPACES"
fi;
Expand All @@ -131,7 +132,7 @@ if [ 0 -eq $DXP_ALREADY_EXISTS ]; then

echo -n 'Building namespace→edition map… ';
for package in "${DXP_ADD_ONS[@]}"; do
NAMESPACES=$(composer show "ibexa/$package" --available --format=json | \
NAMESPACES=$($COMPOSER_BINARY show "ibexa/$package" --available --format=json | \
jq -r --arg PACKAGE "ibexa/$package" '"'\''\(.autoload | ."psr-4" | try to_entries[] catch empty | .key[:-1] | sub("\\\\";"\\\\\\";"g"))'\'': '\''\($PACKAGE)'\'',"')
NAMESPACE_MAP="$NAMESPACE_MAP\n$NAMESPACES"
PACKAGE_MAP="$PACKAGE_MAP\n'ibexa/$package': 'optional',"
Expand Down Expand Up @@ -216,8 +217,8 @@ fi;

if [ 0 -eq $DXP_ALREADY_EXISTS ]; then
echo 'Set up DXP recipes…';
git init && git add . && git commit -m "Installed Ibexa Commerce" > /dev/null;
composer recipes:install ibexa/$DXP_EDITION --force --reset --no-interaction;
git init -b main && git add . && git commit -m "Installed Ibexa Commerce" > /dev/null;
$COMPOSER_BINARY recipes:install ibexa/$DXP_EDITION --force --reset --no-interaction;
fi;

echo 'Dump REST OpenAPI schema… ';
Expand Down
Loading