2016-08-17 09:34:40 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-11-26 17:47:33 +03:00
|
|
|
COMPOSER_COMMAND="php composer.phar"
|
|
|
|
|
|
|
|
if [ -e "composer.phar" ]
|
2016-08-17 09:34:40 +03:00
|
|
|
then
|
2020-11-26 17:47:33 +03:00
|
|
|
echo "Composer found: checking for update"
|
|
|
|
$COMPOSER_COMMAND self-update
|
2016-08-17 09:34:40 +03:00
|
|
|
else
|
2020-11-26 17:47:33 +03:00
|
|
|
echo "Composer not found: fetching"
|
|
|
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
|
|
|
php composer-setup.php
|
|
|
|
php -r "unlink('composer-setup.php');"
|
2016-08-17 09:34:40 +03:00
|
|
|
fi
|
|
|
|
|
2017-01-05 13:01:59 +03:00
|
|
|
|
2016-08-17 09:34:40 +03:00
|
|
|
REPODIR=`git rev-parse --show-toplevel`
|
|
|
|
|
2017-10-17 22:55:06 +03:00
|
|
|
#Redump the main autoloader
|
2016-08-17 09:34:40 +03:00
|
|
|
echo
|
2017-10-17 22:55:06 +03:00
|
|
|
echo "Regenerating main autoloader"
|
2017-01-05 13:01:59 +03:00
|
|
|
$COMPOSER_COMMAND dump-autoload -d $REPODIR
|
2016-08-17 09:34:40 +03:00
|
|
|
|
2017-10-17 22:55:06 +03:00
|
|
|
for app in ${REPODIR}/apps/*; do
|
|
|
|
if [[ -d $app ]]; then
|
|
|
|
if [[ -e ${app}/composer/composer.json ]]; then
|
|
|
|
echo
|
|
|
|
echo "Regenerating autoloader for ${app}"
|
|
|
|
$COMPOSER_COMMAND dump-autoload -d ${app}/composer
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2016-08-17 09:34:40 +03:00
|
|
|
files=`git diff --name-only`
|
|
|
|
composerfile=false
|
|
|
|
for file in $files
|
|
|
|
do
|
2017-10-17 22:55:06 +03:00
|
|
|
if [[ $file == *autoload_classmap* ]]
|
2016-08-17 09:34:40 +03:00
|
|
|
then
|
|
|
|
composerfile=true
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-12-02 17:02:56 +03:00
|
|
|
rm composer.phar
|
|
|
|
|
2016-08-17 09:34:40 +03:00
|
|
|
echo
|
|
|
|
if [ $composerfile = true ]
|
|
|
|
then
|
2017-10-17 22:55:06 +03:00
|
|
|
echo "The autoloaders are not up to date"
|
2016-08-17 09:34:40 +03:00
|
|
|
echo "Please run: bash build/autoloaderchecker.sh"
|
|
|
|
echo "And commit the result"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Autoloader up to date. Carry on"
|
|
|
|
exit 0
|
|
|
|
fi
|