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(string spec)

Constructs a new dependency specification from a string

this
this(in Version ver)

Constructs a new dependency specification that matches a specific version.

this
this(NativePath path)

Constructs a new dependency specification that matches a specific path.

Members

Functions

mapToPath
Dependency mapToPath(NativePath path)

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

matches
bool matches(const(Version) v)
bool matches(ref const(Version) v)

Tests if the specification matches a specific version.

matches
bool matches(string vers)

Tests if the specification matches a specific version.

matchesAny
bool matchesAny()

Determines if this dependency specification matches arbitrary versions.

merge
Dependency merge(ref const(Dependency) o)

Merges two dependency specifications.

opCmp
int opCmp(in Dependency o)

Compares dependency specifications.

opEquals
bool opEquals(in Dependency o)
toHash
hash_t toHash()

Compares dependency specifications.

toJson
Json toJson()

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
NativePath path [@property setter]
NativePath path [@property getter]

If set, overrides any version based dependency selection.

versionSpec
string versionSpec [@property setter]
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