dlang / dub

Package and build management system for D
MIT License
673 stars 230 forks source link

drop support for `dub filename` for files that don't exist #2681

Closed WebFreak001 closed 7 months ago

WebFreak001 commented 1 year ago

Currently if we have a hello.d in the current working directory we can run dub hello to invoke the hello.d file.

However this only works if a hello.d file exists and if no hello file exists.

As soon as you use dub build --single hello.d on POSIX, the dub hello command will stop working with Error Invalid UTF-8 sequence (at index 1), since it generated the file hello which is an executable file.

This was added in https://github.com/dlang/dub/pull/1605 by @andre2007

I think this is a hurdle when adding custom command support to DUB (e.g. loaded from the registry), so I think we should remove that feature.

However this is somewhat consistent with what the compiler does (except the compiler does not attempt to parse the executable file)

Option 1: remove this feature Option 2: make it only work when using / or \ in the path (e.g. ./hello) Option 3: keep it as-is (requiring decisions what to has precedence with custom commands when published on the registry)

Additionally we need to fix that it doesn't attempt to parse the executable file, but only D source files.

Geod24 commented 9 months ago

It's very error prone, I think we should remove it.

Geod24 commented 9 months ago

Can we deprecate it first @WebFreak001 ?

Geod24 commented 7 months ago

Actually this is E_WONTFIX. This syntax is intended to work for shell-like approach. So you can put a command in your path and use a D script under the hood.