Skip to content

Commit f29bcb5

Browse files
authored
Merge pull request #1261 from dart-lang/merge-pubspec_parse-package
Merge `package:pubspec_parse`
2 parents 3815ff3 + 4ebcd8e commit f29bcb5

24 files changed

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

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
- changed-files:
9393
- any-glob-to-any-file: 'pkgs/pub_semver/**'
9494

95+
'package:pubspec_parse':
96+
- changed-files:
97+
- any-glob-to-any-file: 'pkgs/pubspec_parse/**'
98+
9599
'package:source_map_stack_trace':
96100
- changed-files:
97101
- any-glob-to-any-file: 'pkgs/source_map_stack_trace/**'

.github/workflows/pubspec_parse.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: package:pubspec_parse
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/pubspec_parse.yaml'
9+
- 'pkgs/pubspec_parse/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/pubspec_parse.yaml'
14+
- 'pkgs/pubspec_parse/**'
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/pubspec_parse/
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+
os: [ubuntu-latest]
60+
sdk: [3.2, dev]
61+
steps:
62+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
63+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
64+
with:
65+
sdk: ${{ matrix.sdk }}
66+
- id: install
67+
name: Install dependencies
68+
run: dart pub get
69+
- name: Run VM tests
70+
run: dart test --platform vm --run-skipped
71+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ don't naturally belong to other topic monorepos (like
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) |
3838
| [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) |
39+
| [pubspec_parse](pkgs/pubspec_parse/) | Simple package for parsing pubspec.yaml files with a type-safe API and rich error reporting. | [![package issues](https://img.shields.io/badge/package:pubspec_parse-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Apubspec_parse) | [![pub package](https://img.shields.io/pub/v/pubspec_parse.svg)](https://pub.dev/packages/pubspec_parse) |
3940
| [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) |
4041
| [source_maps](pkgs/source_maps/) | A library to programmatically manipulate source map files. | [![package issues](https://img.shields.io/badge/package:source_maps-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_maps) | [![pub package](https://img.shields.io/pub/v/source_maps.svg)](https://pub.dev/packages/source_maps) |
4142
| [source_span](pkgs/source_span/) | Provides a standard representation for source code locations and spans. | [![package issues](https://img.shields.io/badge/package:source_span-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_span) | [![pub package](https://img.shields.io/pub/v/source_span.svg)](https://pub.dev/packages/source_span) |

pkgs/pubspec_parse/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Don’t commit the following directories created by pub.
2+
.dart_tool/
3+
.packages
4+
pubspec.lock

pkgs/pubspec_parse/CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
## 1.4.0
2+
3+
- Require Dart 3.2
4+
- Seal the `Dependency` class.
5+
- Set `Pubspec.environment` to non-nullable.
6+
- Remove deprecated package_api_docs rule
7+
- Move to `dart-lang/tools` monorepo.
8+
9+
## 1.3.0
10+
11+
- Require Dart 3.0
12+
- Added support for `ignored_advisories` field.
13+
- Added structural equality for `Dependency` subclasses and `HostedDetails`.
14+
15+
## 1.2.3
16+
17+
- Added topics to `pubspec.yaml`.
18+
19+
## 1.2.2
20+
21+
- Require Dart SDK >= 2.18.0
22+
- Required `json_annotation: ^4.8.0`
23+
- Added support for `topics` field.
24+
25+
## 1.2.1
26+
27+
- Added support for `funding` field.
28+
29+
## 1.2.0
30+
31+
- Added support for `screenshots` field.
32+
- Update `HostedDetails` to reflect how `hosted` dependencies are parsed in
33+
Dart 2.15:
34+
- Add `HostedDetails.declaredName` as the (optional) `name` property in a
35+
`hosted` block.
36+
- `HostedDetails.name` now falls back to the name of the dependency if no
37+
name is declared in the block.
38+
- Require Dart SDK >= 2.14.0
39+
40+
## 1.1.0
41+
42+
- Export `HostedDetails` publicly.
43+
44+
## 1.0.0
45+
46+
- Migrate to null-safety.
47+
- Pubspec: `author` and `authors` are both now deprecated.
48+
See https://dart.dev/tools/pub/pubspec#authorauthors
49+
50+
## 0.1.8
51+
52+
- Allow the latest `package:pub_semver`.
53+
54+
## 0.1.7
55+
56+
- Allow `package:yaml` `v3.x`.
57+
58+
## 0.1.6
59+
60+
- Update SDK requirement to `>=2.7.0 <3.0.0`.
61+
- Allow `package:json_annotation` `v4.x`.
62+
63+
## 0.1.5
64+
65+
- Update SDK requirement to `>=2.2.0 <3.0.0`.
66+
- Support the latest `package:json_annotation`.
67+
68+
## 0.1.4
69+
70+
- Added `lenient` named argument to `Pubspec.fromJson` to ignore format and type errors.
71+
72+
## 0.1.3
73+
74+
- Added support for `flutter`, `issue_tracker`, `publish_to`, and `repository`
75+
fields.
76+
77+
## 0.1.2+3
78+
79+
- Support the latest version of `package:json_annotation`.
80+
81+
## 0.1.2+2
82+
83+
- Support `package:json_annotation` v1.
84+
85+
## 0.1.2+1
86+
87+
- Support the Dart 2 stable release.
88+
89+
## 0.1.2
90+
91+
- Allow superfluous `version` keys with `git` and `path` dependencies.
92+
- Improve errors when unsupported keys are provided in dependencies.
93+
- Provide better errors with invalid `sdk` dependency values.
94+
- Support "scp-like syntax" for Git SSH URIs in the form
95+
`[user@]host.xz:path/to/repo.git/`.
96+
97+
## 0.1.1
98+
99+
- Fixed name collision with error type in latest `package:json_annotation`.
100+
- Improved parsing of hosted dependencies and environment constraints.
101+
102+
## 0.1.0
103+
104+
- Initial release.

pkgs/pubspec_parse/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2018, 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.

pkgs/pubspec_parse/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/pubspec_parse.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/pubspec_parse.yaml)
2+
[![pub package](https://img.shields.io/pub/v/pubspec_parse.svg)](https://pub.dev/packages/pubspec_parse)
3+
[![package publisher](https://img.shields.io/pub/publisher/pubspec_parse.svg)](https://pub.dev/packages/pubspec_parse/publisher)
4+
5+
## What's this?
6+
7+
Supports parsing `pubspec.yaml` files with robust error reporting and support
8+
for most of the documented features.
9+
10+
## More information
11+
12+
Read more about the [pubspec format](https://dart.dev/tools/pub/pubspec).
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# https://dart.dev/guides/language/analysis-options
2+
include: package:dart_flutter_team_lints/analysis_options.yaml
3+
4+
analyzer:
5+
language:
6+
strict-casts: true
7+
strict-inference: true
8+
9+
linter:
10+
rules:
11+
- avoid_bool_literals_in_conditional_expressions
12+
- avoid_classes_with_only_static_members
13+
- avoid_private_typedef_functions
14+
- avoid_redundant_argument_values
15+
- avoid_returning_this
16+
- avoid_unused_constructor_parameters
17+
- avoid_void_async
18+
- cancel_subscriptions
19+
- cascade_invocations
20+
- join_return_with_assignment
21+
- literal_only_boolean_expressions
22+
- missing_whitespace_between_adjacent_strings
23+
- no_adjacent_strings_in_list
24+
- no_runtimeType_toString
25+
- prefer_const_declarations
26+
- prefer_expression_function_bodies
27+
- prefer_final_locals
28+
- require_trailing_commas
29+
- unnecessary_await_in_return
30+
- use_string_buffers

pkgs/pubspec_parse/build.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Read about `build.yaml` at https://pub.dev/packages/build_config
2+
# To update generated code, run `pub run build_runner build`
3+
targets:
4+
$default:
5+
builders:
6+
json_serializable:
7+
generate_for:
8+
- lib/src/pubspec.dart
9+
- lib/src/dependency.dart
10+
options:
11+
any_map: true
12+
checked: true
13+
create_to_json: false
14+
field_rename: snake
15+
16+
# The end-user of a builder which applies "source_gen|combining_builder"
17+
# may configure the builder to ignore specific lints for their project
18+
source_gen|combining_builder:
19+
options:
20+
ignore_for_file:
21+
- deprecated_member_use_from_same_package
22+
- lines_longer_than_80_chars
23+
- require_trailing_commas
24+
# https://github.com/google/json_serializable.dart/issues/945
25+
- unnecessary_cast

0 commit comments

Comments
 (0)