Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: mojo/public/dart/third_party/pub_semver/README.md

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 Handles version numbers and version constraints in the same way that [pub][]
2 does. The semantics here very closely follow the [Semantic Versioning][semver]
3 spec. It differs from semver in a few corner cases:
4
5 * **Version ordering does take build suffixes into account.** This is unlike
6 semver 2.0.0 but like earlier versions of semver. Version `1.2.3+1` is
7 considered a lower number than `1.2.3+2`.
8
9 Since a package may have published multiple versions that differ only by
10 build suffix, pub still has to pick one of them *somehow*. Semver leaves
11 that issue unresolved, so we just say that build numbers are sorted like
12 pre-release suffixes.
13
14 * **Pre-release versions are excluded from most max ranges.** Let's say a
15 user is depending on "foo" with constraint `>=1.0.0 <2.0.0` and that "foo"
16 has published these versions:
17
18 * `1.0.0`
19 * `1.1.0`
20 * `1.2.0`
21 * `2.0.0-alpha`
22 * `2.0.0-beta`
23 * `2.0.0`
24 * `2.1.0`
25
26 Versions `2.0.0` and `2.1.0` are excluded by the constraint since neither
27 matches `<2.0.0`. However, since semver specifies that pre-release versions
28 are lower than the non-prerelease version (i.e. `2.0.0-beta < 2.0.0`, then
29 the `<2.0.0` constraint does technically allow those.
30
31 But that's almost never what the user wants. If their package doesn't work
32 with foo `2.0.0`, it's certainly not likely to work with experimental,
33 unstable versions of `2.0.0`'s API, which is what pre-release versions
34 represent.
35
36 To handle that, `<` version ranges don't allow pre-release versions of the
37 maximum unless the max is itself a pre-release, or the min is a pre-release
38 of the same version. In other words, a `<2.0.0` constraint will prohibit not
39 just `2.0.0` but any pre-release of `2.0.0`. However, `<2.0.0-beta` will
40 exclude `2.0.0-beta` but allow `2.0.0-alpha`. Likewise, `>2.0.0-alpha
41 <2.0.0` will exclude `2.0.0-alpha` but allow `2.0.0-beta`.
42
43 * **Pre-release versions are avoided when possible.** The above case
44 handles pre-release versions at the top of the range, but what about in
45 the middle? What if "foo" has these versions:
46
47 * `1.0.0`
48 * `1.2.0-alpha`
49 * `1.2.0`
50 * `1.3.0-experimental`
51
52 When a number of versions are valid, pub chooses the best one where "best"
53 usually means "highest numbered". That follows the user's intuition that,
54 all else being equal, they want the latest and greatest. Here, that would
55 mean `1.3.0-experimental`. However, most users don't want to use unstable
56 versions of their dependencies.
57
58 We want pre-releases to be explicitly opt-in so that package consumers
59 don't get unpleasant surprises and so that package maintainers are free to
60 put out pre-releases and get feedback without dragging all of their users
61 onto the bleeding edge.
62
63 To accommodate that, when pub is choosing a version, it uses *priority*
64 order which is different from strict comparison ordering. Any stable
65 version is considered higher priority than any unstable version. The above
66 versions, in priority order, are:
67
68 * `1.2.0-alpha`
69 * `1.3.0-experimental`
70 * `1.0.0`
71 * `1.2.0`
72
73 This ensures that users only end up with an unstable version when there are
74 no alternatives. Usually this means they've picked a constraint that
75 specifically selects that unstable version -- they've deliberately opted
76 into it.
77
78 * **There is a notion of compatibility between pre-1.0.0 versions.** Semver
79 deems all pre-1.0.0 versions to be incompatible. This means that the only
80 way to ensure compatibility when depending on a pre-1.0.0 package is to
81 pin the dependency to an exact version. Pinned version constraints prevent
82 automatic patch and pre-release updates. To avoid this situation, pub
83 defines the "next breaking" version as the version which increments the
84 major version if it's greater than zero, and the minor version otherwise,
85 resets subsequent digits to zero, and strips any pre-release or build
86 suffix. For example, here are some versions along with their next breaking
87 ones:
88
89 `0.0.3` -> `0.1.0`
90 `0.7.2-alpha` -> `0.8.0`
91 `1.2.3` -> `2.0.0`
92
93 To make use of this, pub defines a "^" operator which yields a version
94 constraint greater than or equal to a given version, but less than its next
95 breaking one.
96
97 [pub]: http://pub.dartlang.org/
98 [semver]: http://semver.org/
OLDNEW
« no previous file with comments | « mojo/public/dart/third_party/pub_semver/LICENSE ('k') | mojo/public/dart/third_party/pub_semver/codereview.settings » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698