Thread overview
dub should be more command-line oriented
Jan 10, 2018
Luís Marques
Jan 10, 2018
Joakim
Jan 11, 2018
Computermatronic
Jan 11, 2018
JN
Jan 11, 2018
Seb
Feb 13, 2018
timotheecour
January 10, 2018
I often feel that dub relies too much on dub.[json|sdl] and too little on command-line switches. Here's the latest example:

1) Write code
2) Start refactoring code
3) Compile and run to check the partially implemented change
4) dub gives a warning; the warning is expected due to the incomplete change; I don't care about it right now, I just want to check that something related to that change works
5) Because of the warning, dub doesn't even finish building the project
6) I want to force dub to build it, but there's no switch for that
7) I have to go check the docs for what is the dub.json setting that allows warnings (it's "buildRequirements": ["allowWarnings"])
8) I change dub.json
9) I compile it again

universe 1:
10) I finish the refactoring
11) I forget to remove the new setting

universe 2:
10) I remove "allowWarnings" immediately
11) while trying to do another intermediate testing step, I get another warning
12) goto 7 or 8
January 10, 2018
On Wednesday, 10 January 2018 at 15:07:40 UTC, Luís Marques wrote:
> I often feel that dub relies too much on dub.[json|sdl] and too little on command-line switches. Here's the latest example:
>
> [...]

You're welcome to submit a pull for a command-line flag or a new build mode or however you best envision this fixed:

https://github.com/dlang/dub/pulls
January 11, 2018
On Wednesday, 10 January 2018 at 15:07:40 UTC, Luís Marques wrote:
> I often feel that dub relies too much on dub.[json|sdl] and too little on command-line switches. Here's the latest example:
>
> [...]

You could just make a refactoring configuration and use the --config flag to specify it when necessary. (see: https://code.dlang.org/package-format?lang=json#configurations)
January 11, 2018
On Wednesday, 10 January 2018 at 15:07:40 UTC, Luís Marques wrote:
> universe 1:
> 10) I finish the refactoring
> 11) I forget to remove the new setting
>
> universe 2:
> 10) I remove "allowWarnings" immediately
> 11) while trying to do another intermediate testing step, I get another warning
> 12) goto 7 or 8

universe 3:

a newcomer to the project wants to build it with as little effort as possible:

1) git clone from github
2) dub build - fails
3) read through readme to find some special commandline switches that need to be added / find some shell script (Linux only) hidden in build directory
4) finally build the project

I think files have the advantage of explicitly specifying the dependencies. Relying on commandline switches is more risky and often such switches land in platform-specific shell scripts which are harder to maintain.
January 11, 2018
On Wednesday, 10 January 2018 at 15:07:40 UTC, Luís Marques wrote:
> I often feel that dub relies too much on dub.[json|sdl] and too little on command-line switches. Here's the latest example:
>
> 1) Write code
> 2) Start refactoring code
> 3) Compile and run to check the partially implemented change
> 4) dub gives a warning; the warning is expected due to the incomplete change; I don't care about it right now, I just want to check that something related to that change works
> 5) Because of the warning, dub doesn't even finish building the project
> 6) I want to force dub to build it, but there's no switch for that
> 7) I have to go check the docs for what is the dub.json setting that allows warnings (it's "buildRequirements": ["allowWarnings"])
> 8) I change dub.json
> 9) I compile it again
>
> universe 1:
> 10) I finish the refactoring
> 11) I forget to remove the new setting
>
> universe 2:
> 10) I remove "allowWarnings" immediately
> 11) while trying to do another intermediate testing step, I get another warning
> 12) goto 7 or 8

It's not well documented, but you can always overwrite DUB with DFLAGS:

DFLAGS="-dw" dub

It will give you a warning though, but it's justified as you might have `DFLAGS` set accidentally.
February 13, 2018
On Thursday, 11 January 2018 at 15:37:20 UTC, Seb wrote:
> On Wednesday, 10 January 2018 at 15:07:40 UTC, Luís Marques

> It's not well documented, but you can always overwrite DUB with DFLAGS:
>
> DFLAGS="-dw" dub
>
> It will give you a warning though, but it's justified as you might have `DFLAGS` set accidentally.


does that really work?
DFLAGS="-wi" dub build --vverbose
dmd -c ...  -wi -w ...
=> -wi is overridden