Clean up PackageManager handling of search path
The PackageManager is a complicated beast:
it is responsible for handling the local caches where downloaded
packages are stored, including looking up a specific version of a specific package.

One feature that stood out while going over the code was the ability to disable
the default search path.
After looking up inside of Dub more, it turns out that this feature is exclusively
used when dub is called with the '--bare' option.

However, when this happen, a special constructor of the Dub class is called,
one that calls the 'PackageManager' constructor with 3 dummy arguments,
and rely on a boolean being set to avoid those 3 dummy arguments having any effect.
This ends up with effectively providing the ability to toggle the ability to
search default search paths in theory, but in practice the dummy arguments
means that it wouldn't work, nor is it actually needed.

Instead, a special argument for the single-search path approach is provided now.
In order not to break library users, the public symbols have been deprecated,
but their usage still works.
Note that some symbols are deeply entangled: for example, 'Dub.m_overrideSearchPath'
being non-empty means that 'PackageManager.m_disableDefaultSearchPaths' is 'true'.
It also means that 'PackageManager.m_repositories' is unused (and can be empty).
Hopefully removing the ability to toggle the default search path will allow
us to simplify things and make 'PackageManager.m_repositories' the only way
to specify whether or not the default packages search path are used.

Note that additionally to the changes aiming to deprecate 'Dub.m_overrideSearchPath'
and 'PackageManager.m_disableDefaultSearchPath', an unused constructor of PackageManager
has been deprecated.
1 parent e05421d commit 48a26dbd9bc4c535bcde8e3a5b3fe8e7ae4a93d2
@Geod24 Geod24 authored on 30 Dec 2019
Showing 2 changed files
View
source/dub/dub.d
View
source/dub/packagemanager.d