dub icon indicating copy to clipboard operation
dub copied to clipboard

`dub lint` should only build dscanner if dscanner source code has changed

Open Moth-Tolias opened this issue 3 years ago • 5 comments
trafficstars

System information

  • dub version: v1.29.0
  • OS Platform and distribution: Windows 8
  • compiler version v2.100.0-dirty

Bug Description

dub lint always builds dscanner anew on every invocation even if a prior up-to-date build exists, wasting several seconds and causing unnecessary log spam.

How to reproduce

  1. run dub lint
  2. observe that an entirely new build of dscanner is performed, regardless of previous invocations.

Expected Behavior

if an up-to-date build of dscanner already exists, dub lint should use that.

Logs

Running pre-generate commands for dscanner...
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
stdx-allocator 2.77.5: target for configuration "library" is up to date.
emsi_containers 0.8.1: target for configuration "library" is up to date.
libdparse 0.19.2: target for configuration "library" is up to date.
dsymbol 0.13.0: target for configuration "library" is up to date.
inifiled 1.3.3: target for configuration "library-quiet" is up to date.
libddoc:common 0.8.0: target for configuration "library" is up to date.
libddoc 0.8.0: target for configuration "lib" is up to date.
dscanner 0.12.1: building configuration "application"...
Linking...
dparse.lib(lexer.obj) : warning LNK4255: library contain multiple objects of the same name; linking object as if no debug info
To force a rebuild of up-to-date targets, run again with --force.
Running ../../../../AppData/Local/dub/packages/dscanner-0.12.1/dscanner/bin/dscanner.exe --styleCheck C:\Users\Su\Documents\src\libraries\expected\

Moth-Tolias avatar Jun 06 '22 16:06 Moth-Tolias

this is a bug with dscanner that it uses preGenerateCommands instead of preBuildCommands for the dub hash generation.

It should be fixed once https://github.com/dlang-community/D-Scanner/pull/857 is merged

WebFreak001 avatar Jun 08 '22 09:06 WebFreak001

Are you sure it does a full rebuild every time? On second invocation I "only" get:

Running pre-generate commands for dscanner...
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
stdx-allocator 2.77.5: target for configuration "library" is up to date.
emsi_containers 0.8.1: target for configuration "library" is up to date.
libdparse 0.19.2: target for configuration "library" is up to date.
dsymbol 0.13.0: target for configuration "library" is up to date.
inifiled 1.3.3: target for configuration "library-quiet" is up to date.
libddoc:common 0.8.0: target for configuration "library" is up to date.
libddoc 0.8.0: target for configuration "lib" is up to date.
dscanner 0.12.1: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.

Still, it's spamming logs and doing unnecessary work. Implementing a --cached argument for dub run as suggested in https://github.com/dlang/dub/pull/2254#issuecomment-1153131950 would get rid of this.

veelo avatar Jun 12 '22 15:06 veelo

oh, that's curious. i always get a rebuild. i wonder what's different about our setups?

Moth-Tolias avatar Jun 13 '22 04:06 Moth-Tolias

Curious indeed. I have a project where I call dub run dfmt repeatedly, and it recompiles every time as well, like you have with dscanner.

veelo avatar Jun 13 '22 07:06 veelo