From 27bbbdf7a3fa93214a2fb6127d9bc039621501d5 Mon Sep 17 00:00:00 2001 From: Bec White Date: Thu, 10 Mar 2022 18:00:10 -0600 Subject: [PATCH 1/4] Fix shell script installer, since Composer 2.2 proxies scripts in the vendor/bin/ directory differently. --- bin/the-build-installer | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/bin/the-build-installer b/bin/the-build-installer index fc965f9d..0a6ae334 100755 --- a/bin/the-build-installer +++ b/bin/the-build-installer @@ -1,20 +1,10 @@ #!/bin/sh # # Wrapper for our install command; at least this way it's somewhat discoverable. -# Previously: +# +# Essentially, this runs: # vendor/bin/phing -f vendor/palantirnet/the-build/targets/install.xml +# +# This script assumes that the composer bin dir is at vendor/bin/. -# Relative path to this script. -SCRIPT=$(readlink "$0") - -# Absolute path to this script's parent directory. -SCRIPTPATH=$(cd `dirname $0` && cd `dirname $SCRIPT` && pwd) - -REPOPATH=$(cd `dirname $SCRIPTPATH` && cd ../../../ && pwd) - -if [ "$REPOPATH" = `pwd` ]; then - # Run our install task. - $SCRIPTPATH/../../../bin/phing -f $SCRIPTPATH/../targets/install.xml -else - echo "Please run this command from your project root." -fi +(cd $COMPOSER_BIN_DIR/../../ && $COMPOSER_BIN_DIR/phing -f $COMPOSER_BIN_DIR/../palantirnet/the-build/targets/install.xml) From f6d2bd615a5983f3b88af1f097992ae19df53eb1 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 11 Mar 2022 18:12:19 -0600 Subject: [PATCH 2/4] Composer changed the name of an environment variable between 2.2.6 and 2.2.7 --- bin/the-build-installer | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/the-build-installer b/bin/the-build-installer index 0a6ae334..04afa1f8 100755 --- a/bin/the-build-installer +++ b/bin/the-build-installer @@ -2,9 +2,23 @@ # # Wrapper for our install command; at least this way it's somewhat discoverable. # -# Essentially, this runs: +# The install command boils down to: # vendor/bin/phing -f vendor/palantirnet/the-build/targets/install.xml # -# This script assumes that the composer bin dir is at vendor/bin/. +# This script is "weird", because: +# * Script proxying was added in Composer 2.2.0 +# * The environment variable COMPOSER_BIN_DIR was added in Composer 2.2.2 +# * The environment variable was changed to COMPOSER_RUNTIME_BIN_DIR in Composer 2.2.7 +# * This script assumes the composer bin dir is at vendor/bin/ -(cd $COMPOSER_BIN_DIR/../../ && $COMPOSER_BIN_DIR/phing -f $COMPOSER_BIN_DIR/../palantirnet/the-build/targets/install.xml) +# Composer 2.2.2 through 2.2.6 +if [ "$COMPOSER_BIN_DIR" != "" ]; then + COMPOSER_RUNTIME_BIN_DIR="$COMPOSER_BIN_DIR" +fi + +if [ "$COMPOSER_RUNTIME_BIN_DIR" = "" ]; then + echo "Please update to at least Composer version 2.2.2" + exit 1 +fi + +(cd $COMPOSER_RUNTIME_BIN_DIR/../../ && $COMPOSER_RUNTIME_BIN_DIR/phing -f $COMPOSER_RUNTIME_BIN_DIR/../palantirnet/the-build/targets/install.xml) From ee073a79aa07a8cf996427dfc3649267743a1fb2 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 11 Mar 2022 18:16:48 -0600 Subject: [PATCH 3/4] Update composer on CircleCI. --- .circleci/config.yml | 4 ++++ defaults/install/.circleci/config.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 14d3bd8a..f4b730db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,10 @@ jobs: name: Configure PHP command: | echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini" + - run: + name: Update Composer + command: | + sudo composer self-update - run: name: Create artifacts directory command: mkdir /tmp/artifacts diff --git a/defaults/install/.circleci/config.yml b/defaults/install/.circleci/config.yml index b1cda175..f1c50485 100644 --- a/defaults/install/.circleci/config.yml +++ b/defaults/install/.circleci/config.yml @@ -39,6 +39,10 @@ jobs: name: Configure PHP command: | echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini" + - run: + name: Update Composer + command: | + sudo composer self-update - run: name: Create artifacts directory command: mkdir /tmp/artifacts From 4abdde6f16c7966d5e40c620c3951b17518a1317 Mon Sep 17 00:00:00 2001 From: Bec White Date: Thu, 17 Mar 2022 11:23:14 -0500 Subject: [PATCH 4/4] Require Composer ^2.2.2 in the composer.json file. --- README.md | 2 ++ bin/the-build-installer | 11 ++--------- composer.json | 7 ++++++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1672e826..e5564a42 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ _Note: If you are starting a new a project, you may be looking for the [drupal-s $> composer require palantirnet/the-build ``` +Composer 2.2.2 or greater is required for the-build. + ## Setting up Install the default templates and phing targets to your project: diff --git a/bin/the-build-installer b/bin/the-build-installer index 04afa1f8..928b3e22 100755 --- a/bin/the-build-installer +++ b/bin/the-build-installer @@ -5,10 +5,8 @@ # The install command boils down to: # vendor/bin/phing -f vendor/palantirnet/the-build/targets/install.xml # -# This script is "weird", because: -# * Script proxying was added in Composer 2.2.0 -# * The environment variable COMPOSER_BIN_DIR was added in Composer 2.2.2 -# * The environment variable was changed to COMPOSER_RUNTIME_BIN_DIR in Composer 2.2.7 +# * This script requires Composer 2.2.2 or greater, because of a series of script proxying +# changes between 2.1.x and 2.2.2. This requirement is enforced in composer.json. # * This script assumes the composer bin dir is at vendor/bin/ # Composer 2.2.2 through 2.2.6 @@ -16,9 +14,4 @@ if [ "$COMPOSER_BIN_DIR" != "" ]; then COMPOSER_RUNTIME_BIN_DIR="$COMPOSER_BIN_DIR" fi -if [ "$COMPOSER_RUNTIME_BIN_DIR" = "" ]; then - echo "Please update to at least Composer version 2.2.2" - exit 1 -fi - (cd $COMPOSER_RUNTIME_BIN_DIR/../../ && $COMPOSER_RUNTIME_BIN_DIR/phing -f $COMPOSER_RUNTIME_BIN_DIR/../palantirnet/the-build/targets/install.xml) diff --git a/composer.json b/composer.json index 8b0355a5..6e146a17 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "bin/the-build-installer" ], "require": { + "composer-runtime-api": "^2.2.2", "cweagans/composer-patches": "^1.7", "drupal/coder": "^8.3.6", "drush/drush": "^9 || ^10", @@ -29,7 +30,11 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "cweagans/composer-patches": true + } }, "extra": { "patches": {