Paket 是一个开源项目。让我们挖掘源头。GitHub 上提供了 paket.dependencies 文件解析。这是逻辑:
match splitVersion text with
| "==", version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.OverrideAll v,parsePrerelease [v] rest)
| ">=", version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.Minimum v,parsePrerelease [v] rest)
| ">", version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.GreaterThan v,parsePrerelease [v] rest)
| "<", version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.LessThan v,parsePrerelease [v] rest)
| "<=", version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.Maximum v,parsePrerelease [v] rest)
| "~>", minimum :: rest ->
let v1 = SemVer.Parse minimum
VersionRequirement(VersionRange.Between(minimum,twiddle v1),parsePrerelease [v1] rest)
| _, version :: rest ->
let v = SemVer.Parse version
VersionRequirement(VersionRange.Specific v,parsePrerelease [v] rest)
| _ -> failwithf "could not parse version range \"%s\"" text
资源
因此==
将 VersionRange 设置为OverrideAll
. 这将对IsGlobalOverride
.
member x.IsGlobalOverride =
match x with
| OverrideAll _ -> true
| _ -> false
资源
总而言之==
,将覆盖给定版本的包,如果没有,将使用给定版本的当前包。这是一个粗略的理解,请以及任何彻底的答案。