Skip to content

Commit db4638d

Browse files
authored
Merge pull request #1260 from dart-lang/merge-pub_semver-package
Merge `package:pub_semver`
2 parents 7cbd039 + 8934289 commit db4638d

23 files changed

+4129
-0
lines changed

.github/ISSUE_TEMPLATE/pub_semver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
name: "package:pub_semver"
3+
about: "Create a bug or file a feature request against package:pub_semver."
4+
labels: "package:pub_semver"
5+
---

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
- changed-files:
8989
- any-glob-to-any-file: 'pkgs/pool/**'
9090

91+
'package:pub_semver':
92+
- changed-files:
93+
- any-glob-to-any-file: 'pkgs/pub_semver/**'
94+
9195
'package:source_map_stack_trace':
9296
- changed-files:
9397
- any-glob-to-any-file: 'pkgs/source_map_stack_trace/**'

.github/workflows/pub_semver.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: package:pub_semver
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/pub_semver.yaml'
9+
- 'pkgs/pub_semver/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/pub_semver.yaml'
14+
- 'pkgs/pub_semver/**'
15+
schedule:
16+
- cron: "0 0 * * 0"
17+
18+
env:
19+
PUB_ENVIRONMENT: bot.github
20+
21+
22+
defaults:
23+
run:
24+
working-directory: pkgs/pub_semver/
25+
26+
jobs:
27+
# Check code formatting and static analysis on a single OS (linux)
28+
# against Dart dev.
29+
analyze:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
sdk: [dev]
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
37+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
38+
with:
39+
sdk: ${{ matrix.sdk }}
40+
- id: install
41+
name: Install dependencies
42+
run: dart pub get
43+
- name: Check formatting
44+
run: dart format --output=none --set-exit-if-changed .
45+
if: always() && steps.install.outcome == 'success'
46+
- name: Analyze code
47+
run: dart analyze --fatal-infos
48+
if: always() && steps.install.outcome == 'success'
49+
50+
# Run tests on a matrix consisting of two dimensions:
51+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
52+
# 2. release channel: dev
53+
test:
54+
needs: analyze
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
# Add macos-latest and/or windows-latest if relevant for this package.
60+
os: [ubuntu-latest]
61+
sdk: [3.4, dev]
62+
steps:
63+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
64+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
65+
with:
66+
sdk: ${{ matrix.sdk }}
67+
- id: install
68+
name: Install dependencies
69+
run: dart pub get
70+
- name: Run VM tests
71+
run: dart test --platform vm
72+
if: always() && steps.install.outcome == 'success'
73+
- name: Run Chrome tests
74+
run: dart test --platform chrome --compiler dart2js,dart2wasm
75+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ don't naturally belong to other topic monorepos (like
3535
| [oauth2](pkgs/oauth2/) | A client library for authenticating with a remote service via OAuth2 on behalf of a user, and making authorized HTTP requests with the user's OAuth2 credentials. | [![package issues](https://img.shields.io/badge/package:oauth2-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aoauth2) | [![pub package](https://img.shields.io/pub/v/oauth2.svg)](https://pub.dev/packages/oauth2) |
3636
| [package_config](pkgs/package_config/) | Support for reading and writing Dart Package Configuration files. | [![package issues](https://img.shields.io/badge/package:package_config-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Apackage_config) | [![pub package](https://img.shields.io/pub/v/package_config.svg)](https://pub.dev/packages/package_config) |
3737
| [pool](pkgs/pool/) | Manage a finite pool of resources. Useful for controlling concurrent file system or network requests. | [![package issues](https://img.shields.io/badge/package:pool-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Apool) | [![pub package](https://img.shields.io/pub/v/pool.svg)](https://pub.dev/packages/pool) |
38+
| [pub_semver](pkgs/pub_semver/) | Versions and version constraints implementing pub's versioning policy. This is very similar to vanilla semver, with a few corner cases. | [![package issues](https://img.shields.io/badge/package:pub_semver-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Apub_semver) | [![pub package](https://img.shields.io/pub/v/pub_semver.svg)](https://pub.dev/packages/pub_semver) |
3839
| [source_map_stack_trace](pkgs/source_map_stack_trace/) | A package for applying source maps to stack traces. | [![package issues](https://img.shields.io/badge/package:source_map_stack_trace-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_map_stack_trace) | [![pub package](https://img.shields.io/pub/v/source_map_stack_trace.svg)](https://pub.dev/packages/source_map_stack_trace) |
3940
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![package issues](https://img.shields.io/badge/package:unified_analytics-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics) | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |
4041

pkgs/pub_semver/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.dart_tool/
2+
.packages
3+
pubspec.lock

pkgs/pub_semver/CHANGELOG.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
## 2.1.5
2+
3+
- Require Dart `3.4.0`.
4+
- Move to `dart-lang/tools` monorepo.
5+
6+
## 2.1.4
7+
8+
- Added topics to `pubspec.yaml`.
9+
10+
## 2.1.3
11+
12+
- Add type parameters to the signatures of the `Version.preRelease` and
13+
`Version.build` fields (`List` ==> `List<Object>`).
14+
[#74](https://github.com/dart-lang/pub_semver/pull/74).
15+
- Require Dart 2.17.
16+
17+
## 2.1.2
18+
19+
- Add markdown badges to the readme.
20+
21+
## 2.1.1
22+
23+
- Fixed the version parsing pattern to only accept dots between version
24+
components.
25+
26+
## 2.1.0
27+
28+
- Added `Version.canonicalizedVersion` to help scrub leading zeros and highlight
29+
that `Version.toString()` preserves leading zeros.
30+
- Annotated `Version` with `@sealed` to discourage users from implementing the
31+
interface.
32+
33+
## 2.0.0
34+
35+
- Stable null safety release.
36+
- `Version.primary` now throws `StateError` if the `versions` argument is empty.
37+
38+
## 1.4.4
39+
40+
- Fix a bug of `VersionRange.union` where ranges bounded at infinity would get
41+
combined wrongly.
42+
43+
# 1.4.3
44+
45+
- Update Dart SDK constraint to `>=2.0.0 <3.0.0`.
46+
- Update `package:collection` constraint to `^1.0.0`.
47+
48+
## 1.4.2
49+
50+
* Set max SDK version to `<3.0.0`.
51+
52+
## 1.4.1
53+
54+
* Fix a bug where there upper bound of a version range with a build identifier
55+
could accidentally be rewritten.
56+
57+
## 1.4.0
58+
59+
* Add a `Version.firstPreRelease` getter that returns the first possible
60+
pre-release of a version.
61+
62+
* Add a `Version.isFirstPreRelease` getter that returns whether a version is the
63+
first possible pre-release.
64+
65+
* `new VersionRange()` with an exclusive maximum now replaces the maximum with
66+
its first pre-release version. This matches the existing semantics, where an
67+
exclusive maximum would exclude pre-release versions of that maximum.
68+
69+
Explicitly representing this by changing the maximum version ensures that all
70+
operations behave correctly with respect to the special pre-release semantics.
71+
In particular, it fixes bugs where, for example,
72+
`(>=1.0.0 <2.0.0-dev).union(>=2.0.0-dev <2.0.0)` and
73+
`(>=1.0.0 <3.0.0).difference(^1.0.0)` wouldn't include `2.0.0-dev`.
74+
75+
* Add an `alwaysIncludeMaxPreRelease` parameter to `new VersionRange()`, which
76+
disables the replacement described above and allows users to create ranges
77+
that do include the pre-release versions of an exclusive max version.
78+
79+
## 1.3.7
80+
81+
* Fix more bugs with `VersionRange.intersect()`, `VersionRange.difference()`,
82+
and `VersionRange.union()` involving version ranges with pre-release maximums.
83+
84+
## 1.3.6
85+
86+
* Fix a bug where constraints that only allowed pre-release versions would be
87+
parsed as empty constraints.
88+
89+
## 1.3.5
90+
91+
* Fix a bug where `VersionRange.intersect()` would return incorrect results for
92+
pre-release versions with the same base version number as release versions.
93+
94+
## 1.3.4
95+
96+
* Fix a bug where `VersionRange.allowsAll()`, `VersionRange.allowsAny()`, and
97+
`VersionRange.difference()` would return incorrect results for pre-release
98+
versions with the same base version number as release versions.
99+
100+
## 1.3.3
101+
102+
* Fix a bug where `VersionRange.difference()` with a union constraint that
103+
covered the entire range would crash.
104+
105+
## 1.3.2
106+
107+
* Fix a checked-mode error in `VersionRange.difference()`.
108+
109+
## 1.3.1
110+
111+
* Fix a new strong mode error.
112+
113+
## 1.3.0
114+
115+
* Make the `VersionUnion` class public. This was previously used internally to
116+
implement `new VersionConstraint.unionOf()` and `VersionConstraint.union()`.
117+
Now it's public so you can use it too.
118+
119+
* Added `VersionConstraint.difference()`. This returns a constraint matching all
120+
versions matched by one constraint but not another.
121+
122+
* Make `VersionRange` implement `Comparable<VersionRange>`. Ranges are ordered
123+
first by lower bound, then by upper bound.
124+
125+
## 1.2.4
126+
127+
* Fix all remaining strong mode warnings.
128+
129+
## 1.2.3
130+
131+
* Addressed three strong mode warnings.
132+
133+
## 1.2.2
134+
135+
* Make the package analyze under strong mode and compile with the DDC (Dart Dev
136+
Compiler). Fix two issues with a private subclass of `VersionConstraint`
137+
having different types for overridden methods.
138+
139+
## 1.2.1
140+
141+
* Allow version ranges like `>=1.2.3-dev.1 <1.2.3` to match pre-release versions
142+
of `1.2.3`. Previously, these didn't match, since the pre-release versions had
143+
the same major, minor, and patch numbers as the max; now an exception has been
144+
added if they also have the same major, minor, and patch numbers as the min
145+
*and* the min is also a pre-release version.
146+
147+
## 1.2.0
148+
149+
* Add a `VersionConstraint.union()` method and a `new
150+
VersionConstraint.unionOf()` constructor. These each return a constraint that
151+
matches multiple existing constraints.
152+
153+
* Add a `VersionConstraint.allowsAll()` method, which returns whether one
154+
constraint is a superset of another.
155+
156+
* Add a `VersionConstraint.allowsAny()` method, which returns whether one
157+
constraint overlaps another.
158+
159+
* `Version` now implements `VersionRange`.
160+
161+
## 1.1.0
162+
163+
* Add support for the `^` operator for compatible versions according to pub's
164+
notion of compatibility. `^1.2.3` is equivalent to `>=1.2.3 <2.0.0`; `^0.1.2`
165+
is equivalent to `>=0.1.2 <0.2.0`.
166+
167+
* Add `Version.nextBreaking`, which returns the next version that introduces
168+
breaking changes after a given version.
169+
170+
* Add `new VersionConstraint.compatibleWith()`, which returns a range covering
171+
all versions compatible with a given version.
172+
173+
* Add a custom `VersionRange.hashCode` to make it properly hashable.
174+
175+
## 1.0.0
176+
177+
* Initial release.

pkgs/pub_semver/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2014, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)