Skip to content

Commit

Permalink
Merge pull request #1260 from dart-lang/merge-pub_semver-package
Browse files Browse the repository at this point in the history
Merge `package:pub_semver`
  • Loading branch information
mosuem authored Dec 11, 2024
2 parents 7cbd039 + 8934289 commit db4638d
Show file tree
Hide file tree
Showing 23 changed files with 4,129 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/pub_semver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:pub_semver"
about: "Create a bug or file a feature request against package:pub_semver."
labels: "package:pub_semver"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/pool/**'

'package:pub_semver':
- changed-files:
- any-glob-to-any-file: 'pkgs/pub_semver/**'

'package:source_map_stack_trace':
- changed-files:
- any-glob-to-any-file: 'pkgs/source_map_stack_trace/**'
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/pub_semver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: package:pub_semver

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/pub_semver.yaml'
- 'pkgs/pub_semver/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/pub_semver.yaml'
- 'pkgs/pub_semver/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/pub_semver/

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome --compiler dart2js,dart2wasm
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ don't naturally belong to other topic monorepos (like
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |

Expand Down
3 changes: 3 additions & 0 deletions pkgs/pub_semver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dart_tool/
.packages
pubspec.lock
177 changes: 177 additions & 0 deletions pkgs/pub_semver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
## 2.1.5

- Require Dart `3.4.0`.
- Move to `dart-lang/tools` monorepo.

## 2.1.4

- Added topics to `pubspec.yaml`.

## 2.1.3

- Add type parameters to the signatures of the `Version.preRelease` and
`Version.build` fields (`List` ==> `List<Object>`).
[#74](https://github.com/dart-lang/pub_semver/pull/74).
- Require Dart 2.17.

## 2.1.2

- Add markdown badges to the readme.

## 2.1.1

- Fixed the version parsing pattern to only accept dots between version
components.

## 2.1.0

- Added `Version.canonicalizedVersion` to help scrub leading zeros and highlight
that `Version.toString()` preserves leading zeros.
- Annotated `Version` with `@sealed` to discourage users from implementing the
interface.

## 2.0.0

- Stable null safety release.
- `Version.primary` now throws `StateError` if the `versions` argument is empty.

## 1.4.4

- Fix a bug of `VersionRange.union` where ranges bounded at infinity would get
combined wrongly.

# 1.4.3

- Update Dart SDK constraint to `>=2.0.0 <3.0.0`.
- Update `package:collection` constraint to `^1.0.0`.

## 1.4.2

* Set max SDK version to `<3.0.0`.

## 1.4.1

* Fix a bug where there upper bound of a version range with a build identifier
could accidentally be rewritten.

## 1.4.0

* Add a `Version.firstPreRelease` getter that returns the first possible
pre-release of a version.

* Add a `Version.isFirstPreRelease` getter that returns whether a version is the
first possible pre-release.

* `new VersionRange()` with an exclusive maximum now replaces the maximum with
its first pre-release version. This matches the existing semantics, where an
exclusive maximum would exclude pre-release versions of that maximum.

Explicitly representing this by changing the maximum version ensures that all
operations behave correctly with respect to the special pre-release semantics.
In particular, it fixes bugs where, for example,
`(>=1.0.0 <2.0.0-dev).union(>=2.0.0-dev <2.0.0)` and
`(>=1.0.0 <3.0.0).difference(^1.0.0)` wouldn't include `2.0.0-dev`.

* Add an `alwaysIncludeMaxPreRelease` parameter to `new VersionRange()`, which
disables the replacement described above and allows users to create ranges
that do include the pre-release versions of an exclusive max version.

## 1.3.7

* Fix more bugs with `VersionRange.intersect()`, `VersionRange.difference()`,
and `VersionRange.union()` involving version ranges with pre-release maximums.

## 1.3.6

* Fix a bug where constraints that only allowed pre-release versions would be
parsed as empty constraints.

## 1.3.5

* Fix a bug where `VersionRange.intersect()` would return incorrect results for
pre-release versions with the same base version number as release versions.

## 1.3.4

* Fix a bug where `VersionRange.allowsAll()`, `VersionRange.allowsAny()`, and
`VersionRange.difference()` would return incorrect results for pre-release
versions with the same base version number as release versions.

## 1.3.3

* Fix a bug where `VersionRange.difference()` with a union constraint that
covered the entire range would crash.

## 1.3.2

* Fix a checked-mode error in `VersionRange.difference()`.

## 1.3.1

* Fix a new strong mode error.

## 1.3.0

* Make the `VersionUnion` class public. This was previously used internally to
implement `new VersionConstraint.unionOf()` and `VersionConstraint.union()`.
Now it's public so you can use it too.

* Added `VersionConstraint.difference()`. This returns a constraint matching all
versions matched by one constraint but not another.

* Make `VersionRange` implement `Comparable<VersionRange>`. Ranges are ordered
first by lower bound, then by upper bound.

## 1.2.4

* Fix all remaining strong mode warnings.

## 1.2.3

* Addressed three strong mode warnings.

## 1.2.2

* Make the package analyze under strong mode and compile with the DDC (Dart Dev
Compiler). Fix two issues with a private subclass of `VersionConstraint`
having different types for overridden methods.

## 1.2.1

* Allow version ranges like `>=1.2.3-dev.1 <1.2.3` to match pre-release versions
of `1.2.3`. Previously, these didn't match, since the pre-release versions had
the same major, minor, and patch numbers as the max; now an exception has been
added if they also have the same major, minor, and patch numbers as the min
*and* the min is also a pre-release version.

## 1.2.0

* Add a `VersionConstraint.union()` method and a `new
VersionConstraint.unionOf()` constructor. These each return a constraint that
matches multiple existing constraints.

* Add a `VersionConstraint.allowsAll()` method, which returns whether one
constraint is a superset of another.

* Add a `VersionConstraint.allowsAny()` method, which returns whether one
constraint overlaps another.

* `Version` now implements `VersionRange`.

## 1.1.0

* Add support for the `^` operator for compatible versions according to pub's
notion of compatibility. `^1.2.3` is equivalent to `>=1.2.3 <2.0.0`; `^0.1.2`
is equivalent to `>=0.1.2 <0.2.0`.

* Add `Version.nextBreaking`, which returns the next version that introduces
breaking changes after a given version.

* Add `new VersionConstraint.compatibleWith()`, which returns a range covering
all versions compatible with a given version.

* Add a custom `VersionRange.hashCode` to make it properly hashable.

## 1.0.0

* Initial release.
27 changes: 27 additions & 0 deletions pkgs/pub_semver/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2014, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit db4638d

Please sign in to comment.