Giter Site home page Giter Site logo

Comments (20)

kelunik avatar kelunik commented on August 12, 2024 1

My current proposal would be something like

"before-script": [
    "git describe --tags > build/version.txt"
],
"after-script": [
    "rm build/version.txt",
    "chmod +x build/acme-client.phar"
]

in the "extra" section in the composer.json.

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024 1

@kelunik, I made a first version of the hooks/event implementation (see e6ebea5).

I have to finish the documentation about it.

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

I'm not sure to understand what you try to do 😕

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

I want to provide a command line command like acme-client version that shows the current version. In case it's a nightly build (not one from a tag), version with git describe --tags would be something like v0.2.4-3-ga05a4f8. Since the packaged version doesn't have any .git info available, I need to package it somehow.

I could use a script that gets that information and builds the phar afterwards, but it would be nice if there was support directly in here, which would avoid the need for an extra script.

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

Something similar to Composer event script, why not.

Another idea is to create a new constant in the phar stub (bootstrap) code.
something like:

$this->phar->setStub(
    '#!/usr/bin/env php' . PHP_EOL .
    '<?php Phar::mapPhar(); ' . 
    (null === $constant?'':'define(\'PHAR_VERSION\', \''.addslashes($constant).'\');') . 
    'include "phar://' . $this->alias . '/' . $this->stubFile .
    '"; __HALT_COMPILER(); ?>'
);

And in the console call:

$ phar-builder package --version=`git describe --tags`

But your proposal allow to have event based addition action/control which can be lot more flexible

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

PHP Fatal error: Uncaught Error: Class 'League\Event\Emitter' not found in /home/kelunik/GitHub/kelunik/acme-client/vendor/macfja/phar-builder/app/Application.php:68

Somehow, league/event doesn't get installed even if it's in the composer.json.

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

And it doesn't respect the output-dir configuration option anymore.

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

Also PHP Warning: Declaration of MacFJA\PharBuilder\Event\ComposerAwareEvent::named($name, $composer) should be compatible with League\Event\Event::named($name) in /home/kelunik/GitHub/kelunik/acme-client/vendor/macfja/phar-builder/app/Event/ComposerAwareEvent.php on line 15

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

Also PHP Warning: Declaration of MacFJA\PharBuilder\Event\ComposerAwareEvent::named($name, $composer) should be compatible with League\Event\Event::named($name) in /home/kelunik/GitHub/kelunik/acme-client/vendor/macfja/phar-builder/app/Event/ComposerAwareEvent.php on line 15

It's the second times! I really need to found a way to detect this! (Correct in 97bfa5f by the way)

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

I think the warning is only printed in PHP 7?

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

Nope, it's my PHP(s) configuration: the E_STRICT flag is missing in error_reporting of my php.ini

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

Did you have a look at the output dir?

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

Yep, normally it's corrected with the commit e5bb1ec

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

"league/event": "^2.1" is missing as requirement.

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

And another thing afterwards:

Uncaught Error: Class 'Neutron\SignalHandler\SignalHandler' not found
in /acme-client/vendor/macfja/phar-builder/app/Event/EventManager.php:76

https://packagist.org/packages/neutron/signal-handler

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

After that, it fails with

Warning: require(phar:///acme-client/build/acme-client.phar/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: phar error: "vendor/symfony/polyfill-mbstring/bootstrap.php" is not a file in phar "/acme-client/build/acme-client.phar" in phar:///acme-client/build/acme-client.phar/vendor/composer/autoload_real.php on line 65

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

Are you sure to use the right branch for your test?

Those two dependencies are declared in the branch events+issue-17 but not on the master

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

That might be the case because I used dev-master#hash before, because the branch didn't work. I opened an issue: composer/composer#5397. I guess it's related to the + in the branch name.

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

Bug in Composer is gone now. Issue with polyfill-mbstring persists. It's required, because it's listed in autoload.files. I think we had that issue before? Do we need stubs for that?

from pharbuilder.

kelunik avatar kelunik commented on August 12, 2024

#21 fixes this.

from pharbuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.