Skip to content

Commit

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

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

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

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

env:
PUB_ENVIRONMENT: bot.github


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

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:
os: [ubuntu-latest]
sdk: [3.2, 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 --run-skipped
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 @@ -36,6 +36,7 @@ don't naturally belong to other topic monorepos (like
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
Expand Down
4 changes: 4 additions & 0 deletions pkgs/pubspec_parse/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Don’t commit the following directories created by pub.
.dart_tool/
.packages
pubspec.lock
104 changes: 104 additions & 0 deletions pkgs/pubspec_parse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
## 1.4.0

- Require Dart 3.2
- Seal the `Dependency` class.
- Set `Pubspec.environment` to non-nullable.
- Remove deprecated package_api_docs rule
- Move to `dart-lang/tools` monorepo.

## 1.3.0

- Require Dart 3.0
- Added support for `ignored_advisories` field.
- Added structural equality for `Dependency` subclasses and `HostedDetails`.

## 1.2.3

- Added topics to `pubspec.yaml`.

## 1.2.2

- Require Dart SDK >= 2.18.0
- Required `json_annotation: ^4.8.0`
- Added support for `topics` field.

## 1.2.1

- Added support for `funding` field.

## 1.2.0

- Added support for `screenshots` field.
- Update `HostedDetails` to reflect how `hosted` dependencies are parsed in
Dart 2.15:
- Add `HostedDetails.declaredName` as the (optional) `name` property in a
`hosted` block.
- `HostedDetails.name` now falls back to the name of the dependency if no
name is declared in the block.
- Require Dart SDK >= 2.14.0

## 1.1.0

- Export `HostedDetails` publicly.

## 1.0.0

- Migrate to null-safety.
- Pubspec: `author` and `authors` are both now deprecated.
See https://dart.dev/tools/pub/pubspec#authorauthors

## 0.1.8

- Allow the latest `package:pub_semver`.

## 0.1.7

- Allow `package:yaml` `v3.x`.

## 0.1.6

- Update SDK requirement to `>=2.7.0 <3.0.0`.
- Allow `package:json_annotation` `v4.x`.

## 0.1.5

- Update SDK requirement to `>=2.2.0 <3.0.0`.
- Support the latest `package:json_annotation`.

## 0.1.4

- Added `lenient` named argument to `Pubspec.fromJson` to ignore format and type errors.

## 0.1.3

- Added support for `flutter`, `issue_tracker`, `publish_to`, and `repository`
fields.

## 0.1.2+3

- Support the latest version of `package:json_annotation`.

## 0.1.2+2

- Support `package:json_annotation` v1.

## 0.1.2+1

- Support the Dart 2 stable release.

## 0.1.2

- Allow superfluous `version` keys with `git` and `path` dependencies.
- Improve errors when unsupported keys are provided in dependencies.
- Provide better errors with invalid `sdk` dependency values.
- Support "scp-like syntax" for Git SSH URIs in the form
`[user@]host.xz:path/to/repo.git/`.

## 0.1.1

- Fixed name collision with error type in latest `package:json_annotation`.
- Improved parsing of hosted dependencies and environment constraints.

## 0.1.0

- Initial release.
27 changes: 27 additions & 0 deletions pkgs/pubspec_parse/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2018, 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.
12 changes: 12 additions & 0 deletions pkgs/pubspec_parse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[![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)
[![pub package](https://img.shields.io/pub/v/pubspec_parse.svg)](https://pub.dev/packages/pubspec_parse)
[![package publisher](https://img.shields.io/pub/publisher/pubspec_parse.svg)](https://pub.dev/packages/pubspec_parse/publisher)

## What's this?

Supports parsing `pubspec.yaml` files with robust error reporting and support
for most of the documented features.

## More information

Read more about the [pubspec format](https://dart.dev/tools/pub/pubspec).
30 changes: 30 additions & 0 deletions pkgs/pubspec_parse/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://dart.dev/guides/language/analysis-options
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true
strict-inference: true

linter:
rules:
- avoid_bool_literals_in_conditional_expressions
- avoid_classes_with_only_static_members
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_returning_this
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
- cascade_invocations
- join_return_with_assignment
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- require_trailing_commas
- unnecessary_await_in_return
- use_string_buffers
25 changes: 25 additions & 0 deletions pkgs/pubspec_parse/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Read about `build.yaml` at https://pub.dev/packages/build_config
# To update generated code, run `pub run build_runner build`
targets:
$default:
builders:
json_serializable:
generate_for:
- lib/src/pubspec.dart
- lib/src/dependency.dart
options:
any_map: true
checked: true
create_to_json: false
field_rename: snake

# The end-user of a builder which applies "source_gen|combining_builder"
# may configure the builder to ignore specific lints for their project
source_gen|combining_builder:
options:
ignore_for_file:
- deprecated_member_use_from_same_package
- lines_longer_than_80_chars
- require_trailing_commas
# https://github.com/google/json_serializable.dart/issues/945
- unnecessary_cast
3 changes: 3 additions & 0 deletions pkgs/pubspec_parse/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tags:
presubmit-only:
skip: "Should only be run during presubmit"
14 changes: 14 additions & 0 deletions pkgs/pubspec_parse/lib/pubspec_parse.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

export 'src/dependency.dart'
show
Dependency,
GitDependency,
HostedDependency,
HostedDetails,
PathDependency,
SdkDependency;
export 'src/pubspec.dart' show Pubspec;
export 'src/screenshot.dart' show Screenshot;
Loading

0 comments on commit f29bcb5

Please sign in to comment.