$ cd ..
# First run
$ dub --root $PWD/project build
Starting Performing "debug" build using /home/drey/dlang/dmd-2.102.0/linux/bin64/dmd for x86_64.
Building protobuf ~master: building configuration [protobuf]
Building project ~master: building configuration [application]
Linking project
# Second run
$ dub --root $PWD/project build
Starting Performing "debug" build using /home/drey/dlang/dmd-2.102.0/linux/bin64/dmd for x86_64.
Building protobuf ~master: building configuration [protobuf]
Building project ~master: building configuration [application]
Linking project
Notice that dub rebuilds all the dependencies every time, it does not cache them.
Compare that to running it within the project folder:
$ cd project
$ dub build
Starting Performing "debug" build using /home/drey/dlang/dmd-2.102.0/linux/bin64/dmd for x86_64.
Up-to-date protobuf ~master: target for configuration [protobuf] is up to date.
Building project ~master: building configuration [application]
Linking project
Finished To force a rebuild of up-to-date targets, run again with --force
It correctly uses the cached version: Up-to-date protobuf.
My main use-case is running scripts or sample code which happens to use the library in the root.
My options are:
Use configurations in the root dub file to create sample code. But this is problematic when the sample code uses extra dependencies which the library code should not itself depend on.
Create a separate .dub file for the sample code. This is what I did and it's why I used --root.
Since --root has this caching problem I think I'll have to manually CD to the sample project and run dub without --root.
Create a folder named
project
and add thisdub.sdl
:Then add the
protobuf
submodule:Now CD up one directory and try to use
--root
:Notice that dub rebuilds all the dependencies every time, it does not cache them.
Compare that to running it within the project folder:
It correctly uses the cached version:
Up-to-date protobuf
.My main use-case is running scripts or sample code which happens to use the library in the root.
My options are:
--root
.Since
--root
has this caching problem I think I'll have to manually CD to the sample project and rundub
without--root
.