TestDub

An instance of Dub that does not rely on the environment

This instance of dub should not read any environment variables, nor should it do any file IO, to make it usable and reliable in unittests. Currently it reads environment variables but does not read the configuration.

Constructors

this
this(string root, PackageSupplier[] extras, SkipPackageSuppliers skip)

Forward to base constructor

Members

Functions

loadConfig
void loadConfig()

Avoid loading user configuration

Inherited Members

From Dub

defaultPlacementLocation
PlacementLocation defaultPlacementLocation;

The default placement location of fetched packages.

loadConfig
void loadConfig()

Load user configuration for this instance

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

Get the list of package suppliers.

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.
rootPath
NativePath rootPath [@property getter]
deprecated NativePath rootPath [@property setter]

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

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.
configurations
string[] configurations [@property getter]
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.
packageSuppliers
inout(PackageSupplier)[] packageSuppliers [@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.

defaultArchitecture
string defaultArchitecture [@property getter]

Returns the default architecture to use for building D code.

defaultLowMemory
bool defaultLowMemory [@property getter]

Returns the default low memory option 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.
defaultBuildEnvironments
const(string[string]) defaultBuildEnvironments [@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.
defaultPreGenerateEnvironments
const(string[string]) defaultPreGenerateEnvironments [@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.
defaultPreBuildEnvironments
const(string[string]) defaultPreBuildEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultPostBuildEnvironments
const(string[string]) defaultPostBuildEnvironments [@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.
defaultPostRunEnvironments
const(string[string]) defaultPostRunEnvironments [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
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.

getDefaultConfiguration
string getDefaultConfiguration(BuildPlatform platform, bool allow_non_library_configs)

Gets the default configuration for a particular build platform.

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

Attempts to upgrade the dependency selection of the loaded project.

generateProject
void generateProject(string ide, GeneratorSettings settings)

Generate project files for a specified generator.

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

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

lintProject
void lintProject(string[] args)

Executes D-Scanner tests on the current project. *

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

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

cleanPackage
deprecated void cleanPackage(NativePath path)
clean
void clean()
void clean(Package pack)

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

fetch
deprecated Package fetch(string packageId, Dependency dep, PlacementLocation location, FetchOptions options, string reason)
Package fetch(string packageId, Version vers, PlacementLocation location, FetchOptions options, string reason)
Package fetch(string packageId, VersionRange range, PlacementLocation location, FetchOptions options, string reason)

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

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.

RemoveVersionWildcard
enum RemoveVersionWildcard;

@see remove(string, string, RemoveLocation)

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

Removes a specific version of a package.

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.

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

Adds a directory to the list of locally known packages.

removeLocalPackage
void removeLocalPackage(string path, bool system)

Removes a directory from 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.

removeSearchPath
void removeSearchPath(string path, bool system)

Unregisters a local directory search path.

searchPackages
auto searchPackages(string query)

Queries all package suppliers with the given query string.

listPackageVersions
Version[] listPackageVersions(string name)

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

getLatestVersion
Version getLatestVersion(string package_name, bool prefer_stable)

Returns the latest available version for a particular package.

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.

convertRecipe
void convertRecipe(string destination_file_ext, bool print_only)

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

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

Runs DDOX to generate or serve documentation.

packageCache
NativePath packageCache(Package pkg)

Compute and returns the path were artifacts are stored

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!

Meta