Dependency

Represents a dependency specification.

A dependency specification either represents a specific version or version range, or a path to a package. In addition to that it has optional and default_ flags to control how non-mandatory dependencies are handled. The package name is notably not part of the dependency specification.

Constructors

this
this(NativePath path)

Constructs a new dependency specification that matches a specific path.

this
this(Repository repository)

Constructs a new dependency specification that matches a specific Git reference.

this
this(string spec)

Constructs a new dependency specification from a string

this
this(Version ver)

Constructs a new dependency specification that matches a specific version.

this
this(VersionRange rng)

Construct a version from a range of possible values

this
deprecated this(Repository repository, string spec)
Undocumented in source.

Members

Functions

mapToPath
Dependency mapToPath(NativePath path)

Returns a modified dependency that gets mapped to a given path.

matches
bool matches(string vers, VersionMatchMode mode)
bool matches(Version v, VersionMatchMode mode)

Tests if the specification matches a specific version.

matchesAny
deprecated bool matchesAny()

Determines if this dependency specification matches arbitrary versions.

merge
Dependency merge(const(Dependency) o)

Merges two dependency specifications.

opCmp
int opCmp(Dependency o)

Compares dependency specifications.

opEquals
bool opEquals(Dependency o)

Compares dependency specifications.

toJson
Json toJson(bool selections)

Returns a JSON representation of the dependency specification.

toString
string toString()

Returns a human-readable string representation of the dependency specification.

valid
bool valid()

Determines if this dependency specification is valid.

Properties

any
Dependency any [@property getter]

A Dependency, which matches every valid version.

default_
bool default_ [@property getter]
bool default_ [@property setter]

Determines if an optional dependency should be chosen by default.

invalid
Dependency invalid [@property getter]

An invalid dependency (with no possible version matches).

isExactVersion
bool isExactVersion [@property getter]

Returns true iff the version range only matches a specific version.

optional
bool optional [@property getter]
bool optional [@property setter]

Determines if the dependency is required or optional.

path
deprecated NativePath path [@property setter]
NativePath path [@property getter]

If set, overrides any version based dependency selection.

repository
deprecated Repository repository [@property setter]
Repository repository [@property getter]

If set, overrides any version based dependency selection.

versionSpec
deprecated string versionSpec [@property setter]
deprecated string versionSpec [@property getter]

Sets/gets the matching version range as a specification string.

version_
Version version_ [@property getter]

Returns the exact version matched by the version range.

Static functions

fromJson
Dependency fromJson(Json verspec)

Constructs a new Dependency from its JSON representation.

Meta