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

Building phar is not possible #42

Closed
cavo789 opened this issue Dec 28, 2020 · 10 comments
Closed

Building phar is not possible #42

cavo789 opened this issue Dec 28, 2020 · 10 comments

Comments

@cavo789
Copy link

cavo789 commented Dec 28, 2020

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)

php box.phar build
Building...

[RuntimeException]
failed to get contents of 'C:\temp\PHP-Parallel-Lint\parallel-lint.php'

build [-c|--configuration="..."]
  • The box.json file mention parallel-lint.php for the main key while the file didn't have the .php extension. So, I edit the file and remove the .php extension. I've thus "main": "parallel-lint", in box.json
  • I run php box.phar build once 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 5

Can 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.

@jrfnl
Copy link
Collaborator

jrfnl commented Dec 29, 2020

@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.

@grogy
Copy link
Member

grogy commented Jan 6, 2021

@jrfnl original idea, thank you. The result can look like assets on https://github.com/vrana/adminer/releases ?

@deatharse
Copy link

@cavo789 I managed to get it to work by adding a break; into parallel-lint after the line:

$loaded = true;

Then I saw the MR #39 which effectively does the same. The last version of Box I managed to build this with was with 3.5.0 using PHP7.3

@cavo789
Copy link
Author

cavo789 commented Feb 22, 2021

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.

@deatharse
Copy link

@cavo789 One thing spotted doesnt work is the colors, may be related to #40

Appears to fail the class_exists check on

if (class_exists('\JakubOnderka\PhpConsoleColor\ConsoleColor')) {

not sure how to get around that yet

@jrfnl
Copy link
Collaborator

jrfnl commented Mar 28, 2021

@grogy I think this issue can be closed now PR #46 has been merged as it includes automatically generating a phar on each build.

@roelofr
Copy link

roelofr commented Mar 28, 2021

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.

@grogy
Copy link
Member

grogy commented Apr 7, 2021

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

@roelofr
Copy link

roelofr commented Apr 30, 2021

This issue can be closed right?

@grogy
Copy link
Member

grogy commented May 5, 2021

Yes, I close it as resolved. Thank you

@grogy grogy closed this as completed May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants