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

Depend on "PHP and Xdebug" or "HHVM" #2940

Closed
sebastianbergmann opened this issue Apr 26, 2014 · 8 comments
Closed

Depend on "PHP and Xdebug" or "HHVM" #2940

sebastianbergmann opened this issue Apr 26, 2014 · 8 comments

Comments

@sebastianbergmann
Copy link

Is it possible, and if so, how, to express that a package depends on "PHP and Xdebug" or "HHVM"?

The use case for this is php-code-coverage which requires the Xdebug extension on standard PHP but no additional extension on HHVM.

@Seldaek
Copy link
Member

Seldaek commented Apr 26, 2014

This is not possible right now. It falls under the same category as php extensions reimplementing some php packages, ideally hhvm should have a way to say it replaces/provides ext-xdebug.

@stof
Copy link
Contributor

stof commented Apr 26, 2014

@Seldaek HHVM does not replace/provide XDebug. It does not implement the XDebug functions.

this is actually a specific use case for #751

@naderman
Copy link
Member

naderman commented Sep 2, 2014

I think currently as a work around you could solve this by also publishing two empty metapackages called php-code-coverage-dep-php-xdebug which requires php and xdebug and provides php-code-coverage-dep-platform and php-code-coverage-dep-hhvm which also provides php-code-coverage-dep-platform but requires hhvm, and then requiring only php-code-coverage-dep-platform. Although I'm unsure if this still works now that we've made the changes in #2690 - which is why I was a bit concerned if that was a good idea.

Either way looks like we need to work out #751 somehow.

@jakoch
Copy link
Contributor

jakoch commented Sep 4, 2014

Would a composer.json syntax like the following correctly model this issue?

"require-dev": {   
    "phpunit/phpunit": "dev-master",
    "platform-php": {
        "ext-xdebug": ">=2.1.4"
    },
    "platform-hhvm": {

    }
},
"suggest": {
    "ext-dom": "*",
    "ext-xmlwriter": "*",
    "platform-php": {
        "ext-xdebug": ">=2.1.4"
    }        
},
// force the platform in "extra" or "config"
// to allow packaging for the PHP platform on/from another platform
"config": {
    "force-platform": "php"
}

This introduces a "platform-xy" conditional, which allows resolving packages only,
when the given platform requirement is met by environment or if the config.force-platform override is set.

I think it might be possible to work on the CompositeRepository ($installedRepo = new CompositeRepository($repos);) with filterPackages() and a callback to compare the required platform name (env or config.force-platform) and to removePackage() not for this platform.
The packages can be dropped before resolving and before aliases are build.

If i'm not totally off-track with this idea, then this should provide "platform specific local packages".

@Seldaek Seldaek added the Feature label Jan 1, 2015
@Seldaek Seldaek added this to the Later milestone Jan 1, 2015
@nicolas-grekas
Copy link
Contributor

👍 on this. Sooner than later, we'll need to express: this package works on php>=5.y.z or hhvm>=3.a.b

@mickaelandrieu
Copy link

@Seldaek is that a "big" feature that need a lot of work ? Would you consider a pull request that address this issue ?

@Seldaek
Copy link
Member

Seldaek commented Oct 28, 2015

I think to do it right and think of all the edge cases yes it's probably a lot of work. If you come up with something that works and doesn't introduce an insane amount of code I guess it might be merged, but I am not too warm to this feature I have to say because it sounds like opening pandora's box. Runtime checks can do pretty powerful things and replicating all that in composer.json sounds like it'll go into feature creep pretty quickly.

@Seldaek
Copy link
Member

Seldaek commented Oct 28, 2015

Actually after some more thought, I don't really think this is gonna happen, as said above sure if someone comes up with a working and not insane solution we might reconsider but as such I would rather avoid it so closing.

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

No branches or pull requests

7 participants