Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hack to composer-install target to include workaround for bug #29

Merged
merged 3 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
machine: true
steps:
- checkout
- run: make docker-build
- run: make docker-build-clean
- run: make build
- run: make phan
- run: make test
Expand All @@ -14,4 +14,4 @@ jobs:
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push ircmaxell/php-compiler:16.04-dev
docker push ircmaxell/php-compiler:16.04
fi
fi
1 change: 1 addition & 0 deletions Docker/dev/ubuntu-16.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN ./buildconf && \
WORKDIR ../

RUN curl --silent --show-error https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer

ENV PHP="/usr/local/bin/php", PHP_7_4="/usr/local/bin/php", PHP_CS_FIXER_IGNORE_ENV="true"

Expand Down
4 changes: 2 additions & 2 deletions Docker/ubuntu-16.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ COPY ./ /compiler

WORKDIR /compiler

RUN php /composer.phar install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader
RUN composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader

ENTRYPOINT ["php", "/compiler/bin/jit.php"]

CMD ["-r", "'echo \"Hello World\n\";'"]
CMD ["-r", "echo \"Hello World\n\";"]
11 changes: 11 additions & 0 deletions Docker/yaypatch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Expansion.php 2019-04-16 18:58:13.254005966 +0000
+++ Expansion.php 2019-04-16 18:59:03.202020632 +0000
@@ -380,6 +380,9 @@

$delimiters = $result->{'delimiters'};

+ // HACK ALERT: THIS SHOULDN'T HAPPEN AND SHOULD BE FIXED UPSTREAM
+ if (!is_array($context)) $context = [$context];
Copy link

@marcioAlmada marcioAlmada Apr 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/o\ if you have a way to reproduce, please let me know so we can put it as a .phpt file at https://github.com/marcioAlmada/yay/tree/master/tests/phpt 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcioAlmada I don't have one, other than trying to compile this repo with scripts/rebuild.php. JIT.pre is one that always fails to compile for me, but I don't know what causes it to fail enough to turn it into a useful test case.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I haven't been able to reproduce. Sometimes it happens, sometimes it doesn't. Really quite random...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by random, I mean changes to macro.yay sometimes cause it, sometimes don't. I haven't found a clear pattern in order to be able to reproduce...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so it depends on what is being matched. I'll try to poke the call graph.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, but at least preprocess/pre-plugin#18 aims to fix that...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm now seeing a bunch of warnings: Warning: count(): Parameter must be an array or an object that implements Countable in /compiler/vendor/yay/yay/src/Ast.php on line 136

But it appears to be successful...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you fixed the macro? That sounds like the same warning as before when there was a problem

Copy link

@marcioAlmada marcioAlmada Apr 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fixes were done at yay/master branch too, so I guess you also have to composer update the deps. I don't know what version of yay your pre-plugin is pinning, it's probably not master.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the changes that had to be done in your macros: https://gist.github.com/marcioAlmada/6f07c9b0ef7297c9ee82f91bc2a53047

+
// normalize associative arrays
if (array_values($context) !== $context) $context = [$context];
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

.PHONY: composer-install
composer-install:
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php /composer.phar install --no-ansi --no-interaction --no-progress
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev composer install --no-ansi --no-interaction --no-progress
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php vendor/pre/plugin/source/environment.php
patch -p0 -d vendor/pre/plugin/hidden/yay/yay/src < Docker/yaypatch.patch

.PHONY: composer-update
composer-update:
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php /composer.phar update --no-ansi --no-interaction --no-progress
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev composer update --no-ansi --no-interaction --no-progress

.PHONY: shell
shell:
docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev /bin/bash

.PHONY: docker-build-clean
docker-build-clean:
docker build --no-cache -t ircmaxell/php-compiler:16.04-dev Docker/dev/ubuntu-16.04
docker build --no-cache -t ircmaxell/php-compiler:16.04 -f Docker/ubuntu-16.04/Dockerfile .

.PHONY: docker-build
docker-build:

docker build -t ircmaxell/php-compiler:16.04-dev Docker/dev/ubuntu-16.04
docker build --no-cache -t ircmaxell/php-compiler:16.04 -f Docker/ubuntu-16.04/Dockerfile .

Expand Down Expand Up @@ -46,4 +54,4 @@ phan:

.PHONY: test
test: rebuild-changed
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php vendor/bin/phpunit
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php vendor/bin/phpunit
2 changes: 1 addition & 1 deletion ext/types/strlen.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

# This file is generated, changes you make will be lost.
# Make your changes in /compiler/script/../ext/types/strlen.pre instead.
# Make your changes in /compiler/ext/types/strlen.pre instead.

/*
* This file is part of PHP-Compiler, a PHP CFG Compiler for PHP code
Expand Down