Skip to content

Commit b1ff893

Browse files
driusanircmaxell
authored andcommitted
Add hack to composer-install target to include workaround for bug (#29)
* 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
1 parent 7fa33b2 commit b1ff893

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
machine: true
66
steps:
77
- checkout
8-
- run: make docker-build
8+
- run: make docker-build-clean
99
- run: make build
1010
- run: make phan
1111
- run: make test
@@ -14,4 +14,4 @@ jobs:
1414
docker login -u $DOCKER_USER -p $DOCKER_PASS
1515
docker push ircmaxell/php-compiler:16.04-dev
1616
docker push ircmaxell/php-compiler:16.04
17-
fi
17+
fi

Docker/dev/ubuntu-16.04/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN ./buildconf && \
1616
WORKDIR ../
1717

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

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

Docker/ubuntu-16.04/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ COPY ./ /compiler
44

55
WORKDIR /compiler
66

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

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

11-
CMD ["-r", "'echo \"Hello World\n\";'"]
11+
CMD ["-r", "echo \"Hello World\n\";"]

Docker/yaypatch.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- Expansion.php 2019-04-16 18:58:13.254005966 +0000
2+
+++ Expansion.php 2019-04-16 18:59:03.202020632 +0000
3+
@@ -380,6 +380,9 @@
4+
5+
$delimiters = $result->{'delimiters'};
6+
7+
+ // HACK ALERT: THIS SHOULDN'T HAPPEN AND SHOULD BE FIXED UPSTREAM
8+
+ if (!is_array($context)) $context = [$context];
9+
+
10+
// normalize associative arrays
11+
if (array_values($context) !== $context) $context = [$context];

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22

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

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

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

17+
.PHONY: docker-build-clean
18+
docker-build-clean:
19+
docker build --no-cache -t ircmaxell/php-compiler:16.04-dev Docker/dev/ubuntu-16.04
20+
docker build --no-cache -t ircmaxell/php-compiler:16.04 -f Docker/ubuntu-16.04/Dockerfile .
21+
1522
.PHONY: docker-build
1623
docker-build:
24+
1725
docker build -t ircmaxell/php-compiler:16.04-dev Docker/dev/ubuntu-16.04
1826
docker build --no-cache -t ircmaxell/php-compiler:16.04 -f Docker/ubuntu-16.04/Dockerfile .
1927

@@ -46,4 +54,4 @@ phan:
4654

4755
.PHONY: test
4856
test: rebuild-changed
49-
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php vendor/bin/phpunit
57+
docker run -v $(shell pwd):/compiler ircmaxell/php-compiler:16.04-dev php vendor/bin/phpunit

ext/types/strlen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

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

66
/*
77
* This file is part of PHP-Compiler, a PHP CFG Compiler for PHP code

0 commit comments

Comments
 (0)