Skip to content

Commit

Permalink
Add hack to composer-install target to include workaround for bug (#29)
Browse files Browse the repository at this point in the history
* Add hack to composer-install target to include workaround for bug

This adds a hack to the composer-install target so that it includes
a workaround for the bug preventing the macros from being compiled
under Circle CI.

It also fixes an incorrect quoting in the non-dev Docker image.

* Do not used cached docker image under Circle CI

* Fix references to composer.phar
  • Loading branch information
driusan authored and ircmaxell committed Apr 16, 2019
1 parent 7fa33b2 commit b1ff893
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
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];
+
// 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

0 comments on commit b1ff893

Please sign in to comment.