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[] base, SkipPackageSuppliers skip)

Initializes the instance for use with a specific root package.

this
this(NativePath root, NativePath pkg_root)

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

this
deprecated this(NativePath pkg_root)
Undocumented in source.

Members

Functions

addLocalPackage
deprecated void addLocalPackage(string path, string ver, bool system)
void addLocalPackage(string path, string ver, PlacementLocation loc)

Adds a directory to the list of locally known packages.

addSearchPath
deprecated void addSearchPath(string path, bool system)
void addSearchPath(string path, PlacementLocation loc)

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

cachePathDontUse
NativePath cachePathDontUse()

Exposed because commandLine replicates generateProject for dub describe instead of treating it like a regular generator... Remove this once the flaw is fixed, and don't add more calls to this function!

clean
void clean()
void clean(Package pack)

Cleans intermediate/cache files of the given package (or all packages)

cleanPackage
deprecated void cleanPackage(NativePath path)

Cleans intermediate/cache files of the given package (or all packages)

convertRecipe
void convertRecipe(string destination_file_ext, bool print_only)

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

createEmptyPackage
void createEmptyPackage(NativePath path, string[] deps, string type, PackageFormat format, void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback, string[] app_args)

Initializes a directory with a package skeleton.

determineDefaultCompiler
string determineDefaultCompiler()

Determine the default compiler to use for this instance

fetch
deprecated Package fetch(string packageId, Dependency dep, PlacementLocation location, FetchOptions options, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
fetch
deprecated Package fetch(string name, Version vers, PlacementLocation location, FetchOptions options, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
fetch
deprecated Package fetch(string name, VersionRange range, PlacementLocation location, FetchOptions options, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
fetch
Package fetch(PackageName name, Version vers, FetchOptions options, string reason)
Package fetch(PackageName name, Version vers, FetchOptions options, PlacementLocation location, string reason)
Package fetch(PackageName name, VersionRange range, FetchOptions options, string reason)
Package fetch(PackageName name, VersionRange range, FetchOptions options, PlacementLocation location, string reason)

Fetches a missing package and stores it locally

generateProject
void generateProject(string ide, GeneratorSettings settings)

Generate project files for a specified generator.

getDefaultConfiguration
string getDefaultConfiguration(BuildPlatform platform, bool allow_non_library_configs)

Gets the default configuration for a particular build platform.

getLatestVersion
Version getLatestVersion(PackageName name, bool prefer_stable)

Returns the latest available version for a particular package.

getLatestVersion
deprecated Version getLatestVersion(string name, bool prefer_stable)
Undocumented in source. Be warned that the author may not have intended to support it.
getPackageSuppliers
deprecated PackageSupplier[] getPackageSuppliers(PackageSupplier[] base, SkipPackageSuppliers skip)

Get the list of package suppliers.

getPackageSuppliers
deprecated PackageSupplier[] getPackageSuppliers(PackageSupplier[] additional_package_suppliers)

Instantiate a PackageSupplier according to a given URL

init
void init()
Undocumented in source. Be warned that the author may not have intended to support it.
lintProject
void lintProject(string[] args)

Executes D-Scanner tests on the current project. *

listPackageVersions
Version[] listPackageVersions(PackageName name)

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

listPackageVersions
deprecated Version[] listPackageVersions(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
listProjectData
void listProjectData(GeneratorSettings settings, string[] requestedData, ListBuildSettingsFormat list_type)

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

loadConfig
Settings loadConfig(SpecialDirs dirs)

Load user configuration for this instance

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.

makePackageManager
PackageManager makePackageManager()

Get the PackageManager instance to use for this Dub instance

makePackageSupplier
PackageSupplier makePackageSupplier(string url)

Instantiate a PackageSupplier according to a given URL

makePackageSuppliers
PackageSupplier[] makePackageSuppliers(PackageSupplier[] base, SkipPackageSuppliers skip, string registry_var)

Get the list of package suppliers.

packageCache
NativePath packageCache(Package pkg)

Compute and returns the path were artifacts are stored

remove
void remove(Package pack)

Removes a specific locally cached package.

remove
deprecated void remove(Package pack, bool force_remove)

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

remove
void remove(PackageName name, PlacementLocation location, size_t delegate(in Package[] packages) resolve_version)

Removes one or more versions of a locally cached package.

remove
deprecated void remove(string name, PlacementLocation location, size_t delegate(in Package[] packages) resolve_version)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
deprecated void remove(string package_id, PlacementLocation location, bool force_remove, size_t delegate(in Package[] packages) resolve_version)

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

remove
void remove(PackageName name, string version_, PlacementLocation location)

Removes a specific version of a package.

remove
deprecated void remove(string name, string version_, PlacementLocation location)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
deprecated void remove(string package_id, string version_, PlacementLocation location, bool force_remove)

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

removeLocalPackage
deprecated void removeLocalPackage(string path, bool system)
void removeLocalPackage(string path, PlacementLocation loc)

Removes a directory from the list of locally known packages.

removeSearchPath
deprecated void removeSearchPath(string path, bool system)
void removeSearchPath(string path, PlacementLocation loc)

Deregisters a local directory search path.

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

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)

Generate project files using the special test runner (dub test) configuration.

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

Attempts to upgrade the dependency selection of the loaded project.

Manifest constants

RemoveVersionWildcard
enum RemoveVersionWildcard;

@see remove(string, string, RemoveLocation)

Properties

configurations
string[] configurations [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultArchitecture
string defaultArchitecture [@property getter]

Returns the default architecture to use for building D code.

defaultBuildEnvironments
const(string[string]) defaultBuildEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultCompiler
string defaultCompiler [@property getter]

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

defaultEnvironments
const(string[string]) defaultEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultLowMemory
bool defaultLowMemory [@property getter]

Returns the default low memory option to use for building D code.

defaultPostBuildEnvironments
const(string[string]) defaultPostBuildEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPostGenerateEnvironments
const(string[string]) defaultPostGenerateEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPostRunEnvironments
const(string[string]) defaultPostRunEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPreBuildEnvironments
const(string[string]) defaultPreBuildEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPreGenerateEnvironments
const(string[string]) defaultPreGenerateEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPreRunEnvironments
const(string[string]) defaultPreRunEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultRunEnvironments
const(string[string]) defaultRunEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
dryRun
bool dryRun [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
dryRun
bool dryRun [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
mainRecipePath
string mainRecipePath [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
mainRecipePath
string mainRecipePath [@property setter]

Whenever the switch --recipe= is supplied, this member will be populated.

packageManager
inout(PackageManager) packageManager [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
packageSuppliers
inout(PackageSupplier)[] packageSuppliers [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
project
inout(Project) project [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
projectName
string projectName [@property getter]

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

projectPath
NativePath projectPath [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
rootPath
NativePath rootPath [@property getter]
deprecated NativePath rootPath [@property setter]

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

Variables

defaultPlacementLocation
PlacementLocation defaultPlacementLocation;

The default placement location of fetched packages.

m_config
Settings m_config;
Undocumented in source.
m_defaultCompiler
string m_defaultCompiler;
Undocumented in source.
m_dirs
SpecialDirs m_dirs;
Undocumented in source.
m_dryRun
bool m_dryRun;
Undocumented in source.
m_mainRecipePath
string m_mainRecipePath;
Undocumented in source.
m_packageManager
PackageManager m_packageManager;
Undocumented in source.
m_packageSuppliers
PackageSupplier[] m_packageSuppliers;
Undocumented in source.
m_project
Project m_project;
Undocumented in source.
m_rootPath
NativePath m_rootPath;
Undocumented in source.

Meta