4 # This script is called automatically on every `composer update`.
5 # See "post-update-cmd" in the "scripts" section of composer.json.
7 # This script will create a derived composer.json / composer.lock
8 # pair for every test scenario. Test scenarios are defined in the
9 # "scenarios" file, which should be customized to suit the needs
13 SELF_DIRNAME="`dirname -- "$0"`"
14 source ${SELF_DIRNAME}/scenarios
17 echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
19 echo ":: Update dependencies for the following scenarios:"
21 echo ":: ${SCENARIOS}"
23 echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
28 for SCENARIO in ${SCENARIOS} ; do
30 dir=dependencies/${SCENARIO}
32 # Define indirect variable names
33 stability_variable="stability_${SCENARIO}"
34 requirement_variable="requirement_${SCENARIO}"
35 platform_php_variable="platform_php_${SCENARIO}"
37 echo "### Create $dir/composer.json for ${SCENARIO} scenario"
41 # Then set our own platform php version if applicable (otherwise unset it)
42 composer -n --working-dir=$dir config platform.php "${!platform_php_variable---unset}"
44 # Temporarily set our vendor directory to 'vendor'
45 composer -n --working-dir=$dir config vendor-dir vendor
47 # Set an appropriate minimum stability for this version of Symfony
48 composer -n --working-dir=$dir config minimum-stability "${!stability_variable-stable}"
50 # Add a constraint to limit the Symfony version
51 composer -n --working-dir=$dir require --dev --no-update "${!requirement_variable}"
53 # Create the composer.lock file. Ignore the vendor directory created.
54 composer -n --working-dir=$dir update --no-scripts
56 # Set the vendor directory to its final desired location.
57 composer -n --working-dir=$dir config vendor-dir '../../vendor'
59 # The 'autoload' section specifies directory paths that are relative
60 # to the composer.json file. We will drop in some symlinks so that
61 # these paths will resolve as if the composer.json were in the root.
62 for target in $AUTOLOAD_DIRECTORIES ; do
63 ln -s -f ../../$target $dir