Dub

The Dub class helps in getting the applications dependencies up and running. An instance manages one application.

Constructors

this
this(PackageSupplier[] additional_package_suppliers = null, string root_path = ".")

Initiales the package manager for the vibe application under root.

this
this(Path override_path)

Initializes DUB with only a single search path

Members

Functions

cachedPackages
string[string] cachedPackages()

Returns all cached packages as a "packageId" = "version" associative array

cleanCaches
void cleanCaches()

cleans all metadata caches

cleanPackage
void cleanPackage(Path path)

Cleans intermediate/cache files of the given package

describeProject
void describeProject(BuildPlatform platform, string config)

Outputs a JSON description of the project, including its dependencies.

fetch
Package fetch(string packageId, const Dependency dep, PlacementLocation location, FetchOptions options, string reason = "")

Fetches the package matching the dependency and places it in the specified location.

generateProject
void generateProject(string ide, GeneratorSettings settings)

Generate project files for a specified IDE. Any existing project files will be overridden.

loadPackage
void loadPackage(Path path)

Loads the package from the specified path as the main project package.

loadPackage
void loadPackage(Package pack)

Loads a specific package as the main project package (can be a sub package)

loadPackageFromCwd
void loadPackageFromCwd()

Loads the package from the current working directory as the main project package.

remove
void remove(in Package pack, bool force_remove)

Removes a given package from the list of present/cached modules. @removeFromApplication: if true, this will also remove an entry in the list of dependencies in the application's dub.json

remove
void remove(string package_id, string version_, PlacementLocation location_, bool force_remove)

This will remove a given package with a specified version from the location. It will remove at most one package, unless @param version_ is specified as wildcard "*". @param package_id Package to be removed @param version_ Identifying a version or a wild card. An empty string may be passed into. In this case the package will be removed from the location, if there is only one version retrieved. This will throw an exception, if there are multiple versions retrieved. Note: as wildcard string only RemoveVersionWildcard ("*") is supported. @param location_

shutdown
void shutdown()

Perform cleanup and persist caches to disk

testProject
void testProject(GeneratorSettings settings, string config, Path custom_main_file)

Executes tests on the current project. Throws an exception, if unittests failed.

Manifest constants

RemoveVersionWildcard
enum RemoveVersionWildcard;

@see remove(string, string, RemoveLocation)

Properties

projectName
string projectName [@property getter]

Returns the name listed in the dub.json of the current application.

rootPath
Path rootPath [@property getter]
Path rootPath [@property setter]

Returns the root path (usually the current working directory).

Meta