Is there a way to mark a dub package as linux only?

Steven Schveighoffer schveiguy at gmail.com
Tue Sep 27 13:15:49 UTC 2022


On 9/26/22 4:57 PM, Christian Köstlin wrote:
> Or posix only? Or not windows?
> 
> Kind regards,
> Christian
> 
> 

We 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


More information about the Digitalmars-d-learn mailing list