Dub

Provides a high-level entry point for DUB's functionality.

This class provides means to load a certain project (a root package with all of its dependencies) and to perform high-level operations as found in the command line interface.

class Dub {}

Constructors

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

Initializes the instance for use with a specific root package.

this
this(NativePath override_path)

Initializes the instance with a single package search path, without loading a package.

Members

Functions

addLocalPackage
void addLocalPackage(string path, string ver, bool system)

Adds a directory to the list of locally known packages.

addSearchPath
void addSearchPath(string path, bool system)

Registers a local directory to search for packages to use for satisfying dependencies.

cleanPackage
void cleanPackage(NativePath path)

Cleans intermediate/cache files of the given package

convertRecipe
void convertRecipe(string destination_file_ext, bool print_only = false)

Converts the package recipe of the loaded root package to the given format.

createEmptyPackage
void createEmptyPackage(NativePath path, string[] deps, string type, PackageFormat format = PackageFormat.sdl, scope void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback = null)

Initializes a directory with a package skeleton.

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 generator.

getDefaultConfiguration
string getDefaultConfiguration(BuildPlatform platform, bool allow_non_library_configs = true)

Gets the default configuration for a particular build platform.

getLatestVersion
Version getLatestVersion(string package_name, bool prefer_stable = true)

Returns the latest available version for a particular package.

listPackageVersions
Version[] listPackageVersions(string name)

Returns a list of all available versions (including branches) for a particular package.

listProjectData
void listProjectData(GeneratorSettings settings, string[] requestedData, ListBuildSettingsFormat list_type)

Prints the specified build settings necessary for building the root package.

loadPackage
void loadPackage()

Loads the package that resides within the configured rootPath.

loadPackage
void loadPackage(NativePath 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)

loadSingleFilePackage
void loadSingleFilePackage(NativePath path)
void loadSingleFilePackage(string path)

Loads a single file package.

overrideSearchPath
void overrideSearchPath(NativePath path)

Disables the default search paths and only searches a specific directory for packages.

remove
void remove(in Package pack)

Removes a specific locally cached package.

remove
void remove(in Package pack, bool force_remove)

Compatibility overload. Use the version without a force_remove argument instead.

remove
void remove(string package_id, PlacementLocation location, scope size_t delegate(in Package[] packages) resolve_version)

Removes one or more versions of a locally cached package.

remove
void remove(string package_id, PlacementLocation location, bool force_remove, scope size_t delegate(in Package[] packages) resolve_version)

Compatibility overload. Use the version without a force_remove argument instead.

remove
void remove(string package_id, string version_, PlacementLocation location)

Removes a specific version of a package.

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

Compatibility overload. Use the version without a force_remove argument instead.

removeLocalPackage
void removeLocalPackage(string path, bool system)

Removes a directory from the list of locally known packages.

removeSearchPath
void removeSearchPath(string path, bool system)

Unregisters a local directory search path.

runDdox
void runDdox(bool run, string[] generate_args = null)

Runs DDOX to generate or serve documentation.

searchPackages
auto searchPackages(string query)

Queries all package suppliers with the given query string.

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

Executes tests on the current project.

upgrade
void upgrade(UpgradeOptions options, string[] packages_to_upgrade = null)

Attempts to upgrade the dependency selection of the loaded project.

Manifest constants

RemoveVersionWildcard
enum RemoveVersionWildcard;

@see remove(string, string, RemoveLocation)

Properties

defaultArchitecture
string defaultArchitecture [@property getter]

Returns the default architecture to use for building D code.

defaultCompiler
string defaultCompiler [@property getter]

Returns the default compiler binary to use for building D code.

projectName
string projectName [@property getter]

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

rootPath
NativePath rootPath [@property getter]
NativePath rootPath [@property setter]

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

Variables

defaultPlacementLocation
PlacementLocation defaultPlacementLocation;

The default placement location of fetched packages.

Meta