1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 22:51:11 +01:00

Fix build

This commit is contained in:
Daniil Gentili 2021-03-30 16:10:37 +02:00
parent 720ddac636
commit 6a95460c98
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
5 changed files with 60 additions and 66 deletions

View File

@ -1,7 +1,11 @@
dist: xenial
language: php
php:
- '8.0'
- '7.4'
- '7.3'
- '7.2'
- '7.1'
- '7.0'
- '5.6'

View File

@ -1,4 +1,4 @@
#!/bin/bash -e
find vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {} +
#find vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {} +

View File

@ -2,9 +2,9 @@
rm -rf vendor/danog/madelineproto/docs
sed -re 's/\?(\w*) (\$\w+)/\2 = NULL/g;s/= null = null/=null/ig;s/: self//g' -i vendor/league/uri-interfaces/src/Contracts/UriInterface.php
php $(dirname $0)/prepare-5.php
#sed -re 's/\?(\w*) (\$\w+)/\2 = NULL/g;s/= null = null/=null/ig;s/: self//g' -i vendor/league/uri-interfaces/src/Contracts/UriInterface.php
#php $(dirname $0)/prepare-5.php
sed -i 's/handleConnectionWindowIncrement[(]\$windowSize[)]/handleConnectionWindowIncrement(int $windowSize)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php
#sed -i 's/handleConnectionWindowIncrement[(]\$windowSize[)]/handleConnectionWindowIncrement(int $windowSize)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php
sed -ri 's/^\{/{ use \\MyCallableMaker;/g;s/\\Closure::fromCallable[(]\[(.+), (.+)\][)]/\1->callableFromInstanceMethod(\2)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php vendor/amphp/http-client/src/Connection/Http{2,1}Connection.php

View File

@ -31,12 +31,19 @@ cd phar7
[ "$IS_RELEASE" == "y" ] && composer=$TRAVIS_BRANCH || composer="dev-$TRAVIS_BRANCH"
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install php8.0-cli php8.0-json php8.0-mbstring php8.0-curl php8.0-xml php8.0-json -y
alias composer="php8.0 $(which composer)"
# Install
echo '{
"name": "danog/madelineprototests",
"minimum-stability":"dev",
"require": {
"danog/madelineproto": "'$composer'",
"phabel/phabel": "dev-master",
"amphp/websocket-client": "dev-master as 1.0.0-rc2",
"amphp/dns": "dev-master#eb0b0a2 as v1"
},
@ -56,41 +63,33 @@ echo '{
}
]
}' > composer.json
composer config platform.php "7.4"
composer config platform.php "8.0"
composer clearcache
composer update
composer require amphp/mysql
[ $PHP_MAJOR_VERSION -eq 5 ] && {
composer require dstuecken/php7ify
composer require symfony/polyfill-php70
composer require symfony/polyfill-php71
composer require symfony/polyfill-php72
composer require symfony/polyfill-php73
}
[ $PHP_MAJOR_VERSION -eq 7 ] && [ $PHP_MINOR_VERSION -eq 0 ] && {
composer require symfony/polyfill-php71
composer require symfony/polyfill-php72
composer require symfony/polyfill-php73
}
composer dumpautoload --optimize
cp -a $madelinePath/src vendor/danog/madelineproto
cd ..
[ $PHP_MAJOR_VERSION -eq 5 ] && {
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install php7.3-cli php7.3-json php7.3-mbstring php7.3-curl php7.3-xml php7.3-json -y
phabel() {
cd phar7
php8.0 vendor/bin/phabel ../phar5
cd ../phar5
composer dumpautoload --optimize
cd ..
}
composer global require danog/7to5
[ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5
[ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5
export PHABEL_TARGET="$PHP_MAJOR_VERSION$PHP_MINOR_VERSION"
php=$PHABEL_TARGET
[ $PHP_MAJOR_VERSION -eq 5 ] && {
cd phar7
ls
$madelinePath/tests/conversion/prepare-5.sh
cd ..
php7.3 $php7to5 convert --copy-all phar7 phar5
phabel
cd phar5
ls
@ -98,31 +97,25 @@ cd ..
cd ..
php -v
php=5
}
[ $PHP_MAJOR_VERSION -eq 7 ] && {
[ $PHP_MINOR_VERSION -eq 0 ] && {
composer global require danog/7to70
[ -f $HOME/.composer/vendor/bin/php7to70 ] && php7to70=$HOME/.composer/vendor/bin/php7to70
[ -f $HOME/.config/composer/vendor/bin/php7to70 ] && php7to70=$HOME/.config/composer/vendor/bin/php7to70
cd phar7
ls
$madelinePath/tests/conversion/prepare-70.sh
cd ..
$php7to70 convert --copy-all phar7 phar5
phabel
cd phar5
ls
$madelinePath/tests/conversion/after-70.sh
cd ..
php=70
} || {
cp -a phar7 phar5
}
cd phar5
composer dumpautoload --optimize
cd ..
}
find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
@ -186,13 +179,6 @@ ssh-add madeline_rsa
git clone git@github.com:danog/MadelineProtoPhar
cd MadelineProtoPhar
[ "$php" == "70" ] && {
while [ "$(cat release$branch)" != "$TRAVIS_COMMIT"- ]; do sleep 1; git pull; done
}
[ "$php" == "5" ] && {
while [ "$(cat release70$branch)" != "$TRAVIS_COMMIT"-70 ]; do sleep 1; git pull; done
}
cp "../madeline$php$branch.phar" .
cp ../tools/phar.php ../examples/mtproxyd .
echo -n "$TRAVIS_COMMIT-$php" > release$php$branch
@ -204,8 +190,12 @@ echo -n "$TRAVIS_COMMIT-$php" > release$php$branch
git add -A
git commit -am "Release $TRAVIS_BRANCH - $TRAVIS_COMMIT_MESSAGE"
git push origin master
while :; do
git push origin master && break || {
git fetch
git rebase origin/master
}
done
cd ..
echo "$TRAVIS_COMMIT_MESSAGE" | grep "Apply fixes from StyleCI" && exit

View File

@ -36,11 +36,11 @@ function ___install_madeline()
}
echo "**********************************************************************************$newline";
echo "**********************************************************************************$newline$newline";
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7.3$newline";
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 8.0$newline";
echo "PHP 5/7.0 USERS WILL NOT RECEIVE PHP UPDATES AND BUGFIXES: https://www.php.net/eol.php$newline";
echo "PHP 5/7.0 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline";
echo "SUPPORTED VERSIONS: PHP 7.1, 7.2, 7.3+$newline";
echo "RECOMMENDED VERSION: PHP 7.3$newline$newline";
echo "SUPPORTED VERSIONS: PHP 7.1, 7.2, 7.3, 7.4, 8.0+$newline";
echo "RECOMMENDED VERSION: PHP 8.0$newline$newline";
echo "**********************************************************************************$newline";
echo "**********************************************************************************$newline";
unset($newline);
@ -79,9 +79,9 @@ function ___install_madeline()
if (PHP_MAJOR_VERSION <= 5) {
$release_branch = '5'.$release_branch;
$release_fallback_branch = '5'.$release_fallback_branch;
} elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 4) {
$release_branch = '70'.$release_branch;
$release_fallback_branch = '70'.$release_fallback_branch;
} elseif (PHP_MAJOR_VERSION === 7) {
$release_branch = PHP_MAJOR_VERSION.PHP_MINOR_VERSION.$release_branch;
$release_fallback_branch = PHP_MAJOR_VERSION.PHP_MINOR_VERSION.$release_fallback_branch;
}
// Checking if defined branch/default branch builds can be downloaded