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, SkipPackageSuppliers skip_registry)

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)

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.

fetch
Package fetch(string packageId, 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)

Gets the default configuration for a particular build platform.

getLatestVersion
Version getLatestVersion(string package_name, bool prefer_stable)

Returns the latest available version for a particular package.

getPackageSuppliers
PackageSupplier[] getPackageSuppliers(PackageSupplier[] additional_package_suppliers, SkipPackageSuppliers skip_registry)
PackageSupplier[] getPackageSuppliers(PackageSupplier[] additional_package_suppliers)

Get the list of package suppliers.

lintProject
void lintProject(string[] args)

Executes D-Scanner tests on the current project. *

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
deprecated void overrideSearchPath(NativePath path)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
void remove(Package pack)

Removes a specific locally cached package.

remove
void remove(Package pack, bool force_remove)

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

remove
void remove(string package_id, PlacementLocation location, 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, 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)

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)

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 setter]
Undocumented in source. Be warned that the author may not have intended to support it.
packageManager
inout(PackageManager) packageManager [@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]
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