const class sys::Depend

sys::Obj
  sys::Depend

@Serializable { simple=true }

Source

Depend models a dependency as a pod name and a version constraint. Convention for Fantom pods is a four part version format of major.minor.build.patch.

The string format for Depend:

<depend>        := <name> space* <constraints>
<constraints>   := <constraint> [space* "," space* <constraint>]*
<constraint>    := <versionSimple> | <versionPlus> | <versionRange>
<versionSimple> := <version>
<versionPlus>   := <version> space* "+"
<versionRange>  := <version> space* "-" space* <version>
<version>       := <digits> ["." <digits>]*
<digits>        := <digit> [<digits>]*
<digit>         := "0" - "9"

Note a simple version constraint such as "foo 1.2" really means "1.2.*" - it will match all build numbers and patch numbers within "1.2". Likewise "foo 1.2.64" will match all patch numbers within the "1.2.64" build. The "+" plus sign is used to specify a given version and anything greater. The "-" dash is used to specify an inclusive range. When using a range, the end version is matched using the same rules as a simple version - for example "4", "4.2", and "4.0.99" are all matches for "foo 1.2-4". You may specify a list of potential constraints separated by commas - a match for the entire dependency is made if any one constraint is matched.

Examples:

"foo 1.2"      Any version of foo 1.2 with any build or patch number
"foo 1.2.64"   Any version of foo 1.2.64 with any patch number
"foo 0+"       Any version of foo - version wildcard
"foo 1.2+"     Any version of foo 1.2 or greater
"foo 1.2-1.4"  Any version between 1.2 and 1.4 inclusive
"foo 1.2,1.4"  Any version of 1.2 or 1.4
endVersion

Version endVersion(Int index := 0)

Source

Return the ending version if versionRange:

  • versionSimple: returns null
  • versionPlus: returns null
  • versionRange: returns end version
equals

virtual override Bool equals(Obj? that)

Source

Two Depends are equal if they have same normalized string representation.

fromStr

static new fromStr(Str s, Bool checked := true)

Source

Parse the string accordingly into a dependency. See class header for specification of the format. If invalid format and checked is false return null, otherwise throw ParseErr.

hash

virtual override Int hash()

Source

Return a hash code based on the normalized string representation.

isPlus

Bool isPlus(Int index := 0)

Source

Return if the constraint at the specified index is a versionPlus:

  • versionSimple: returns false
  • versionPlus: returns true
  • versionRange: returns false
isRange

Bool isRange(Int index := 0)

Source

Return if the constraint at the specified index is a versionRange:

  • versionSimple: returns false
  • versionPlus: returns false
  • versionRange: returns true
isSimple

Bool isSimple(Int index := 0)

Source

Return if the constraint at the specified index is neither a plus nor a range:

  • versionSimple: returns true
  • versionPlus: returns false
  • versionRange: returns false
match

Bool match(Version version)

Source

Return if the specified version is a match against this dependency's constraints. See class header for matching rules.

name

Str name()

Source

Get the pod name of the dependency.

size

Int size()

Source

Get the number of version constraints. There is always at least one constraint.

toStr

virtual override Str toStr()

Source

Get the normalized string format of this dependency. Normalized dependency strings do not contain any optional spaces. See class header for specification of the format.

version

Version version(Int index := 0)

Source

Get the version constraint at specified index:

  • versionSimple: returns the version
  • versionPlus: returns the version
  • versionRange: returns the start version