I am building multiple projects for a client and they tend to have common code that I've factored out into separate projects. I'm trying to use DUB to organize all of this, but so far I can't figure out how to add these common projects as dependencies without publishing them on a site like github and registering them in DUB's public registry. Publishing these things would either violate my contract or put uninteresting spam in the DUB registry (or both). Is there any way I can operate my own DUB registry on a private server, and have it graph all of the usual public projects plus a handful of private ones in LAN-accessible git repos?
This would save me from having to make a lot of git submodules. :)
Thanks.
You can self host a dub registry by using your own --hostname
parameter on dub-registry and providing your own --registry
parameter on dub.
Alternatively, you can just use your packages locally (or remotely, if packages are placed on network drive). Dub wiki page "Cookbook" explains how to work with packages that are not in registry: https://github.com/dlang/dub/wiki/Cookbook#working-with-submodules-or-packages-that-are-not-in-the-registry
Working with submodules or packages that are not in the registry
It is a common practice to either have a project as a git submodule of a master project, or to use an unregistered project as a dependency for development. In this setup, setting the project to depend on a project at a given path, rather than looking up the repository, can come handy. Here's an example of such a package:
{ "name": "dlang-org", "dependencies": { "libddoc": { "path": "./libddoc" }, "libdparse": { "path": "./libdparse" } } }
Another possibility is to add-local a package. This is particular useful during development, when you want to test a package with some libraries using that package.
dub add-local myrepo dub list