-
Notifications
You must be signed in to change notification settings - Fork 18
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
How to require an specific OS #106
Comments
Not possible at the moment, but something we can look into 👍 |
I'd be interested in having a look at this feature! What about the following syntax? {
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"configure-options": [
// ...
],
"os-families": ['Windows', 'Darwin'] // not compatible with Linux here for example
}
} The values contained in Also, it would be possible to use the wildcard, like |
I think it'd be good to have a way to negate something if you want to closely match PHP_OS_FAMILY, because I suspect most things are gonna be Windows-only, Linux/BSD/Solaris/Darwin-only, or everything. I don't think there are many that support everything except Solaris or everything except BSD. So it could be nicer with Another possible syntax would be |
I agree with you, by reading at your comment it feels more natural to me to work with a blacklist instead of a whitelist. Also it saves us from handling the wildcard. I'd rather use |
Some examples for reference: only Win:
only non-Win:
only OSX:
|
So what I was suggesting is to include BOTH options sorry it was clearly not clear :D only Win:
only non-Win:
only OSX:
That way you can target whatever you want with the least amount of listing-distros and possibly forgetting things. Obviuosly the "Unknown" wildcard is a bit problematic here.. But I guess those fall in the category of "rather just allow it and see if it builds 🤷🏻♂️ "? |
I'm fine accepting both keys, I agree it's more flexible because I guess you'll either exclude only one OS or allow only one in most cases actually. About the "Unknown" value, I also think we shouldn't get too worked up about it and we shouldn't do anything special for it. Let's just wait for someone to raise an issue if there's something wrong 😄 |
I’m okay to use both keys. The wildcard or “Unknown” is not necessary. If the extension maintainer wants to exclude the unknown OS, it must list all included OS. If the extension maintainer wants to include “unknown” it uses the exclude key or nothing. IMO it’s necessary to make an exhaustive list of OS names used in the lists. |
This list is already defined: https://www.php.net/manual/en/reserved.constants.php#constant.php-os-family That list is where One thing that should be defined is the behaviour if both keys are used, a few examples: {
"php-ext": {
"os-families": ["Windows"],
"os-families-exclude": ["Windows"]
}
} {
"php-ext": {
"os-families": ["Windows", "Linux"],
"os-families-exclude": ["Linux"]
}
} I would suggest that perhaps the most natural method for processing would be (pseudo-code):
Therefore the results of my two examples:
|
I think I'd declare it in the json schema as being a oneOf, so that either key should be provided, but not both, and probably need to check in the loader code to throw if both are provided because this is nonsense, even if we can reconcile it per your rules, it's just clearer to disallow it IMO. |
That is probably safer 💯 👍 |
Both keys are declared nonsense. However, the maintainer must check if the composer.json is valid before tagging the version. A command |
I updated https://github.com/ThePHPF/pie-design/pull/29/files to reflect our discussion. @macintoshplus the |
|
Cool, less code to write. But, it's interesting to add this information to the documentation. Right? |
The Win32Service PHP extension can be built and used only on the Microsoft Windows operating system.
How to specify this constraint on
composer.json
file?The text was updated successfully, but these errors were encountered: