Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart pub publish validation does not respect nested pubspec.yamls #3965

Open
dcharkes opened this issue Jul 11, 2023 · 0 comments
Open

dart pub publish validation does not respect nested pubspec.yamls #3965

dcharkes opened this issue Jul 11, 2023 · 0 comments
Assignees
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@dcharkes
Copy link
Contributor

Environment

Dart SDK version: 3.1.0-edge.b3cc093e4cafb349008272b594a1693956ff5d41 (be) (Mon Jul 10 12:23:15 2023 +0000) on "macos_arm64"
MacOS: 13.4.1 (22F82)
Normal pub.

Problem

When doing dart pub publish, all code is analyzed with the outermost pubspec.yaml rather than respecting pubspec.yamls in subfolders.

native_assets_builder dacoharkes$ dart pub publish --dry-run
[...]
Validating package... (1.1s)
Package validation found the following potential issues:
* line 5, column 1 of test/data/native_add_add_source/build.dart: This package does not have c_compiler in the `dependencies` or `dev_dependencies` section of `pubspec.yaml`.
    ╷
  5 │ import 'package:c_compiler/c_compiler.dart';
    │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
[...]

Package has 7 warnings.

pkgs/native_assets_builder/pubspec.yaml.

name: native_assets_builder
description: >-
  This package is the backend that invokes top-level `build.dart` scripts.
version: 0.1.0
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  graphs: ^2.3.1
  logging: ^1.2.0
  native_assets_cli: ^0.1.0
  package_config: ^2.1.0

dev_dependencies:
  dart_flutter_team_lints: ^1.0.0
  test: ^1.24.3
  yaml: ^3.1.2

# no c_compiler.

pkgs/native_assets_builder/test/data/native_add_add_source/pubspec.yaml

name: native_add
description: Sums two numbers with native code.
version: 0.1.0

publish_to: none

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  c_compiler:
    path: ../../../../c_compiler/ # We have c_compiler here!
  cli_config: ^0.1.1
  logging: ^1.1.1
  native_assets_cli: ^0.1.0

dev_dependencies:
  ffigen: ^8.0.2
  lints: ^2.0.0
  test: ^1.23.1

Expected behavior

The validator being happy.

After having run dart pub get inside pkgs/native_assets_builder/test/data/native_add_add_source/, the dart analyzer is happy. I'd expect dart pub get to be consistent with the analyzer.

Actual behavior

The validator complaining about dependencies missing in the outer pubspec.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants