digitalmars.D.learn - Is there a way to mark a dub package as linux only?
- =?UTF-8?Q?Christian_K=c3=b6stlin?= (3/3) Sep 26 2022 Or posix only? Or not windows?
- Ahmet Sait (10/13) Sep 27 2022 Not necessarily a dub solution but you can do something like this:
- =?UTF-8?Q?Christian_K=c3=b6stlin?= (3/16) Sep 27 2022 Thanks a lot ... but thats a little late for me :) as someone already
- Steven Schveighoffer (20/26) Sep 27 2022 We have specific directives based on os, I had an idea that you could
- rikki cattermole (3/3) Sep 27 2022 Alternatively we could just extend platforms to work in places other
- Alain De Vos (1/1) Sep 27 2022 Don't forget there is also BSD
- rikki cattermole (11/12) Sep 27 2022 Should already be supported.
Or posix only? Or not windows? Kind regards, Christian
Sep 26 2022
On Monday, 26 September 2022 at 20:57:06 UTC, Christian Köstlin wrote:Or posix only? Or not windows? Kind regards, ChristianNot necessarily a dub solution but you can do something like this: ```d version(Posix) { } else static assert(0, "Unsupported platform."); ``` This will result in a compiler error while targetting a non-posix platform.
Sep 27 2022
On 27.09.22 13:07, Ahmet Sait wrote:On Monday, 26 September 2022 at 20:57:06 UTC, Christian Köstlin wrote:Thanks a lot ... but thats a little late for me :) as someone already might have added my library and was looking forward on using it.Or posix only? Or not windows? Kind regards, ChristianNot necessarily a dub solution but you can do something like this: ```d version(Posix) { } else static assert(0, "Unsupported platform."); ``` This will result in a compiler error while targetting a non-posix platform.
Sep 27 2022
On 9/26/22 4:57 PM, Christian Köstlin wrote:Or posix only? Or not windows? Kind regards, ChristianWe have specific directives based on os, I had an idea that you could say something like: ```json "dependencies-windows": { "not-available" : "*" } ``` But it still tries to find this package even on non-windows OSes, so that doesn't work. This still wouldn't prevent you from adding the dependency on your non-supported OS in the first place, but I'm not sure that's a good UX, since someone might add a dependency for a specific OS, even when not on that OS. You could possibly create little stub packages for all OSes to be excluded, like `exclude-os:windows`, and then you could add those dependencies to non-windows libraries. Yes, it would download those stubs once, but would fail to build on the "wrong" OS. I think your best bet is to version the whole library out, and let them read the static assert message from compiling against your library. -Steve
Sep 27 2022
Alternatively we could just extend platforms to work in places other than configurations. https://dub.pm/package-format-json.html#configuration-settings
Sep 27 2022
On 28/09/2022 7:18 AM, Alain De Vos wrote:Don't forget there is also BSDShould already be supported. Platform specific settings are supported through the use of field name suffixes. Suffixes are dash separated list of operating system/architecture/compiler identifiers, as defined in the D language reference, but converted to lower case. The order of these suffixes is os-architecture-compiler, where any of these parts can be left off. Additionally on Windows the architectures x86_omf and x86_mscoff can be used with dmd to differentiate between 32 bit object formats used with the --arch switch. Examples: https://dub.pm/package-format-json.html#build-settings
Sep 27 2022