dlang / dub

Package and build management system for D
MIT License
678 stars 227 forks source link

Allow to specify dependencies on the command line #1502

Open rracariu opened 6 years ago

rracariu commented 6 years ago

Currently in order to test a random dub package one needs to either create a dummy dub package that includes the test package as a dependency or could use the shebang trick.

Both have downside, first is more involved as it requires creating an additional file and basic knowledge of the dub format. The second is very Unix-ish and not something Windows users are familiar with and usually hard to translate to a Windows environment.

My RFE is a command line option, lets call it --deps, that allows one to specify a list of package name - version tuple, something akin to dub --deps vibe-d ~>0.8, libasync

The list of package name - version tuple is specified as

<deps>        :=  <dep> ["," <dep>]*
<dep>         :=  <name> [<ver>]

A dependency can omit the version requirements, this will default to latest

When --deps is used dub should automatically compile all *.d files in the current directory and assume an application type.

This will greatly improve the experience for new comers and make life easy for savvy developers looking to quickly test some code in combination with some dub packages.

ghost commented 6 years ago

what is what you call "the shebang trick" ? embedded receipt ?

rracariu commented 6 years ago

Yes. The embedded reciept.

Geod24 commented 4 years ago

Can you describe your use case a bit more ?

It seems very rare that one would want to add dependencies just for one dub run. And even if that happens, dub add pkg@version && dub run ... && dub remove pkg could easily be made an alias.