@groovy.transform.CompileStatic @groovy.util.logging.Slf4j class GemVersion extends Object implements Comparable<GemVersion>
With rubygems almost all dependencies will be declared
via versions ranges and tools like Bundler are very strict on how to
resolve those versions - i.e. the resolved version needs to obey each given
constraint. Ivy does the same but Gradle and Ivy pick the latest and
newest version when there are more then one constraint for the same gem -
which can create problems when using Bundler alongside Gradle.
When converting a GemSpec into a Ivy ivy.xml the translation of a
gem version range into an Ivy version range. typically '~> 1.0' from ruby
becomes [1.0.0,2.0[ on the Ivy side. so most dependencies from
gem artifacts will use such version ranges.
To help gradle to be closer to the rubygems world when resolving gem
artifacts, it needs to calculate intersection between version ranges
in maven manner.
This class basically represents an Ivy version range with boundary
(exclusive vs. inclusive or open-ended) and its lower and upper bounded version and
allows to intersect its range with another version range.
It also translate fixed version '1.0' to [1.0, 1.0] or the gradle notation
1.2+ to [1.2, 1.99999] or 1.+ to [1.0, 1.99999] following the gemspec-to-pom
pattern.
| Modifiers | Name | Description |
|---|---|---|
static enum |
GemVersion.Boundary |
How versions at boundaries are defined. |
| Modifiers | Name | Description |
|---|---|---|
static GemVersion |
EVERYTHING |
|
static String |
MAX_VERSION |
|
static String |
MIN_VERSION |
|
static GemVersion |
NO_VERSION |
| Type Params | Return Type | Name and description |
|---|---|---|
|
int |
compareTo(GemVersion other)Allows for versions to be compared and sorted. |
|
boolean |
conflict()examines the version range on conflict, i.e. lower bound bigger then upper bound. |
|
static GemVersion |
gemVersionFromGemRequirement(String singleRequirement)Create a Gem version instance from a single GEM version requirement. |
|
static GemVersion |
gemVersionFromGradleIvyRequirement(String singleRequirement)Create a Gem version instance from a Gradle version requirement. |
|
static java.util.List<GemVersion> |
gemVersionsFromMultipleGemRequirements(String multipleRequirements)Takes a GEM requirement list and creates a list of GEM versions |
|
GemVersion |
intersect(String otherVersion)since GemVersion is version range with lower bound and upper bound this method just calculates the intersection of this version range with the given other version range. it also honors whether the boundary itself is included or excluded by the respective ranges. |
|
GemVersion |
intersect(GemVersion other)since GemVersion is version range with lower bound and upper bound this method just calculates the intersection of this version range with the given other version range. it also honors whether the boundary itself is included or excluded by the respective ranges. |
|
groovy.lang.Tuple2<String, Boundary> |
intersect(String version, GemVersion.Boundary boundary, String otherVersion, GemVersion.Boundary otherBoundary, boolean low) |
|
boolean |
isHighInclusive()Is the high version specification inclusive? |
|
boolean |
isHighOpenEnded()Is the high version unspecified? |
|
boolean |
isLowInclusive()Is the low version specification inclusive? |
|
static GemVersion |
singleGemVersionFromMultipleGemRequirements(String multipleRequirements)Takes a GEM requirement list and creates a single GEM version, by taking a union of all requirements. |
|
String |
toString()String of the underlying data as Ivy version range. |
Allows for versions to be compared and sorted.
other - Other GEM version to compare to.examines the version range on conflict, i.e. lower bound bigger then upper bound.
Create a Gem version instance from a single GEM version requirement.
singleRequirement - Single GEM requirement string.Create a Gem version instance from a Gradle version requirement.
singleRequirement - Gradle version string.Takes a GEM requirement list and creates a list of GEM versions
multipleRequirements - Comma-separated list of GEM requirements.since GemVersion is version range with lower bound and upper bound this method just calculates the intersection of this version range with the given other version range. it also honors whether the boundary itself is included or excluded by the respective ranges.
The - other version range to be intersected with this version rangesince GemVersion is version range with lower bound and upper bound this method just calculates the intersection of this version range with the given other version range. it also honors whether the boundary itself is included or excluded by the respective ranges.
The - other version range to be intersected with this version rangeIs the high version specification inclusive?
true if inclusive.Is the high version unspecified?
true if the high version is unspecified in the original GEM specification.Is the low version specification inclusive?
true if inclusive.Takes a GEM requirement list and creates a single GEM version, by taking a union of all requirements.
multipleRequirements - Comma-separated list of GEM requirements.String of the underlying data as Ivy version range.