Skip to content
Snippets Groups Projects

#3480296 Cannot use Composer 1 any more

Merged Jonathan Smith requested to merge issue/gitlab_templates-3480296:3480296-d7-composer2 into main
@@ -268,31 +268,26 @@ stages:
# Get the composer version currently installed. Use space or . for delimiters to return the single digit top-level version.
- COMPOSER_VERSION=$(composer --version | awk -F'[ .]' "{print \$3}")
- |
if [ "$COMPOSER_VERSION" == "2" ]; then
if [ "$_D7_DRUPAL_COMPOSER_NEEDED" == "1" ]; then
# Revert to Composer version 1, see https://www.drupal.org/project/composer/issues/3178950
echo "Composer 2 is installed, reverting to Composer 1 because _D7_DRUPAL_COMPOSER_NEEDED=$_D7_DRUPAL_COMPOSER_NEEDED"
composer self-update --1
else
echo "Composer 2 is installed, setting allow-plugins"
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
fi
if [ "$COMPOSER_VERSION" == "1" ]; then
composer --version
echo "Composer 1 is installed but is no longer supported, updating to Composer 2. See https://www.drupal.org/project/gitlab_templates/issues/3480296"
composer self-update --2
fi
- composer --version
- composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
- composer config repositories.0 composer https://packages.drupal.org/7
# Get dependencies that will be used at a later stage.
- composer require --dev drupal/coder:^8.2@stable phpunit/phpunit symfony/filesystem drush/drush:^8.3.3
- |
if [ "$_D7_DRUPAL_COMPOSER_NEEDED" == "1" ]; then
# Bring the drupal/composer package and copy/move things around.
# Bring the drupal/composer package and move it to vendor/drush/drush/commands
composer require --dev drupal/composer:1.x-dev
mv vendor/drupal/composer vendor/drush/drush/commands/composer
# Third-party modules loaded via the projects composer.json will be in
# vendor/drupal but they need to be moved into sites/all/modules.
# The 'drupal' and 'coder' directories must not be moved.
ls $CI_PROJECT_DIR/vendor/drupal | grep -Ev '(drupal|coder)' | xargs -I {} mv -v $CI_PROJECT_DIR/vendor/drupal/{} $CI_PROJECT_DIR/$_WEB_ROOT/sites/all/modules || true
mv -v vendor/drupal/composer vendor/drush/drush/commands/composer
fi
# Third-party modules loaded via the projects composer.json will be in
# vendor/drupal but they need to be moved into sites/all/modules.
# The 'drupal' and 'coder' directories must not be moved.
- ls $CI_PROJECT_DIR/vendor/drupal | grep -Ev '(drupal|coder)' | xargs -I {} mv -v $CI_PROJECT_DIR/vendor/drupal/{} $CI_PROJECT_DIR/$_WEB_ROOT/sites/all/modules || true
# Symlink module files to a module folder so we can do a full Drupal install.
- echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/symlink_project.php"
- curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/symlink_project.php
Loading