Building phar is not possible
cavo789 opened this issue · 10 comments
Hello
I'm trying to build the .phar file version and I'm thus following the guide as described in your README.md file (https://github.com/php-parallel-lint/PHP-Parallel-Lint#create-phar-package)
- git clone https://github.com/php-parallel-lint/PHP-Parallel-Lin
- composer update
- Download of box is OK
- Building the phar is KO with the following message :
php box.phar build
Building...
[RuntimeException]
failed to get contents of 'C:\temp\PHP-Parallel-Lint\parallel-lint.php'
build [-c|--configuration="..."]- The
box.jsonfile mentionparallel-lint.phpfor themainkey while the file didn't have the.phpextension. So, I edit the file and remove the.phpextension. I've thus"main": "parallel-lint",inbox.json - I run
php box.phar buildonce more and now building is correct.
But, now, running php parallel-lint.phar throw an error:
PHP Fatal error: Cannot declare class ComposerAutoloaderInit8d3d5124130cbc6652f1aad8a66cf923, because the name is already in use in phar://C:/temp/PHP-Parallel-Lint/parallel-lint.phar/vendor/composer/autoload_real.php on line 5Can you take a look please ?
Note: I've also tried https://github.com/box-project/box for creating the phar but here too, it doesn't work.
@grogy Would it be an idea to do a test build of the phar in the CI run and let it upload the resulting file as an artifact ? Especially easy to do once switched to GH Actions instead of Travis.
The phar from a CI run on a tag could then be added to the tag and if people want to use the phar to test PRs and such, all they'd need to do would be to get the artifact from that build.
@jrfnl original idea, thank you. The result can look like assets on https://github.com/vrana/adminer/releases ?
Hi
That's a great news! I'm waiting for the phar to add PHP-Parallel-Lint in my GitLab CI.
I can confirm, I can create the phar too after having modified two files:
diff --git a/box.json b/box.json
index 951802d..8c6fc81 100644
--- a/box.json
+++ b/box.json
@@ -5,7 +5,7 @@
"Herrera\\Box\\Compactor\\Php"
],
"extract": false,
- "main": "parallel-lint.php",
+ "main": "parallel-lint",
"files": [
"LICENSE"
],
diff --git a/parallel-lint b/parallel-lint
index 0d77fdb..6c1a2bf 100755
--- a/parallel-lint
+++ b/parallel-lint
@@ -49,6 +49,7 @@ foreach ($autoloadLocations as $autoload) {
if (is_file($autoload)) {
require_once($autoload);
$loaded = true;
+ break;
}
}box.json needs to be modified and parallel-lint too, like you mention it.
@cavo789 One thing spotted doesnt work is the colors, may be related to #40
Appears to fail the class_exists check on
PHP-Parallel-Lint/src/Output.php
Line 391 in 287d0b4
not sure how to get around that yet
The master branch seems to be able to produce a phar file consistently, so yeah. Maybe creating a release with the updated code (and letting the actions generate the phar and add it) would be even better.
Is released new version 1.3.0 and is created PHAR https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/tag/v1.3.0
This issue can be closed right?
Yes, I close it as resolved. Thank you