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

[PHAR version] Improve build with BOX v4 by adding a manifest #173

Closed
llaville opened this issue Jan 14, 2023 · 3 comments
Closed

[PHAR version] Improve build with BOX v4 by adding a manifest #173

llaville opened this issue Jan 14, 2023 · 3 comments
Assignees

Comments

@llaville
Copy link
Collaborator

Keep compatibility between PHP 8.0 and PHP 8.1 or greater with BOX project is very hard !

BOX (v3) and now v4 (recommended) is a great tool, but it suffer of a cool missing feature (add a manifest with dependency list embedded).

Even, if I've tried it in past to include it in core of BOX project, this feature is available with my project https://github.com/llaville/box-manifest

In context of writing major version 9.0 (see #171), I think it may be a good opportunity to improve build-phar process

@overtrue Are you agree ?

Here is a preview of what we can get.

  • Run command : docker run --rm -it -u "$(id -u):$(id -g)" -v $(pwd):/usr/src ghcr.io/llaville/box-manifest:v2 compile -c /usr/src/box.json
  • And get following output :

    ____
   / __ )____  _  __
  / __  / __ \| |/_/
 / /_/ / /_/ />  <
/_____/\____/_/|_|


Box version 4.2.0@afc3a47

 // Loading the configuration file "/usr/src/box.json".

🔨  Building the PHAR "/usr/src/bin/phplint.phar"

? Registering compactors
  + KevinGH\Box\Compactor\PhpScoper
? Adding main file: /usr/src/bin/phplint
? Adding requirements checker
? Adding binary files
    > No file found
? Auto-discover files? Yes
? Exclude dev files? Yes
? Adding files
    > 369 file(s)
? Generating new stub
  - Using shebang line: #!/usr/bin/env php
  - Using banner:
    > This file is part of the overtrue/phplint
    >
    > (c) overtrue <i@overtrue.me>
    >
    > This source file is subject to the MIT license that is bundled
    > with this source code in the file LICENSE.
? Setting metadata
  - Using composer.json : /usr/src/composer.json
  - Using composer.lock : /usr/src/composer.lock
  - overtrue/phplint: dev-main@1a3b977
 requires php ^8.0: 8.1.7
 requires ext-json *: 8.1.7
 requires (for development) bamarni/composer-bin-plugin ^1.4: 1.8.2
 requires (for development) brainmaestro/composer-git-hooks ^2.8.5 || 3.0.0-alpha.1: v3.0.0-alpha.1
 uses composer/pcre : 3.1.0
 uses composer/semver : 3.3.2
 uses composer/xdebug-handler : 3.0.3
 uses doctrine/annotations : 1.14.2
 uses doctrine/deprecations : v1.0.0
 uses doctrine/instantiator : 1.5.0
 uses doctrine/lexer : 2.1.0
 requires (for development) friendsofphp/php-cs-fixer ^3.4.0: v3.13.2
 requires (for development) jetbrains/phpstorm-stubs ^2021.3 || ^2022.3: v2022.3
 uses myclabs/deep-copy : 1.11.0
 uses nikic/php-parser : v4.15.2
 uses phar-io/manifest : 2.0.3
 uses phar-io/version : 3.2.1
 uses php-parallel-lint/php-console-color : v1.0.1
 requires (for development) php-parallel-lint/php-console-highlighter ^1.0: v1.0.0
 uses phpunit/php-code-coverage : 9.2.23
 uses phpunit/php-file-iterator : 3.0.6
 uses phpunit/php-invoker : 3.1.1
 uses phpunit/php-text-template : 2.0.4
 uses phpunit/php-timer : 5.0.3
 requires (for development) phpunit/phpunit ^9.5: 9.5.27
 uses psr/cache : 3.0.0
 uses psr/container : 2.0.2
 uses psr/event-dispatcher : 1.0.0
 uses psr/log : 3.0.0
 uses sebastian/cli-parser : 1.0.1
 uses sebastian/code-unit : 1.0.8
 uses sebastian/code-unit-reverse-lookup : 2.0.3
 uses sebastian/comparator : 4.0.8
 uses sebastian/complexity : 2.0.2
 uses sebastian/diff : 4.0.4
 uses sebastian/environment : 5.1.4
 uses sebastian/exporter : 4.0.5
 uses sebastian/global-state : 5.0.5
 uses sebastian/lines-of-code : 1.0.3
 uses sebastian/object-enumerator : 4.0.4
 uses sebastian/object-reflector : 2.0.4
 uses sebastian/recursion-context : 4.0.4
 uses sebastian/resource-operations : 3.0.3
 uses sebastian/type : 3.2.0
 uses sebastian/version : 3.0.2
 requires symfony/cache ^5.4 || ^6.0: v6.0.18
 uses symfony/cache-contracts : v3.0.2
 requires symfony/console ^5.4 || ^6.0: v6.0.17
 uses symfony/deprecation-contracts : v3.0.2
 requires symfony/event-dispatcher ^5.4 || ^6.0: v6.0.17
 uses symfony/event-dispatcher-contracts : v3.0.2
 uses symfony/filesystem : v6.0.13
 requires symfony/finder ^5.4 || ^6.0: v6.0.17
 requires symfony/options-resolver ^5.4 || ^6.0: v6.0.3
 uses symfony/polyfill-ctype : v1.27.0
 uses symfony/polyfill-intl-grapheme : v1.27.0
 uses symfony/polyfill-intl-normalizer : v1.27.0
 uses symfony/polyfill-mbstring : v1.27.0
 uses symfony/polyfill-php80 : v1.27.0
 uses symfony/polyfill-php81 : v1.27.0
 requires symfony/process ^5.4 || ^6.0: v6.0.11
 uses symfony/service-contracts : v3.0.2
 uses symfony/stopwatch : v6.0.13
 uses symfony/string : v6.0.17
 uses symfony/var-exporter : v6.0.17
 requires symfony/yaml ^5.4 || ^6.0: v6.0.17
 uses theseer/tokenizer : 1.2.1
? Dumping the Composer autoloader
? Removing the Composer dump artefacts
? No compression
? Setting file permissions to 0700
* Done.

No recommendation found.
No warning found.

 // PHAR: 402 files (1.89MB)
 // You can inspect the generated PHAR with the "info" command.

 // Memory usage: 55.37MB (peak: 104.89MB), time: 8secs
  • Try it (BOX v4 requires PHP 8.1) but PHAR version built may run on PHP 8.0 too

v9-phar-php8

@llaville llaville self-assigned this Jan 14, 2023
@overtrue
Copy link
Owner

overtrue commented Jan 14, 2023 via email

@llaville
Copy link
Collaborator Author

Don't be afraid if one day you want to drop usage of my box manifest builder project.
Fallback is simple and easy. Metadata is consider as simple text line by standard BOX project v4

Answer in image

box-v4_standard

llaville added a commit that referenced this issue Jan 14, 2023
@llaville
Copy link
Collaborator Author

To conclude implementation of this feature, I've added with commit 6bf1a26 ability to display manifest of PHP Linter PHAR version with a single --manifest option.
This is what I apply on all my projects that have a CLI version (and of course PHAR distribution).

Here is a preview (part of screenshot that is too long, because lot of dependency) of what we can get :

v9-phar-php8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants