Skip to content
Permalink
Browse files

Merge pull request #14489 from phalcon/4.0.x

v4.0.0-rc.2
  • Loading branch information...
sergeyklay committed Oct 26, 2019
2 parents 7621847 + 26e4ebc commit 95484a06ff9f1f4624b83761aba4d9222026788f
Showing 765 changed files with 70,849 additions and 96,302 deletions.
@@ -0,0 +1,116 @@
#!/bin/bash
#
# This file is part of the Phalcon Framework.
#
# (c) Phalcon Team <team@phalcon.io>
#
# For the full copyright and license information, please view the
# LICENSE.txt file that was distributed with this source code.

set -e

: "${CC:=gcc}"

BASE_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )"
EXT_DIR=ext/phalcon
LANGS=(mvc/model/query mvc/view/engine/volt annotations)

function cleanup() {
find . \( -name '*.o' -o -name '*.lo' -o -name '*.loT' \) -exec rm -f {} +
find . \( -name lemon -o -name parser.c -o -name lempar.c \) -exec rm -f {} +
find . \( -name scanner.c -o -name parser.c \) -exec rm -f {} +
find . -name .libs -exec rm -rf {} +
}

function compile_lemon() {
"$CC" -g "$BASE_PATH/3rdparty/lemon/lemon.c" -o "$BASE_PATH/.ci/lemon"
chmod +x "$BASE_PATH/.ci/lemon"
}

function replace() {
local re="$1"
local file="$2"

sed "$re" "$file" > xx && mv -f xx "$file"
}

function generate_lexer() {
local uprefix="$1"
local lprefix="$2"

if [ -z "$(command -v re2c 2>/dev/null || true)" ]
then
(>&2 echo "No re2c found in the \$PATH.")
(>&2 echo "Consider install re2c or/and add re2c executable to the \$PATH.")
exit 1
fi

RE2C_VER="$(re2c --vernum 2>/dev/null)"

if [ "$RE2C_VER" -gt "9999" ]
then
re2c -W --no-debug-info --no-generation-date -o scanner.c scanner.re
else
re2c --no-debug-info --no-generation-date -o scanner.c scanner.re
fi

replace "s/YY/$uprefix/g" scanner.c
replace "s/yy/$lprefix/g" scanner.c
}

function generate_parser() {
local uprefix="$1"
local lprefix="$2"
local tprefix="$3"

cp "$BASE_PATH/3rdparty/lemon/lempar.c" .
"$BASE_PATH/.ci/lemon" -s parser.php7.lemon

echo '#include "php_phalcon.h"' > parser.c
cat parser.php7.c >> parser.c
cat base.c >> parser.c

replace 's|#line|//|g' parser.c
replace "s/define TOKEN/define ${tprefix}TOKEN/g" parser.c
replace "s/YY/$uprefix/g" parser.c
replace "s/yy/$lprefix/g" parser.c

rm -f lempar.c
}

for lang in "${LANGS[@]}"
do
pushd "$BASE_PATH/$EXT_DIR/$lang" > /dev/null 2>&1 || exit 1
(>&1 printf "Regenerate language for: %s\\n" "$EXT_DIR/$lang")

cleanup
compile_lemon

case "$lang" in
"mvc/model/query")
UPREFIX="PP"
LPREFIX="pp"
TPREFIX="PP"
;;
"mvc/view/engine/volt")
UPREFIX="VV"
LPREFIX="vv"
TPREFIX="V"
;;
"annotations")
UPREFIX="AA"
LPREFIX="aa"
TPREFIX="A"
;;
*)
(>&2 echo "Usupported language: $lang")
exit 1
;;
esac

generate_lexer "$UPREFIX" "$LPREFIX"
generate_parser "$UPREFIX" "$LPREFIX" "$TPREFIX"

(>&1 printf "Done\\n\\n")
popd > /dev/null 2>&1 || exit 1
done
@@ -32,7 +32,7 @@ then
chmod +x "$HOME/bin/zephir"
else
git clone -b "$ZEPHIR_VERSION" --depth 1 -q https://github.com/phalcon/zephir
cd zephir || exit
composer install "$DEFAULT_COMPOSER_FLAGS"
cd zephir || exit 1
eval "composer install $DEFAULT_COMPOSER_FLAGS"
ln -s "$(pwd)/zephir" "$HOME/bin/zephir"
fi
@@ -41,7 +41,7 @@ ext/run-tests.php
*.phc
*.dSYM
*.deps
lemon
.ci/lemon

.libs/
autom4te.cache/
@@ -50,7 +50,10 @@ autom4te.cache/

.zephir/
.temp/

# Zephir compiler
zephir.phar
zephir-*.phar

boxfile.yml
composer.lock
@@ -22,6 +22,7 @@ matrix:
fast_finish: true
allow_failures:
- php: '7.4snapshot'
- env: ZEPHIR_VERSION="development"

cache:
timeout: 604800
@@ -38,11 +39,12 @@ services:
env:
global:
- CC="gcc"
- ZEPHIR_VERSION="0.12.4"
- ZEPHIR_PARSER_VERSION="v1.3.1"
- ZEPHIR_VERSION="0.12.10"
- ZEPHIR_PARSER_VERSION="v1.3.2"
- REPORT_COVERAGE=1
- PATH="${HOME}/.composer/vendor/bin:${PATH}"
- TRAVIS_COMMIT_LOG="$(git log --format=fuller -5)"
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest"

before_install:
- |
@@ -58,12 +60,10 @@ before_install:
[ -d ~/bin ] || mkdir ~/bin
export PHP_PEAR_PHP_BIN="$(phpenv which php)"
DEFAULT_COMPOSER_FLAGS=("--no-interaction" "--no-ansi" "--no-progress" "--no-suggest")
if [ "$(php-config --vernum)" -ge "70400" ]
then
DEFAULT_COMPOSER_FLAGS+=("--ignore-platform-reqs")
export DEFAULT_COMPOSER_FLAGS="$DEFAULT_COMPOSER_FLAGS --ignore-platform-reqs"
fi
export DEFAULT_COMPOSER_FLAGS
# Hide "You are in 'detached HEAD' state" message
git config --global advice.detachedHead false
@@ -74,34 +74,34 @@ install:
- .ci/setup-dbs.sh
- .ci/install-zephir.sh
- .ci/install-php-extensions.sh
- travis_retry composer install ${DEFAULT_COMPOSER_FLAGS[*]}
- eval "composer install $DEFAULT_COMPOSER_FLAGS"

before_script:
- |
# Setting up Travis' PHP
cat .ci/travis.ini >> "$(phpenv prefix)/etc/conf.d/travis.ini"
if [ "$(php-config --vernum)" -ge "70400" ]
then
export REPORT_COVERAGE=0
fi
- cat .ci/travis.ini >> "$(phpenv prefix)/etc/conf.d/travis.ini"
- 'if [ "$(php-config --vernum)" -ge "70400" ]; then export REPORT_COVERAGE=0; fi'
- .ci/genparsers.sh
- .ci/build.sh
- zephir --version

script:
- vendor/bin/codecept build --quiet
- vendor/bin/codecept run --ext DotReporter tests/cli/
- vendor/bin/codecept run --ext DotReporter tests/integration/
- vendor/bin/codecept run --ext DotReporter tests/unit/

- .ci/run-volt-tests.sh
- tests/run-syntax-tests.sh

jobs:
include:
- stage: Development Zephir version
php: '7.3'
env: ZEPHIR_VERSION="development"
- stage: Static Code Analysis
php: '7.2'
env:
- REPORT_COVERAGE=0
install:
- travis_retry composer install ${DEFAULT_COMPOSER_FLAGS[*]} --ignore-platform-reqs
- eval "composer install $DEFAULT_COMPOSER_FLAGS --ignore-platform-reqs"
before_script:
- phpenv config-rm xdebug.ini || true
script:

0 comments on commit 95484a0

Please sign in to comment.
You can’t perform that action at this time.